Windowed mode fixes; Double tap ESC to quit; Launcher improvements

This commit is contained in:
nastys
2019-08-08 16:01:08 +02:00
parent 0e63043885
commit 41be868bb8
3 changed files with 46 additions and 45 deletions
+17 -11
View File
@@ -36,18 +36,24 @@ int hookedCreateWindow(const char* title, void(__cdecl* exit_function)(int))
{
*fullScreenFlag = 0;
// looks like GLUT_SCREEN_WIDTH and GLUT_SCREEN_HEIGHT can have issues after SetProcessDPIAware()
// not sure if calling SetProcessDPIAware later will fix this, but I'll try it
// if not, using GetSystemMetrics should work
int screenWidth = glutGet(GLUT_SCREEN_WIDTH);
int screenHeight = glutGet(GLUT_SCREEN_HEIGHT);
//int screenWidth = GetSystemMetrics(SM_CXSCREEN);
//int screenHeight = GetSystemMetrics(SM_CYSCREEN);
// window position for centered window
int wndX = (screenWidth - nWidth) / 2;
int wndY = (screenHeight - nHeight) / 2;
RECT xy;
SetProcessDPIAware();
SystemParametersInfo(SPI_GETWORKAREA, 0, &xy, 0);
int screenWidth = xy.right - xy.left;
int screenHeight = xy.bottom - xy.top;
if (nWidth > screenWidth)
{
screenWidth = GetSystemMetrics(SM_CXFULLSCREEN);
xy.left = 0;
}
if (nHeight > screenHeight)
{
screenHeight = GetSystemMetrics(SM_CYFULLSCREEN);
xy.top = 0;
}
int wndX = xy.left + (screenWidth - nWidth) / 2;
int wndY = xy.top + (screenHeight - nHeight) / 2;
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);