Libgdx HTML5 Backend Update
I spent almost a week and a half on the HTML5 backend now and i’m happy to say that i could actually add more than i expected.
New Additions
- Reflection. Yes, that’s a stupid idea with GWT, but it enables a few things. You can’t use it for your own apps at the moment. Not sure i’ll open up that can of worms. If you are interested in how it works, check out this bozo.
- Json parsing with reflection. If you read into an ObjectMap things will just work. If you want to deserialize into your own POJOs i’ll have to add something so your POJOs are reflected.
- The entire scene2d package, including the UI stuff. This was enabled by adding basic Reflection capabilities
- All of Box2D works now, expect for GearJoint, WheelJoint and RopeJoint. The former two are currently broken in the JBox2D trunk, once those are fixed we have everything apart from RopeJoint.
- Preferences
- Fullscreen support
- Tons of other stuff under the hood that won’t affect you
- Binary file support, altough i recommend not using it, it’s slow by nature
You can try out most of our tests in HTML5 now. Some box2d tests might be slow due to ShapeRenderer. The box2d simulation itself runs blazingly fast
Todo
Replace gwt-voices with something else, e.g. a Sound Manager 2 wrapper. I didn’t dig into the gwt-voices sources to much, but for some reason it refuses to work at all in Safari and partially in Firefox.Done, custom wrapper around SoundManager 2, a fantastic API that works perfectly.Fix the backspace button problem so UI textfields work.Done- Add a very simple HttpUtils class that allows one to send POST/GET requests to a server. Note that due to the “Same Origin Policy” you’ll be restricted to send requests to the domain your app/game is hosted on.
Go through the list of FIXMEs in the source.Done, anything that’s marked as FIXME is either undoable for now, or non-critical.
I’ll most likely not support local files for the time being. Preferences should be sufficient for most games for now.
What Won’t Work
Tilemaps, Audio recorder/device, that’s about it. If i can find a nice Gzip decoder for GWT we can add Tilemaps in as well. Other than that we’ll be pretty much feature complete.
Simple Tutorial
I didn’t have time to write a tutorial on how to port your game yet. Here’s a nice tutorial by Molded Bits on how to get started with the new backend. The markers for files in the assets.txt file are: i -> image, t -> text file, b -> binary file. For now i won’t pack the backend jar with the nightlies as i want things to mature a tiny bit. I’ll follow up with something more in depth that will also show you how you can debug the emitted Javascript easily if necessary.
Ports
Here are a few recent ports.





