Game Development Community

Centering a GUI on the screen

by Bryan Zarnett · in Torque Game Builder · 09/07/2009 (2:15 pm) · 2 replies

I have a GUI control set with a position of 0,0 and an extent of 800,600. The control within the GUI is centered.

When I push the GUI to the screen, the GUI is not centered.

I am using "Canvas.pushDialog(examineDetailsGui);" to push it to the screen.

What needs to be done to ensure that my GUI is centered on the screen.

Cheers,
Bryan

#1
09/18/2009 (12:50 pm)
What you described should work as long as the Camera resolution in the level builder is set to the same as your gui builder resolution (800 x 600).
#2
09/18/2009 (2:08 pm)
I get this problem all the time. If I've got a popup window, kind of like
FAKE CODE AHEAD!

new GuiControl(BlahWindowGUI) {
  new GuiWindowCtrl(BlahWindow) {
    ... Objects inside Window ...
  };
};
That I need to set "center center" in both the BlahWindowGUI and BlahWindow.