After a lot of fussing with TWL to get a UI working, I decided to create my own.  I hesitated to do this, as a UI system is practically an entire project unto itself. However the complexity of TWL combined with it only drawing in direct mode led me to engineer my own solution.  The custom solution takes advantage of Vertex Arrays and buffers the data rather than directly drawing the quads to the screen every frame.  A simple nesting pattern with individual offsets and event processing has allowed me to create a very basic UI with blocks of color.  Once the design of the game evolves further and the needed functionality is clearer, I plan to texture buttons and menus to make them look more elegant.


Part of implementing the UI was making a bitmap font that was renderable using Vertex Array Objects.  The BMFont format from has a simple and detailed XML output file that pairs with a generated PNG file.  After some experimenting with alpha blending and kerning, it turned out quite nice.  I allowed the code to scale the font to whatever size it needs, but bitmap fonts generally look best when they aren’t stretched or shrunk.  So currently there is some artifacting, which will be eliminated once the UI design evolves a bit further.

I also spent a good amount of time creating an ANT script that will correctly compile and package everything into a JAR along with the needed assets (textures, sounds, shader files).  All the assets are kept in a separate package structure, separated from all the class files, which helps me keep it organized more easily.  It took some trickery with classpaths to get things to run correctly both in Eclipse and in the compiled JAR.  In the end including the root of the project “/” in the classpath in Eclipse fixed most problems.

Other things that where done since the last update :

  • Added an audio system in a separate thread
  • Added OBJ file loading for loading polygon models
  • Increased flexibility of Entity attribute system
  • Added main menu, game creation, and in game UI
Be Sociable, Share!