GUI problems

Hi, I’m losing much more time with the GUI than I expected, maybe someone can give some advice or a better way to go. My game uses a very simple scoreboard, but I’m having trouble coding it with DirectGui

  • There is a way to set the position so resizing the window doesn’t change the look? I mean, If I’m displaying a label near the edge of the window, I don’t want it to be near the centre of the window when it’s resized. (maybe a fix would be to disallow resizing, that currently I don’t know how to do)

I’m thinking about forcing fullscreen at start so I can work that standard look, but I have a few questions: If my frames and labels look good in fullscreen, maybe they doesn’t look the same with different setup(monitor, graphic card, resolution) right? Anyway, how do I force fullscreen?

By the way, there are any code examples using a gui out of the music box tutorial?

So any comments from people having messed successfully with the gui are welcome.

Instead of parenting your button to aspect2d, parent it to one of base.a2dTopLeft, base.a2dTopRight, base.a2dBottomLeft, base.a2dBottomRight, base.a2dTopCenter, base.a2dBottomCenter, base.a2dLeftCenter, or base.a2dRightCenter. Each of these are anchored to their respective corners or edges, and the button will follow this anchor when the window is resized.


By the way, a quick way to get the gui placement using DirectGui is to set:

direct-gui-edit 1

in your Config.prc file. Then use the middle mouse button to move your gui objects around, and use control+middle mouse button to scale them. When you have them where you want them, break into your client and print button.getPos() or button.getScale(), then insert these values into your code.


Thanks David, I was working in a different branch of my game so meanwhile I could get some enlightenment on this subject, but now I expect I will be applying your advice soon