mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-20 07:01:27 +02:00
don't load invalid window positions, only load window pos on first run
This commit is contained in:
@@ -88,7 +88,9 @@ void LoadWindowPosition()
|
|||||||
int borderTop, borderLeft;
|
int borderTop, borderLeft;
|
||||||
SDL_GetWindowBordersSize(sdl_window, &borderTop, &borderLeft, nullptr, nullptr);
|
SDL_GetWindowBordersSize(sdl_window, &borderTop, &borderLeft, nullptr, nullptr);
|
||||||
|
|
||||||
SDL_SetWindowPosition(sdl_window, savedWindowX + borderLeft, savedWindowY + borderTop);
|
if (savedWindowX + borderLeft > 0 && savedWindowX + borderLeft < desktopWidth
|
||||||
|
&& savedWindowY + borderTop > 0 && savedWindowY + borderTop < desktopHeight)
|
||||||
|
SDL_SetWindowPosition(sdl_window, savedWindowX + borderLeft, savedWindowY + borderTop);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveWindowPosition()
|
void SaveWindowPosition()
|
||||||
@@ -141,11 +143,6 @@ int SDLOpen()
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_DisplayMode SDLDisplayMode;
|
|
||||||
SDL_GetCurrentDisplayMode(0, &SDLDisplayMode);
|
|
||||||
desktopWidth = SDLDisplayMode.w;
|
|
||||||
desktopHeight = SDLDisplayMode.h;
|
|
||||||
|
|
||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
if (fullscreen)
|
if (fullscreen)
|
||||||
flags = altFullscreen ? SDL_WINDOW_FULLSCREEN : SDL_WINDOW_FULLSCREEN_DESKTOP;
|
flags = altFullscreen ? SDL_WINDOW_FULLSCREEN : SDL_WINDOW_FULLSCREEN_DESKTOP;
|
||||||
@@ -164,6 +161,15 @@ int SDLOpen()
|
|||||||
//SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
|
//SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
|
||||||
//SDL_SetWindowResizable(sdl_window, SDL_TRUE);
|
//SDL_SetWindowResizable(sdl_window, SDL_TRUE);
|
||||||
|
|
||||||
|
int displayIndex = SDL_GetWindowDisplayIndex(sdl_window);
|
||||||
|
if (displayIndex >= 0)
|
||||||
|
{
|
||||||
|
SDL_DisplayMode SDLDisplayMode;
|
||||||
|
SDL_GetCurrentDisplayMode(0, &SDLDisplayMode);
|
||||||
|
desktopWidth = SDLDisplayMode.w;
|
||||||
|
desktopHeight = SDLDisplayMode.h;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef WIN
|
#ifdef WIN
|
||||||
SDL_SysWMinfo SysInfo;
|
SDL_SysWMinfo SysInfo;
|
||||||
SDL_VERSION(&SysInfo.version);
|
SDL_VERSION(&SysInfo.version);
|
||||||
@@ -602,7 +608,8 @@ int main(int argc, char * argv[])
|
|||||||
Client::Ref().SetPref("Scale", 2);
|
Client::Ref().SetPref("Scale", 2);
|
||||||
showDoubleScreenDialog = true;
|
showDoubleScreenDialog = true;
|
||||||
}
|
}
|
||||||
LoadWindowPosition();
|
if (!Client::Ref().IsFirstRun())
|
||||||
|
LoadWindowPosition();
|
||||||
|
|
||||||
#ifdef OGLI
|
#ifdef OGLI
|
||||||
SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1);
|
SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1);
|
||||||
|
Reference in New Issue
Block a user