I spent a day working on the HUD (again). I went through a few iterations. Eventually per popular vote I am keeping it simple, for now. Here is a screenshot of the HUD partially added to the game.
After working on the HUD, I decided to do a few more cleanups in the code. In doing so, I have better defined how I will proceed.
- Moved all OpenGL code to one file, effectively separating the renderer from the game code
- Reorganized physics step callback to simply make more sense
- Simplified how the game refers to different types of entities
- Completely ditched the existing entity manager in favor of the physics engine keeping track of entity data as userdata
- Preset a bunch of handler functions based on the cleaned up physics step callback
In doing this, I have clarified to myself how I will be proceeding. My vision is clearer, and the base engine functionality is complete. I will now be able to start rolling out gameplay functionality. Good stuff on the horizon!
One last thing I did, was a few optimizations. First, by getting rid of the Entity manager, I have eliminated one full iteration of all entities each frame. Second, I have set up the GUI to render only when it has been changed. This offers a significant performance increase. In fact, the main menu goes from using 13% CPU to 3.5% CPU on my 2.3GHz i7 (8 logical cores, so it tops at 800% CPU usage).