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.
IndexDiscussionGeneral Discussion,  Status › Director programmer looking for some starting tips
Page Index Toggle Pages: 1
Director programmer looking for some starting tips (Read 1408 times)
Director programmer looking for some starting tips
Dec 16th, 2009, 2:24pm
 
Hi there

I'm coming to Processing for the first time from many years of Director development. I'm hoping to use it to develop some demo examples for a book I'm writing on game development - I've chosen it for a number of reasons, particularly the simple implementation and integration of both 2d and 3d.

What I've seen so far is looking very promising. I don't doubt that it'll do what I need, and I've already managed to get a few simple bits and pieces working within the IDE. What I'm looking for now is a little advice on how best to put the whole project together - I'd like to have the basic system working before I get down to the serious coding.

The book focuses on Maths and Physics, and what I don't want to do is to be re-writing all the basic code (eg vector maths) for every sketch. So the obvious thing is to put this code into a library, but then the code isn't viewable within the Processing environment. I don't want novice users to be forced to download and work their way around Eclipse - that's why I'm using Processing in the first place!

So is there any other simple way to share code snippets or classes between Processing sketches? Or does anyone have any other suggestions for alternative ways to organise this? How do you organise and reuse your Processor code between projects?
Re: Director programmer looking for some starting tips
Reply #1 - Dec 17th, 2009, 1:32am
 
I asked in the past for a way to have reusable code in some "user library" in the sketchbook. So far, authors hadn't the time (or will?) to do it.
Processing is mostly targeted at small sketches, even if there are some facilities like splitting code in tabs, etc.

So, currently, the only ways to share code across sketches is:
1) Copy/paste (urg! bad for maintenance...)
2) Make your own library in jar form (gah! bad if library isn't stabilized...)

Or perhaps use tools like Eclipse... Ie. use Processing as a plain Java library, with advantages... and inconveniences it brings.
Re: Director programmer looking for some starting tips
Reply #2 - Dec 18th, 2009, 12:12am
 
Danny,

Right now we have the Library system to offer. People don't need to use Eclipse to use a library, they just need to download the JAR file and then link it into their sketch. You can see how the Generative Gestaltung folks managed something similar for their book (see the bottom of the page.) You could include the library code with your examples for the students to see it, but they wouldn't be able to changed it without a Java system like Eclipse.

Alternatively, you can simply have the students download sketches with multiple tabs, with one tab containing the global classes for the book. This way it's hidden from the first view because it's in a tab, but they can see and edit the code as they choose. All the examples for the book can be in a single download for simplicity.

Best,
Casey
Re: Director programmer looking for some starting tips
Reply #3 - Dec 21st, 2009, 3:59am
 
Thanks, the tabs might just about be enough (although I agree with the poster above that a library of shared classes (outside a .jar framework) would be useful. The advantage is that for someone like me that knows programming in Director and ActionScript but isn't very familiar with the compilation pipeline of Java (with packages and suchlike) can just work directly in Processing without having to go into all that. And of course it makes the code-and-test process a lot more straightforward!

Once again, really impressed here. I tried to learn Java five years ago or so and got very frustrated as a Director user because of the lack of simple rendering frameworks that would let me do something simple like drawing to the screen and animating. This really makes a huge difference.

Thanks for the replies.
Re: Director programmer looking for some starting tips
Reply #4 - Dec 21st, 2009, 4:48am
 
ActionScript does use packages much like Java.
Page Index Toggle Pages: 1