MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / _setVideoMode

Method _setVideoMode

Engine/source/windowManager/win32/win32Window.cpp:146–280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144}
145
146void Win32Window::_setVideoMode( const GFXVideoMode &mode )
147{
148 bool needCurtain = ( mVideoMode.fullScreen != mode.fullScreen );
149
150 if( needCurtain )
151 {
152 Con::printf( "Win32Window::setVideoMode - invoking curtain" );
153 mOwningManager->lowerCurtain();
154 }
155
156 mVideoMode = mode;
157 mSuppressReset = true;
158
159 // Can't switch to fullscreen while a child of another window
160 if( mode.fullScreen && !Platform::getWebDeployment() && mOwningManager->getParentWindow() )
161 {
162 mOldParent = reinterpret_cast<HWND>( mOwningManager->getParentWindow() );
163 mOwningManager->setParentWindow( NULL );
164 }
165 else if( !mode.fullScreen && mOldParent )
166 {
167 mOwningManager->setParentWindow( mOldParent );
168 mOldParent = NULL;
169 }
170
171 // Set our window to have the right style based on the mode
172 if( mode.fullScreen && !Platform::getWebDeployment() && !mOffscreenRender )
173 {
174 WINDOWPLACEMENT wplacement = { sizeof( wplacement ) };
175 DWORD dwStyle = GetWindowLong( getHWND(), GWL_STYLE );
176 MONITORINFO mi = { sizeof(mi) };
177
178 if ( GetWindowPlacement( getHWND(), &wplacement ) && GetMonitorInfo( MonitorFromWindow( getHWND(), MONITOR_DEFAULTTOPRIMARY ), &mi ) )
179 {
180 DISPLAY_DEVICE dd = GetPrimaryDevice();
181 DEVMODE dv;
182 ZeroMemory( &dv, sizeof( dv ) );
183 dv.dmSize = sizeof( DEVMODE );
184 EnumDisplaySettings( dd.DeviceName, ENUM_CURRENT_SETTINGS, &dv );
185 dv.dmPelsWidth = mode.resolution.x;
186 dv.dmPelsHeight = mode.resolution.y;
187 dv.dmBitsPerPel = mode.bitDepth;
188 dv.dmDisplayFrequency = mode.refreshRate;
189 dv.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT;
190 ChangeDisplaySettings( &dv, CDS_FULLSCREEN );
191 SetWindowLong( getHWND(), GWL_STYLE, dwStyle & ~WS_OVERLAPPEDWINDOW );
192 SetWindowPos( getHWND(), HWND_TOP, mi.rcMonitor.left,
193 mi.rcMonitor.top,
194 mi.rcMonitor.right - mi.rcMonitor.left,
195 mi.rcMonitor.bottom - mi.rcMonitor.top,
196 SWP_NOOWNERZORDER | SWP_FRAMECHANGED );
197 }
198
199 if( mDisplayWindow )
200 ShowWindow( getHWND(), SW_SHOWNORMAL );
201
202 // Clear the menu bar from the window for full screen
203 if( GetMenu( getHWND() ) )

Callers

nothing calls this directly

Calls 10

printfFunction · 0.85
GetPrimaryDeviceFunction · 0.85
ZeroMemoryFunction · 0.85
lowerCurtainMethod · 0.45
getParentWindowMethod · 0.45
setParentWindowMethod · 0.45
isValidMethod · 0.45
resetModeMethod · 0.45
getDesktopResolutionMethod · 0.45
raiseCurtainMethod · 0.45

Tested by

no test coverage detected