JBEngine: More Housekeeping and GUI Improvements

Published July 04, 2014
Advertisement
[color=#000000][font=Arial]

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.

[/font]

[font=Arial]

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.

[/font]

[font=Arial]

User Co-Ordinates: 1-100

[/font]
[font=Arial]

Internal Co-ordinates: 0 - 1

[/font]
[font=Arial]

Screen Space Co-ordinates -1 to 1

[/font]

[font=Arial]

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 ).

[/font]

[font=Arial]

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.

[/font]

[font=Arial]

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.

[/font][/color]

[color=#000000]Should be some videos and images soon so these posts don't seem so boring.[/color]
[color=#000000][font=Arial]

Plenty to do so I best get cracking smile.png

[/font][/color]
4 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement