Game Development Community

GUI Resizing incorrect?

by James Ford · in Torque X 2D · 07/11/2007 (4:35 pm) · 4 replies

I am having a problem with my GUIControls appearing in the wrong position. PlayScreen contains other guicontrols which should be positioned around its edges (according to the size of playscreen specified when it is declared--800 600) However, the control at 0,0 is actually not all the way in the top left corner, in fact its like playscreen was stretched to larger than 800 600 but the controls within it were not repositioned according to its new size. I am working on a widescreen monitor so I believe this has something to do with it but I couldnt track down the problem in code. Any ideas how to either fix this or work around it (eg. turn off widescreen)

#1
07/11/2007 (7:25 pm)
Check your XML settings. I'm pretty sure default is 1024 X 768. I know this because I just spent a week porting my whole game into 1360 X 768 (HD).
#2
07/12/2007 (9:09 am)
Ahah, I see whats happening now. Even though I'm designating my screen to be 800x600 it is being overriden by the xml settings to be 1024x768, which is fine, but then when I have this sub control within my screen:

GUIControl p2Gui = new GUIControl();
p2Gui.Name = "p2Gui";
p2Gui.Style = playerGUIStyle;
p2Gui.Size = new SizeF(200, 50);
p2Gui.Position = new Vector2(600, 0);
p2Gui.Folder = this;
p2Gui.Visible = true;
HorizSizing = HorizSizing.Relative;
VertSizing = VertSizing.Relative;

Its x position is 600 and its x size is 200, so it should be flush against the 800 width parent control. Then I remembered it doesnt do that behavior by default in TGB or TGE either you have to set its HorizSizing and VertSizing, so I did, but it made no difference. The p2Gui control is getting put at 600,0 not at the 824,0 it should be automatically repositioned to be at.
#3
07/14/2007 (2:36 pm)
We changed the alignment system and I don't have a copy of 1.0 here at home, but I'm pretty sure there were options in the HorizSizing enum for right/left-aligned controls.
#4
07/16/2007 (9:34 am)
I tried both Left/Right and relative and actually didnt notice any difference in the size or position of my controls at all.