MCPcopy Create free account
hub / github.com/GarageGames/Torque2D / setScreenMode

Method setScreenMode

engine/source/platformEmscripten/EmscriptenOGLVideo.cpp:248–392  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

246
247//------------------------------------------------------------------------------
248bool OpenGLDevice::setScreenMode( U32 width, U32 height, U32 bpp,
249 bool fullScreen, bool forceIt, bool repaint )
250{
251 Resolution desktopRes = Video::getDesktopResolution();
252 // load resolutions, this is done lazily so that we can check the setting
253 // of smCanSwitchBitDepth, which may be overridden by console
254 if (mResolutionList.size()==0)
255 loadResolutions();
256
257 if (mResolutionList.size()==0)
258 {
259 Con::printf("No resolutions available!");
260 return false;
261 }
262
263 if (bpp == 0)
264 {
265 // bpp comes in as "0" when it is set to "Default"
266 bpp = desktopRes.bpp;
267 }
268
269 if (height == 0 || width == 0)
270 {
271 // paranoia check. set it to the default to prevent crashing
272 width = 800;
273 height = 600;
274 }
275
276 U32 desktopDepth = desktopRes.bpp;
277 // if we can't switch bit depths and the requested bpp is not equal to
278 // the desktop bpp, set bpp to the desktop bpp
279 if (!smCanSwitchBitDepth &&
280 bpp != desktopDepth)
281 {
282 bpp = desktopDepth;
283 }
284
285 bool IsInList = false;
286
287 Resolution NewResolution( width, height, bpp );
288
289 // See if the desired resolution is in the list
290 if ( mResolutionList.size() )
291 {
292 for ( int i = 0; i < mResolutionList.size(); i++ )
293 {
294 if ( width == mResolutionList[i].w
295 && height == mResolutionList[i].h
296 && bpp == mResolutionList[i].bpp )
297 {
298 IsInList = true;
299 break;
300 }
301 }
302
303 if ( !IsInList )
304 {
305 Con::printf( "Selected resolution not available: %d %d %d",

Callers

nothing calls this directly

Calls 10

printfFunction · 0.85
getBoolVariableFunction · 0.85
setBoolVariableFunction · 0.85
setVariableFunction · 0.85
evaluateFunction · 0.85
textureKillMethod · 0.80
textureResurrectMethod · 0.80
PrintGLAttributesFunction · 0.70
dSprintfFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected