Game Development Community

Getting the resolution of the game window

by Keith Johnston · in Torque 3D Professional · 10/28/2009 (1:31 am) · 3 replies

How can I get the resolution of the current game window, whether it is in windowed mode or fullscreen?

#1
10/28/2009 (2:01 am)
The object "Canvas" stores this information. It has quite a few methods to identify its state, set/getVideoMode, isFullScreen, isMinimized, isMaximized, etc.

If you do a dump in the console, Canvas.dump();, you will see the full list of methods available.
#2
10/28/2009 (9:17 am)
Hello.

This worked for me in TGEA:

#include "gui/3d/guiTSControl.h"  

 GuiTSCtrl *tsCtrl;  
 tsCtrl = dynamic_cast<GuiTSCtrl*>( Sim::findObject("PlayGui") );  
 Point2I resol = tsCtrl->getExtent();

In resol.x and resol.y, you should get resolution.
Hope this helps.
#3
10/29/2009 (10:37 pm)
The Canvas did the trick - this worked, thanks!

GuiCanvas *canvas = NULL;
   if (Sim::findObject( "Canvas", canvas ) )
   {
      Point2I currentRes = canvas->getWindowSize();
      ...
   }