We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › developing applications - techniques
Page Index Toggle Pages: 1
developing applications - techniques (Read 525 times)
developing applications - techniques
Dec 8th, 2005, 11:13pm
 
Hi

I'm developing an application which is starting to become reasonably long using the Java mode and want to create classes to allow flexibility.  I'm just not understanding when you add other scripts to the sketch folder and they appear as tabs withing the main sketch how these can be made into classes, how they are called, how variables can be declared globally etc. - the basics of developing any application that has more than one script.

Does anyone know of a tutorial / example which covers these principles in a very simple application?  Thanks in advance.

a+
gar
Re: developing applications - techniques
Reply #1 - Dec 10th, 2005, 8:12am
 
Take the example
File>Sketchbook>Examples>Structure>Objects

The main class is Objects (look at the Tab). It's Objects.pde which will be compiled as
- Objects.java
- MRect.java.

In the same example create a new Tab and name it as MRect: then cut the code of the class MRect and paste into the new Tab "MRect".
Now you have a main class Objects and another class MRect inside (you have the same but with two Tabs, each Tab is a class):
- Objects.java
- MRect.java

You can declare globally all the variables you want depending on what you want to do.

Make a glance to the examples, to the other posts and people sites... and wait for other answer better explained.

One Saludo and good luck.
Nach.
Page Index Toggle Pages: 1