Game Development Community

Screen Resolution Question

by Robert Fritzen · in Torque Game Engine Advanced · 01/05/2011 (7:46 pm) · 1 replies

I have a really quick question about the screen resolution.

I'm working on some GUI controls and I need to get the screen resolution to "automatically" adjust the gui controls to the screen size.

I saw this variable: $pref::Video::Resolution, and I'm wondering if just using the X and Y coords of that variable to adjust would be sufficient, or if there's a better function of some form to use.

Thanks for any help.

#1
01/07/2011 (2:16 am)
Just a quick update, I've gotten my gui function to run just fine out of the game's start up

function AttachRPGGui() {
   //obtain the client's "screen size"
   %reso = $pref::Video::Resolution;
   %x = getWord(%reso, 0);
   %y = getWord(%reso, 1);
   
   //Command Set Bars
   //Bottom Left
   %extentNeed = CSMainHud.extent;
   %x_need = getWord(%extentNeed, 0);
   %y_need = getWord(%extentNeed, 1);
   //for the left side, we can directly apply 0, for the bottom, a basic subtraction will do
   //apply it to the gui's position
   CSMainHud.setPosition(0, %y - %y_need);
   Canvas.pushDialog( CommandSetBars );
}

The only thing I'm noticing is when they change their reso, or go between full screen/windowed mode it messes it up, which functions call the updates to the reso and full screen, or do they even have a callback I can use?