mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-24 09:03:48 +00:00
added fullscreen support for opengl (win32)
This commit is contained in:
parent
d01b48c93e
commit
2eb1238648
1 changed files with 27 additions and 6 deletions
|
|
@ -150,10 +150,29 @@ void Win32Window::setVideoMode( const GFXVideoMode &mode )
|
|||
|
||||
// Set our window to have the right style based on the mode
|
||||
if(mode.fullScreen && !Platform::getWebDeployment() && !mOffscreenRender)
|
||||
{
|
||||
SetWindowLong( getHWND(), GWL_STYLE, WS_POPUP);
|
||||
SetWindowPos( getHWND(), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
|
||||
|
||||
{
|
||||
WINDOWPLACEMENT wplacement = { sizeof(wplacement) };
|
||||
DWORD dwStyle = GetWindowLong(getHWND(), GWL_STYLE);
|
||||
MONITORINFO mi = { sizeof(mi) };
|
||||
|
||||
if (GetWindowPlacement(getHWND(), &wplacement) && GetMonitorInfo(MonitorFromWindow(getHWND(), MONITOR_DEFAULTTOPRIMARY), &mi))
|
||||
{
|
||||
DISPLAY_DEVICE dd = GetPrimaryDevice();
|
||||
DEVMODE dv;
|
||||
ZeroMemory(&dv, sizeof(dv));
|
||||
dv.dmSize = sizeof(DEVMODE);
|
||||
EnumDisplaySettings(dd.DeviceName, ENUM_CURRENT_SETTINGS, &dv);
|
||||
dv.dmPelsWidth = mode.resolution.x;
|
||||
dv.dmPelsHeight = mode.resolution.y;
|
||||
dv.dmFields = (DM_PELSWIDTH | DM_PELSHEIGHT);
|
||||
ChangeDisplaySettings(&dv, CDS_FULLSCREEN);
|
||||
SetWindowLong(getHWND(), GWL_STYLE, dwStyle & ~WS_OVERLAPPEDWINDOW);
|
||||
SetWindowPos(getHWND(), HWND_TOP, mi.rcMonitor.left, mi.rcMonitor.top,
|
||||
mi.rcMonitor.right - mi.rcMonitor.left,
|
||||
mi.rcMonitor.bottom - mi.rcMonitor.top,
|
||||
SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
|
||||
}
|
||||
|
||||
if(mDisplayWindow)
|
||||
ShowWindow(getHWND(), SW_SHOWNORMAL);
|
||||
|
||||
|
|
@ -172,7 +191,9 @@ void Win32Window::setVideoMode( const GFXVideoMode &mode )
|
|||
}
|
||||
else
|
||||
{
|
||||
// Reset device *first*, so that when we call setSize() and let it
|
||||
ChangeDisplaySettings(NULL, 0);
|
||||
|
||||
// Reset device *first*, so that when we call setSize() and let it
|
||||
// access the monitor settings, it won't end up with our fullscreen
|
||||
// geometry that is just about to change.
|
||||
|
||||
|
|
@ -1166,4 +1187,4 @@ const UTF16 *Win32Window::getWindowClassName()
|
|||
const UTF16 *Win32Window::getCurtainWindowClassName()
|
||||
{
|
||||
return _CurtainWindowClassName;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue