Developing for HTML5 canvas using Box2D engine but NOT in Javascript
Basically I have the following constraints for an upcoming project/game:
- Drawing should be done in the HTML5 canvas element
- Use the Box2D physic engine (or equivalent physics engine)
- Game logic (and as much code as possible) should be in Java, as I'm profficient in Java and it would be nice to be able to port the project to Android.
It can be summed up in this: I want to develop games/projects in the HTML5 canvas element, using some kind of physics engine while avoiding the mess of javascript. (preferably but not necessarily through Java)
Is this possible? Would it be viable?
I've looked at GWT but I'm unsure how efficient it would be for animation, and how I would go about to incorporate Box2D. (or another physics engine i开发者_如何学运维n Java for example, but would the translation to javascript be fast enough?)
I know that GWT compiles Java to JavaScript, but it does so in the boundaries of its framework, so I don't know how easy it would be to use GWT in your project.
If you find JavaScript too frustrating, check out CoffeeScript. It slim and sharp, can interoperate with JavaScript (in your case Box2D JS port) seamlessly.
Google's PlayN (formerly ForPlay) was used for the web version of Angry Birds, using Box2D. It's mainly intended to use WebGL for the rendering, but can use the canvas element when WebGL is not available (Angry Birds requires Flash, for the audio).
http://code.google.com/p/playn/
http://www.youtube.com/watch?v=F_sbusEUz5w
精彩评论