Object declaration: is it possible to do it in a second file?

Hi all, I'm a newbie to Processing and just signed to the forum. My question is the following: is it possible to split the code in different files? I mean: I wrote a code in a single file, let's say "main.pde". In this code there is the declaration of the object "Foo". Now, is it possible to write the declaration of "Foo" in another file, for example "Foo.pde", and then include this file in "main.pde"? I googled for this information, but I always find examples using a single pde sketch. As you can understand, my background is C++ :) Thanks a lot, Valerio



  • edited February 2014 Answer ✓

    yes. use the tabs feature of the editor.

    the files in the various tabs are just concatenated before they are compiled, no need to include.

  • edited February 2014

    Complementing what @koogs said: All ".pde" tabs become 1 top class.
    We can have separate top classes by creating tabs suffixed w/ ".java" instead of ".pde".
    But then, those classes need, besides importing PApplet, the ".pde" reference in order to draw into its canvas.

Sign In or Register to comment.