Game Development Community

T3D Obtain Screen Resolution

by Walker Twyman · in Torque 3D Professional · 09/28/2011 (12:53 pm) · 3 replies

I'm sure this is a ridiculously simple question for people that have dealt with the source regularly. I'm more of an artist than a coder, and I would like a small amount of assistance with determining the player's screen resolution.

Right now, I have tried using:

GuiCanvas gcanvas;
Point 2I guiRes = gcanvas.GetWindowSize();

guiRes has an x and y value, but they are way different from my screen resolution. The x and y value doesn't change at all when I change my resolution and restart the game. Any help would be much appreciated.

-Walker

#1
09/28/2011 (1:52 pm)
In my experience, the GUI targets a fixed screen size for layout purposes, and then scales the chosen resolution up, down and sideways to match the actual screen size.

Because of the enormous variety of screen shapes, this can lead to more or less area displayed onscreen during runtime, so the GUI manager uses a "standard" screen for designers to target and then forces it to fit the actual display.

There is a popup listing the available screen targets near the top center of the GUI editor.

There is a fairly lengthy section in the documentation, "GUI Editor", here:

docs.garagegames.com/torque-3d/official/content/documentation/GUI%20Editor/Overv...

Unrelated to resolution, this series has some useful nuggets on GUI elements:

www.garagegames.com/community/resources/view/14868
#2
09/28/2011 (1:55 pm)
Hey Walker, try this:
Point2I screenSize = GFX->getActiveRenderTarget()->getSize();
#3
09/28/2011 (4:09 pm)
That's exactly what I was looking for. I've almost finished coding that fix. Thanks so much for your help.