mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-27 06:35:39 +00:00
Fixes Issue 2080 for DX9 & OGL
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4910 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
57d6eabace
commit
af305ca95b
@ -200,12 +200,8 @@ HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const T
|
|||||||
{
|
{
|
||||||
m_hParent = m_hMain = parent;
|
m_hParent = m_hMain = parent;
|
||||||
|
|
||||||
m_hWnd = CreateWindowEx(0, m_szClassName, title, WS_CHILD,
|
m_hWnd = CreateWindow(m_szClassName, title, WS_CHILD,
|
||||||
0, 0, width, height,
|
0, 0, width, height, m_hParent, NULL, hInstance, NULL);
|
||||||
m_hParent, NULL, hInstance, NULL);
|
|
||||||
|
|
||||||
/*if( !g_Config.bFullscreen )
|
|
||||||
SetWindowPos( GetParent(m_hParent), NULL, 0, 0, width, height, SWP_NOMOVE|SWP_NOZORDER );*/
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -217,16 +213,14 @@ HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const T
|
|||||||
RECT rc = {0, 0, width, height};
|
RECT rc = {0, 0, width, height};
|
||||||
AdjustWindowRect(&rc, style, false);
|
AdjustWindowRect(&rc, style, false);
|
||||||
|
|
||||||
int w = rc.right - rc.left;
|
RECT rcdesktop;
|
||||||
int h = rc.bottom - rc.top;
|
GetWindowRect(GetDesktopWindow(), &rcdesktop);
|
||||||
|
|
||||||
rc.left = (1280 - w)/2;
|
int X = (rcdesktop.right-rcdesktop.left)/2 - (rc.right-rc.left)/2;
|
||||||
rc.right = rc.left + w;
|
int Y = (rcdesktop.bottom-rcdesktop.top)/2 - (rc.bottom-rc.top)/2;
|
||||||
rc.top = (1024 - h)/2;
|
|
||||||
rc.bottom = rc.top + h;
|
|
||||||
|
|
||||||
m_hWnd = CreateWindowEx(0, m_szClassName, title, style,
|
m_hWnd = CreateWindow(m_szClassName, title, style,
|
||||||
rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top,
|
X, Y, rc.right-rc.left, rc.bottom-rc.top,
|
||||||
NULL, NULL, hInstance, NULL);
|
NULL, NULL, hInstance, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,26 +247,11 @@ HWND Create(HWND hParent, HINSTANCE hInstance, const TCHAR *title)
|
|||||||
|
|
||||||
if (Ret)
|
if (Ret)
|
||||||
{
|
{
|
||||||
RECT rc = {0, 0, width, height};
|
|
||||||
RECT rcdesktop;
|
|
||||||
GetWindowRect(GetDesktopWindow(), &rcdesktop);
|
|
||||||
int X = (rcdesktop.right-rcdesktop.left)/2 - (rc.right-rc.left)/2;
|
|
||||||
int Y = (rcdesktop.bottom-rcdesktop.top)/2 - (rc.bottom-rc.top)/2;
|
|
||||||
|
|
||||||
if (g_Config.bFullscreen)
|
if (g_Config.bFullscreen)
|
||||||
{
|
|
||||||
ToggleFullscreen(Ret, true);
|
ToggleFullscreen(Ret, true);
|
||||||
}
|
|
||||||
else if (!g_Config.RenderToMainframe)
|
|
||||||
{
|
|
||||||
SetWindowPos(EmuWindow::GetWnd(), NULL, X, Y, rc.right-rc.left, rc.bottom-rc.top, SWP_NOREPOSITION | SWP_NOZORDER);
|
|
||||||
Show();
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
Show();
|
Show();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,7 +290,6 @@ void ToggleFullscreen(HWND hParent, bool bForceFull)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RECT rcdesktop;
|
|
||||||
int w_fs = 640, h_fs = 480;
|
int w_fs = 640, h_fs = 480;
|
||||||
if (!g_Config.bFullscreen || bForceFull)
|
if (!g_Config.bFullscreen || bForceFull)
|
||||||
{
|
{
|
||||||
@ -348,25 +326,26 @@ void ToggleFullscreen(HWND hParent, bool bForceFull)
|
|||||||
if (strlen(g_Config.cInternalRes) > 1)
|
if (strlen(g_Config.cInternalRes) > 1)
|
||||||
sscanf(g_Config.cInternalRes, "%dx%d", &w_fs, &h_fs);
|
sscanf(g_Config.cInternalRes, "%dx%d", &w_fs, &h_fs);
|
||||||
|
|
||||||
//Get out of fullscreen
|
|
||||||
g_Config.bFullscreen = false;
|
|
||||||
|
|
||||||
// FullScreen - > Desktop
|
// FullScreen - > Desktop
|
||||||
ChangeDisplaySettings(NULL, 0);
|
ChangeDisplaySettings(NULL, 0);
|
||||||
|
|
||||||
// Re-Enable the cursor
|
DWORD style = WS_OVERLAPPEDWINDOW;
|
||||||
ShowCursor(TRUE);
|
|
||||||
|
|
||||||
RECT rc = {0, 0, w_fs, h_fs};
|
RECT rc = {0, 0, w_fs, h_fs};
|
||||||
|
AdjustWindowRect(&rc, style, false);
|
||||||
|
RECT rcdesktop;
|
||||||
GetWindowRect(GetDesktopWindow(), &rcdesktop);
|
GetWindowRect(GetDesktopWindow(), &rcdesktop);
|
||||||
|
|
||||||
// SetWindowPos to the center of the screen
|
// SetWindowPos to the center of the screen
|
||||||
int X = (rcdesktop.right-rcdesktop.left)/2 - (rc.right-rc.left)/2;
|
int X = (rcdesktop.right-rcdesktop.left)/2 - (rc.right-rc.left)/2;
|
||||||
int Y = (rcdesktop.bottom-rcdesktop.top)/2 - (rc.bottom-rc.top)/2;
|
int Y = (rcdesktop.bottom-rcdesktop.top)/2 - (rc.bottom-rc.top)/2;
|
||||||
SetWindowPos(hParent, NULL, X, Y, w_fs, h_fs, SWP_NOREPOSITION | SWP_NOZORDER);
|
SetWindowPos(hParent, NULL, X, Y, rc.right-rc.left, rc.bottom-rc.top, SWP_NOREPOSITION | SWP_NOZORDER);
|
||||||
|
|
||||||
// Set new window style FS -> Windowed
|
// Set new window style FS -> Windowed
|
||||||
SetWindowLong(hParent, GWL_STYLE, WS_OVERLAPPEDWINDOW);
|
SetWindowLong(hParent, GWL_STYLE, style);
|
||||||
|
|
||||||
|
// Re-Enable the cursor
|
||||||
|
ShowCursor(TRUE);
|
||||||
|
g_Config.bFullscreen = false;
|
||||||
|
|
||||||
// Eventually show the window!
|
// Eventually show the window!
|
||||||
EmuWindow::Show();
|
EmuWindow::Show();
|
||||||
|
@ -151,10 +151,6 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_WIN32)
|
|
||||||
EmuWindow::SetSize(_twidth, _theight);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Control window size and picture scaling
|
// Control window size and picture scaling
|
||||||
s_backbuffer_width = _twidth;
|
s_backbuffer_width = _twidth;
|
||||||
s_backbuffer_height = _theight;
|
s_backbuffer_height = _theight;
|
||||||
@ -190,34 +186,15 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
|||||||
GLWin.cocoaCtx = cocoaGLInit(g_Config.iMultisampleMode);
|
GLWin.cocoaCtx = cocoaGLInit(g_Config.iMultisampleMode);
|
||||||
|
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
// Create rendering window in Windows
|
|
||||||
// Create a separate window
|
|
||||||
/*if (!g_Config.RenderToMainframe || g_VideoInitialize.pWindowHandle == NULL)
|
|
||||||
g_VideoInitialize.pWindowHandle = (void*)EmuWindow::Create(NULL, g_hInstance, _T("Please wait..."));
|
|
||||||
// Create a child window
|
|
||||||
else*/
|
|
||||||
g_VideoInitialize.pWindowHandle = (void*)EmuWindow::Create((HWND)g_VideoInitialize.pWindowHandle, g_hInstance, _T("Please wait..."));
|
g_VideoInitialize.pWindowHandle = (void*)EmuWindow::Create((HWND)g_VideoInitialize.pWindowHandle, g_hInstance, _T("Please wait..."));
|
||||||
|
|
||||||
// Show the window
|
|
||||||
EmuWindow::Show();
|
|
||||||
|
|
||||||
if (g_VideoInitialize.pWindowHandle == NULL)
|
if (g_VideoInitialize.pWindowHandle == NULL)
|
||||||
{
|
{
|
||||||
g_VideoInitialize.pSysMessage("failed to create window");
|
g_VideoInitialize.pSysMessage("failed to create window");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint PixelFormat; // Holds The Results After Searching For A Match
|
if (g_Config.bFullscreen)
|
||||||
DWORD dwExStyle; // Window Extended Style
|
{
|
||||||
DWORD dwStyle; // Window Style
|
|
||||||
|
|
||||||
RECT rcdesktop;
|
|
||||||
GetWindowRect(GetDesktopWindow(), &rcdesktop);
|
|
||||||
|
|
||||||
if (g_Config.bFullscreen) {
|
|
||||||
//s_backbuffer_width = rcdesktop.right - rcdesktop.left;
|
|
||||||
//s_backbuffer_height = rcdesktop.bottom - rcdesktop.top;
|
|
||||||
|
|
||||||
DEVMODE dmScreenSettings;
|
DEVMODE dmScreenSettings;
|
||||||
memset(&dmScreenSettings,0,sizeof(dmScreenSettings));
|
memset(&dmScreenSettings,0,sizeof(dmScreenSettings));
|
||||||
dmScreenSettings.dmSize = sizeof(dmScreenSettings);
|
dmScreenSettings.dmSize = sizeof(dmScreenSettings);
|
||||||
@ -230,10 +207,15 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
|||||||
if (ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
|
if (ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
|
||||||
{
|
{
|
||||||
if (MessageBox(NULL, _T("The Requested Fullscreen Mode Is Not Supported By\nYour Video Card. Use Windowed Mode Instead?"), _T("NeHe GL"),MB_YESNO|MB_ICONEXCLAMATION)==IDYES)
|
if (MessageBox(NULL, _T("The Requested Fullscreen Mode Is Not Supported By\nYour Video Card. Use Windowed Mode Instead?"), _T("NeHe GL"),MB_YESNO|MB_ICONEXCLAMATION)==IDYES)
|
||||||
g_Config.bFullscreen = false;
|
EmuWindow::ToggleFullscreen(EmuWindow::GetWnd());
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// SetWindowPos to the upper-left corner of the screen
|
||||||
|
SetWindowPos(EmuWindow::GetWnd(), HWND_TOP, 0, 0, _twidth, _theight, SWP_NOREPOSITION | SWP_NOZORDER);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -241,29 +223,8 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
|||||||
ChangeDisplaySettings(NULL, 0);
|
ChangeDisplaySettings(NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_Config.bFullscreen && !g_Config.RenderToMainframe)
|
// Show the window
|
||||||
{
|
EmuWindow::Show();
|
||||||
// Hide the cursor
|
|
||||||
ShowCursor(FALSE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
|
|
||||||
dwStyle = WS_OVERLAPPEDWINDOW;
|
|
||||||
}
|
|
||||||
|
|
||||||
RECT rc = {0, 0, s_backbuffer_width, s_backbuffer_height};
|
|
||||||
AdjustWindowRectEx(&rc, dwStyle, FALSE, dwExStyle);
|
|
||||||
|
|
||||||
int X = (rcdesktop.right-rcdesktop.left)/2 - (rc.right-rc.left)/2;
|
|
||||||
int Y = (rcdesktop.bottom-rcdesktop.top)/2 - (rc.bottom-rc.top)/2;
|
|
||||||
|
|
||||||
// EmuWindow::GetWnd() is either the new child window or the new separate window
|
|
||||||
if (g_Config.bFullscreen)
|
|
||||||
// We put the window at the upper left corner of the screen, so x = y = 0
|
|
||||||
SetWindowPos(EmuWindow::GetWnd(), NULL, 0, 0, rc.right-rc.left, rc.bottom-rc.top, SWP_NOREPOSITION | SWP_NOZORDER);
|
|
||||||
else
|
|
||||||
SetWindowPos(EmuWindow::GetWnd(), NULL, X, Y, rc.right-rc.left, rc.bottom-rc.top, SWP_NOREPOSITION | SWP_NOZORDER);
|
|
||||||
|
|
||||||
PIXELFORMATDESCRIPTOR pfd = // pfd Tells Windows How We Want Things To Be
|
PIXELFORMATDESCRIPTOR pfd = // pfd Tells Windows How We Want Things To Be
|
||||||
{
|
{
|
||||||
@ -287,21 +248,20 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
|||||||
0, 0, 0 // Layer Masks Ignored
|
0, 0, 0 // Layer Masks Ignored
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GLuint PixelFormat; // Holds The Results After Searching For A Match
|
||||||
|
|
||||||
if (!(hDC=GetDC(EmuWindow::GetWnd()))) {
|
if (!(hDC=GetDC(EmuWindow::GetWnd()))) {
|
||||||
PanicAlert("(1) Can't create an OpenGL Device context. Fail.");
|
PanicAlert("(1) Can't create an OpenGL Device context. Fail.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(PixelFormat = ChoosePixelFormat(hDC,&pfd))) {
|
if (!(PixelFormat = ChoosePixelFormat(hDC,&pfd))) {
|
||||||
PanicAlert("(2) Can't find a suitable PixelFormat.");
|
PanicAlert("(2) Can't find a suitable PixelFormat.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SetPixelFormat(hDC, PixelFormat, &pfd)) {
|
if (!SetPixelFormat(hDC, PixelFormat, &pfd)) {
|
||||||
PanicAlert("(3) Can't set the PixelFormat.");
|
PanicAlert("(3) Can't set the PixelFormat.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(hRC = wglCreateContext(hDC))) {
|
if (!(hRC = wglCreateContext(hDC))) {
|
||||||
PanicAlert("(4) Can't create an OpenGL rendering context.");
|
PanicAlert("(4) Can't create an OpenGL rendering context.");
|
||||||
return false;
|
return false;
|
||||||
|
@ -237,9 +237,19 @@ void OnKeyDown(WPARAM wParam)
|
|||||||
{
|
{
|
||||||
case VK_ESCAPE:
|
case VK_ESCAPE:
|
||||||
if (!g_Config.RenderToMainframe)
|
if (!g_Config.RenderToMainframe)
|
||||||
|
{
|
||||||
|
if (g_Config.bFullscreen)
|
||||||
|
{
|
||||||
|
// Pressing Esc switches to Windowed in Fullscreen mode
|
||||||
|
ToggleFullscreen(m_hWnd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// Pressing Esc stops the emulation
|
// Pressing Esc stops the emulation
|
||||||
SendMessage( m_hWnd, WM_CLOSE, 0, 0 );
|
SendMessage( m_hWnd, WM_CLOSE, 0, 0 );
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '3': // OSD keys
|
case '3': // OSD keys
|
||||||
@ -404,14 +414,9 @@ HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const T
|
|||||||
{
|
{
|
||||||
m_hParent = m_hMain = parent;
|
m_hParent = m_hMain = parent;
|
||||||
|
|
||||||
m_hWnd = CreateWindowEx(0, m_szClassName, title, WS_CHILD,
|
m_hWnd = CreateWindow(m_szClassName, title, WS_CHILD,
|
||||||
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
0, 0, width, height, parent, NULL, hInstance, NULL);
|
||||||
parent, NULL, hInstance, NULL);
|
|
||||||
|
|
||||||
/*if( !g_Config.bFullscreen )
|
|
||||||
SetWindowPos( GetParent(m_hParent), NULL, 0, 0, width, height, SWP_NOMOVE | SWP_NOZORDER );*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create new separate window
|
// Create new separate window
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -422,69 +427,35 @@ HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const T
|
|||||||
m_hMain = parent;
|
m_hMain = parent;
|
||||||
|
|
||||||
DWORD style = g_Config.bFullscreen ? WS_POPUP : WS_OVERLAPPEDWINDOW;
|
DWORD style = g_Config.bFullscreen ? WS_POPUP : WS_OVERLAPPEDWINDOW;
|
||||||
|
|
||||||
RECT rc = {0, 0, width, height};
|
RECT rc = {0, 0, width, height};
|
||||||
AdjustWindowRect(&rc, style, false);
|
AdjustWindowRect(&rc, style, false);
|
||||||
|
RECT rcdesktop;
|
||||||
|
GetWindowRect(GetDesktopWindow(), &rcdesktop);
|
||||||
|
|
||||||
int w = rc.right - rc.left;
|
int X = (rcdesktop.right-rcdesktop.left)/2 - (rc.right-rc.left)/2;
|
||||||
int h = rc.bottom - rc.top;
|
int Y = (rcdesktop.bottom-rcdesktop.top)/2 - (rc.bottom-rc.top)/2;
|
||||||
|
|
||||||
rc.left = (1280 - w)/2;
|
m_hWnd = CreateWindow(m_szClassName, title, style,
|
||||||
rc.right = rc.left + w;
|
X, Y, rc.right-rc.left, rc.bottom-rc.top,
|
||||||
rc.top = (1024 - h)/2;
|
|
||||||
rc.bottom = rc.top + h;
|
|
||||||
|
|
||||||
m_hWnd = CreateWindowEx(0, m_szClassName, title, style,
|
|
||||||
rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top,
|
|
||||||
NULL, NULL, hInstance, NULL);
|
NULL, NULL, hInstance, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_hWnd;
|
return m_hWnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToggleFullscreen(HWND hParent)
|
void ToggleFullscreen(HWND hParent, bool bForceFull)
|
||||||
{
|
{
|
||||||
if (m_hParent == NULL)
|
if (m_hParent == NULL)
|
||||||
{
|
{
|
||||||
int w_fs = 640, h_fs = 480;
|
int w_fs = 640, h_fs = 480;
|
||||||
if (g_Config.bFullscreen)
|
if (!g_Config.bFullscreen || bForceFull)
|
||||||
{
|
{
|
||||||
if (strlen(g_Config.cInternalRes) > 1)
|
|
||||||
sscanf(g_Config.cInternalRes, "%dx%d", &w_fs, &h_fs);
|
|
||||||
|
|
||||||
// Get out of fullscreen
|
|
||||||
g_Config.bFullscreen = false;
|
|
||||||
|
|
||||||
// FullScreen -> Desktop
|
|
||||||
ChangeDisplaySettings(NULL, 0);
|
|
||||||
|
|
||||||
// Get desktop resolution
|
|
||||||
RECT rcdesktop;
|
|
||||||
RECT rc = {0, 0, w_fs, h_fs};
|
|
||||||
GetWindowRect(GetDesktopWindow(), &rcdesktop);
|
|
||||||
|
|
||||||
ShowCursor(TRUE);
|
|
||||||
|
|
||||||
// SetWindowPos to the center of the screen
|
|
||||||
int X = (rcdesktop.right - rcdesktop.left)/2 - (rc.right - rc.left)/2;
|
|
||||||
int Y = (rcdesktop.bottom - rcdesktop.top)/2 - (rc.bottom - rc.top)/2;
|
|
||||||
SetWindowPos(hParent, NULL, X, Y, w_fs, h_fs, SWP_NOREPOSITION | SWP_NOZORDER);
|
|
||||||
|
|
||||||
// Set new window style FS -> Windowed
|
|
||||||
SetWindowLongPtr(hParent, GWL_STYLE, WS_OVERLAPPEDWINDOW);
|
|
||||||
|
|
||||||
// Eventually show the window!
|
|
||||||
EmuWindow::Show();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Get into fullscreen
|
|
||||||
DEVMODE dmScreenSettings;
|
|
||||||
memset(&dmScreenSettings, 0, sizeof(dmScreenSettings));
|
|
||||||
|
|
||||||
if (strlen(g_Config.cFSResolution) > 1)
|
if (strlen(g_Config.cFSResolution) > 1)
|
||||||
sscanf(g_Config.cFSResolution, "%dx%d", &w_fs, &h_fs);
|
sscanf(g_Config.cFSResolution, "%dx%d", &w_fs, &h_fs);
|
||||||
|
|
||||||
|
// Get into fullscreen
|
||||||
|
DEVMODE dmScreenSettings;
|
||||||
|
memset(&dmScreenSettings, 0, sizeof(dmScreenSettings));
|
||||||
// Desktop -> FullScreen
|
// Desktop -> FullScreen
|
||||||
dmScreenSettings.dmSize = sizeof(dmScreenSettings);
|
dmScreenSettings.dmSize = sizeof(dmScreenSettings);
|
||||||
dmScreenSettings.dmPelsWidth = w_fs;
|
dmScreenSettings.dmPelsWidth = w_fs;
|
||||||
@ -499,8 +470,37 @@ void ToggleFullscreen(HWND hParent)
|
|||||||
// SetWindowPos to the upper-left corner of the screen
|
// SetWindowPos to the upper-left corner of the screen
|
||||||
SetWindowPos(hParent, HWND_TOP, 0, 0, w_fs, h_fs, SWP_NOREPOSITION);
|
SetWindowPos(hParent, HWND_TOP, 0, 0, w_fs, h_fs, SWP_NOREPOSITION);
|
||||||
|
|
||||||
g_Config.bFullscreen = true;
|
|
||||||
ShowCursor(FALSE);
|
ShowCursor(FALSE);
|
||||||
|
g_Config.bFullscreen = true;
|
||||||
|
|
||||||
|
// Eventually show the window!
|
||||||
|
EmuWindow::Show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (strlen(g_Config.cInternalRes) > 1)
|
||||||
|
sscanf(g_Config.cInternalRes, "%dx%d", &w_fs, &h_fs);
|
||||||
|
|
||||||
|
// FullScreen -> Desktop
|
||||||
|
ChangeDisplaySettings(NULL, 0);
|
||||||
|
|
||||||
|
DWORD style = WS_OVERLAPPEDWINDOW;
|
||||||
|
RECT rc = {0, 0, w_fs, h_fs};
|
||||||
|
AdjustWindowRect(&rc, style, false);
|
||||||
|
RECT rcdesktop;
|
||||||
|
GetWindowRect(GetDesktopWindow(), &rcdesktop);
|
||||||
|
|
||||||
|
// SetWindowPos to the center of the screen
|
||||||
|
int X = (rcdesktop.right-rcdesktop.left)/2 - (rc.right-rc.left)/2;
|
||||||
|
int Y = (rcdesktop.bottom-rcdesktop.top)/2 - (rc.bottom-rc.top)/2;
|
||||||
|
SetWindowPos(hParent, NULL, X, Y, rc.right-rc.left, rc.bottom-rc.top, SWP_NOREPOSITION | SWP_NOZORDER);
|
||||||
|
|
||||||
|
// Set new window style FS -> Windowed
|
||||||
|
SetWindowLongPtr(hParent, GWL_STYLE, style);
|
||||||
|
|
||||||
|
// Re-Enable the cursor
|
||||||
|
ShowCursor(TRUE);
|
||||||
|
g_Config.bFullscreen = false;
|
||||||
|
|
||||||
// Eventually show the window!
|
// Eventually show the window!
|
||||||
EmuWindow::Show();
|
EmuWindow::Show();
|
||||||
|
@ -31,7 +31,7 @@ namespace EmuWindow
|
|||||||
HWND Create(HWND hParent, HINSTANCE hInstance, const TCHAR *title);
|
HWND Create(HWND hParent, HINSTANCE hInstance, const TCHAR *title);
|
||||||
void Show();
|
void Show();
|
||||||
void Close();
|
void Close();
|
||||||
void ToggleFullscreen(HWND hParent);
|
void ToggleFullscreen(HWND hParent, bool bForceFull = false);
|
||||||
void SetSize(int displayWidth, int displayHeight);
|
void SetSize(int displayWidth, int displayHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -343,7 +343,8 @@ void Initialize(void *init)
|
|||||||
#endif
|
#endif
|
||||||
UpdateActiveConfig();
|
UpdateActiveConfig();
|
||||||
|
|
||||||
if (!OpenGL_Create(g_VideoInitialize, 640, 480)) {
|
if (!OpenGL_Create(g_VideoInitialize, 640, 480))
|
||||||
|
{
|
||||||
g_VideoInitialize.pLog("Renderer::Create failed\n", TRUE);
|
g_VideoInitialize.pLog("Renderer::Create failed\n", TRUE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user