How do you create the most generic processing sketch?

I started with the regular processing IDE, and could successfully export my sketch to mac, W32bit and W64bit, as long as the java virtual machine is installed. Great!

But I want my sketch to run on Ipad, too. I read somewhere that I should use processing.js instead? If this is true, I need to update my code, because I used some classes, and these are not exportable in javascript mode.

Further, I want my sketch to run on android, too. I am still exploring, and have no idea whether this would require a real separate code version. Would it be regular processing, processing.js, of even some other variant?

It would be most convenient if I could add restrictions to my code, which guarantee that I can export it to anything, without the need to change code depending on the export-target. Is this possible? 'Do not use classes' is definitely one of them, but can someone imagine additional restrictions?

Tagged:

Answers

  • There isn't a magic "one size fits all" solution. Each mode has its own pros and cons.

    Java mode will work with existing Java libraries, which is a huge bonus. You can deploy it as a runnable jar or as platform-specific executables.

    Processing Android mode deploys to Android pretty easily, which is great, but can't deploy to anything else and probably doesn't work with every existing Java library.

    Processing.js is completely separate from the other Processing modes- it's not a Processing mode at all, but a new version of Processing built for JavaScript. Processing.js will not work with existing Java libraries. But the tradeoff is you'll be able to deploy as JavaScript, which pretty much runs everywhere, including on Android and iOS.

    Deploying cross-platform is pretty difficult, and Processing.js is the closest you'll get- but it comes with all the downsides of JavaScript. If you have some programming experience and really want to do cross-platform deployment, you should check out libGDX, which allows you to write Java code that deploys to desktop, Android, iOS, and as JavaScript.

Sign In or Register to comment.