Game Development Community

Finding Available Resolutions

by Bruno · in Torque Game Builder · 03/17/2006 (7:55 am) · 1 replies

Hi.,

I'm using the code below to find the available resolutions in my machine.
Either in OGL or D3D it's not outputting all the resolutions available, but only some of them..
Is there a way to get all the list of all of them ?

%this.clear();
	%resList = getResolutionList( %device );
	%resCount = getFieldCount( %resList );
	%deskRes = getDesktopResolution();

                %count = 0;
	for ( %i = 0; %i < %resCount; %i++ )
	{
		%res = getWords( getField( %resList, %i ), 0, 1 );

		if ( !%fullScreen )
		{
			if ( firstWord( %res ) >= firstWord( %deskRes ) )
				continue;
			if ( getWord( %res, 1 ) >= getWord( %deskRes, 1 ) )
				continue;
		}

		// Only add to list if it isn't there already:
		if ( %this.findText( %res ) == -1 )
      		{
			%this.add( %res, %count );
		                %count++;
	                }
	}

thanks,

Bruno

#1
03/17/2006 (8:54 am)
That's the same code as in the demos, so it should work.

I've just tested a bare T2D, and it lists all of my graphic modes, HOWEVER, the list is different between window and fullscreen mode.

Some modes can only be run full screen. Maybe that's why you have some of your resolution options missing.