RasPi: drop draw() and have main() instead?

edited November 2015 in Programming Questions

how to drop the function draw() and have the standard function main() instead like the way it's common to C/C++ ?

Answers

  • edited November 2015

    noLoop() turns off auto-callback of draw():
    https://Processing.org/reference/noLoop_.html

    We can also take full control of Processing by implementing our own main():

    public static void main(String[] args) {
      new Your_Own_Independent_Class();
    }
    
  • Answer ✓

    no, actually not. What I was missing so far, was: although Processing Sketches look like the Arduino Sketches, it's appearently not using C/C++ like the Arduino IDE does. But I'm always coding just in C/C++ (either native gcc or C/C++ via the Arduino IDE), never anything else. So I have to apologize that I didn't recognize that before.

  • There's also openFrameworks.cc which relies on C++:
    http://www.OpenFrameworks.cc/

  • edited November 2015

    thanks, but I was searching for something straight and simple like the Arduino IDE for Sketch C coding, most wishful as a cross compiler like for Arduinos, providing multitasking. That's how I'm doing it so far....

     #include <DueTimer.h>
     #include <Scheduler.h>
    
     int main() {                             
         setup();
    
         // attach and start Timer Interrupts
         // attach and start multitasking Scheduler loops
    
         if(...) {while(...) loop1();}
         else 
         //...
     }
    
Sign In or Register to comment.