How to keep GUI elements' relative position consistent?
by James Owen · in Torque Game Engine · 11/22/2004 (5:44 pm) · 6 replies
I have a timer with the following codes:
new GuiTimerHud(TimerHud) {
profile = "GuiDefaultProfile";
horizSizing = "left";
vertSizing = "bottom";
position = "130 3";
extent = "66 26";
minExtent = "8 8";
visible = "1";
helpTag = "0";
showFill = "1";
showFrame = "1";
fillColor = "0.000000 0.000000 0.000000 1.000000";
frameColor = "0.000000 1.000000 0.000000 1.000000";
textColor = "0.000000 1.000000 0.000000 1.000000";
};
When in 1024x768 resolution, the timerhud is near to the middle of the screen. When I reduce the resolution to 640x480, the scorebox will appear much nearer to the left of the screen.
Is there a way to keep the relative position of the GUI elements consistent with changes in resolution change? I've tried changing horizSizing to "relative", but it doesn't help.
Any suggestion?
Much appreciated.
new GuiTimerHud(TimerHud) {
profile = "GuiDefaultProfile";
horizSizing = "left";
vertSizing = "bottom";
position = "130 3";
extent = "66 26";
minExtent = "8 8";
visible = "1";
helpTag = "0";
showFill = "1";
showFrame = "1";
fillColor = "0.000000 0.000000 0.000000 1.000000";
frameColor = "0.000000 1.000000 0.000000 1.000000";
textColor = "0.000000 1.000000 0.000000 1.000000";
};
When in 1024x768 resolution, the timerhud is near to the middle of the screen. When I reduce the resolution to 640x480, the scorebox will appear much nearer to the left of the screen.
Is there a way to keep the relative position of the GUI elements consistent with changes in resolution change? I've tried changing horizSizing to "relative", but it doesn't help.
Any suggestion?
Much appreciated.
#2
Note that in the editor, if you change of field on the left, you MUST hit apply before doing anything else for it to take effect.
11/22/2004 (6:52 pm)
Try using right and top instead of left and bottom, or maybe center if that exists. Sometimes those values can be deceiving, but if you hit f10 while in game, you can play with the GUI editor and figure out how they work.Note that in the editor, if you change of field on the left, you MUST hit apply before doing anything else for it to take effect.
#3
I've tried changed horizSizing and vertSizing to "relative", "left" and "bottom", but they don't help.
Is there any 'global variable' that I must enable for 'relative' location to work?
Thanks again.
11/22/2004 (9:24 pm)
Thanks for the suggestions.I've tried changed horizSizing and vertSizing to "relative", "left" and "bottom", but they don't help.
Is there any 'global variable' that I must enable for 'relative' location to work?
Thanks again.
#4
11/22/2004 (10:14 pm)
Did you hit apply after changing it?
#5
11/22/2004 (10:26 pm)
I've found that using multiple embedded containers (windows) can help give more precise and consistant resizing.
#6
So the parent GUI would look something like this:
new GuiControl(myDlg) {
profile = "GuiDefaultProfile";
horizSizing = "relative";
vertSizing = "relative";
position = "0 0";
extent = "640 480";
minExtent = "8 8";
visible = "1";
helpTag = "0";
new GuiTimerHud(TimerHud) {
etc...
That's how I have it.
Nick
11/22/2004 (11:28 pm)
I believe that if you want to use "relative", it's parent must also be set to "relative". And the parent should always be set to the minimum resolution (640x480) that way it resizes upwards.So the parent GUI would look something like this:
new GuiControl(myDlg) {
profile = "GuiDefaultProfile";
horizSizing = "relative";
vertSizing = "relative";
position = "0 0";
extent = "640 480";
minExtent = "8 8";
visible = "1";
helpTag = "0";
new GuiTimerHud(TimerHud) {
etc...
That's how I have it.
Nick
Torque Owner Josh Moore