JBEngine: More Housekeeping and GUI Improvements
So I have done more housekeeping, it can be sightly tedious but the feeling at the end is amazing. Just knowing that your code is abstract and reusable, along with smaller compile times is ace. I have taken out all the game specific code and put it into it's own project and the JBEngine project is now compiled as a library and linked to from the game project. I have also added a Level Editor project which is where I will more than likely be doing most of my work for a while. This is going to give me a great chance to test out my GUI elements fully and add any new bits that might be necessary.
After doing an initial look through of my GUI elements I realised I needed to sort out how the font size would work with the Text and also that the calculations for figuring out the actual size and offset of the images was far too complicated. I have managed to sort out the calculations, which took a while as I was getting confused between user co-ordinates, internal co-ordinates and then screen space co-ordinates.
User Co-Ordinates: 1-100
Internal Co-ordinates: 0 - 1
Screen Space Co-ordinates -1 to 1
To overcome this, instead of passing the scale and offset of the textures in screen space coords I instead changed the Quad I was using for the full screen from ( -1 to 1 ) to ( 0 - 1 ). This meant that all my calculations could be done in the 0 - 1 coords and then finally in the vertex shader just do a conversion to get the vertex positions in ( -1 to 1 ).
It was all a bit of a headache really but the code is much simpler now and it also made it easier to sort out how the font sizes would work. I ended up settling on using pixels to decide font size, meaning that the text will scale when the resolution changes. This seems to be the way most games are doing it now. This is still to be fully implemented but It shouldn't take too long.
The Level Editor should come along fairly quickly as the majority of the functionality is there already within the engine so it will just be a case of setting up all the GUI elements and adding the logic for the editor. This is still a sizable amount of work and could easily get out of hand if I don't keep tight goals on it.
Should be some videos and images soon so these posts don't seem so boring.
Plenty to do so I best get cracking