Game Development Community

Game aspect ratio not correct

by Charlie Talley · in Torque X 2D · 07/01/2009 (4:17 pm) · 6 replies

My game resolution, in TorqueSettings.xml and the design resolutions in TXB (both camera and design background) are set to 1280x720. For all my splash screens and loaded scenes, I make sure to set PreserveAspectRatio to true in the style. The screens still come out looking stretched vertically. Am I missing a setting or boolean?

#1
07/01/2009 (5:04 pm)
Can I presume you're using a widescreen monitor?
#2
07/02/2009 (1:40 am)
Sorry, forgot to mention that. I'm using a 4:3 monitor, at 1024x768 resolution. The 720 height resolution seems to show up fine, but the 1280 horizontal design resolution seems to get squished into the 1024 monitor resolution. Is there any way to make TX letterbox and automatically scale the rendering down to a 16:9, even on a 4:3 monitor?
#3
07/02/2009 (12:08 pm)
There is letterboxing available for the GUICanvas. I haven't worked with that much, but the splash screen I've been using came from some sample and has this in its constructor:
// create a black letterbox
GUIStyle lbStyle = new GUIStyle();
lbStyle.IsOpaque = true;
lbStyle.FillColor[0] = Color.Black;

GUIControl letterbox = new GUIControl();
letterbox.Style = lbStyle;
GUICanvas.Instance.LetterBoxControl = letterbox;

Maybe if you try that in your game begin method it'll work.
#4
07/02/2009 (12:37 pm)
Also, are you setting the Size of the GUISceneview? That is the rectangle of the screen onto which the camera view is projected.

If you are using the default sceneview that is created along with the GUICanvas, you should be able to access it as:
GUIControl sv = GUICanvas.Instance.GetObject(0) as GUIControl;
That's assuming that the sceneview is set as the content contol, i.e. the first child of the GUICanvas, which it should be. I think you would need to set its Size and set PreserveAspectRatio to true.

Note that if Size is not set, but PreserveAspectRatio is, then nothing will render, because the sceneview's width would be undefined.
#5
07/02/2009 (11:50 pm)
***Deleted by poster***
#6
08/03/2009 (12:47 pm)
Scott, in the torquex book that sample you gave is supposed to maintain a 4:3 ratio on a widescreen display.
I'm not sure if John made a mistake, because letterboxing I thought was viewing 16:9 on a 4:3 (creating bars on top and bottom).

I'm trying to maintain my 4:3 (1024x768) on the widescreen xbox
and I can't do it. (create bars on the left and right)

that gui letterbox control doesn't seem to do anything

Any ideas?