mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-29 19:00:33 +02:00
set window position before displaying it
This commit is contained in:
@@ -546,17 +546,14 @@ int GetModifiers()
|
|||||||
|
|
||||||
// Returns true if the loaded position was set
|
// Returns true if the loaded position was set
|
||||||
// Returns false if something went wrong: SDL_GetWMInfo failed or the loaded position was invalid
|
// Returns false if something went wrong: SDL_GetWMInfo failed or the loaded position was invalid
|
||||||
bool LoadWindowPosition()
|
bool LoadWindowPosition(int scale)
|
||||||
{
|
{
|
||||||
SDL_SysWMinfo sysInfo;
|
SDL_SysWMinfo sysInfo;
|
||||||
SDL_VERSION(&sysInfo.version);
|
SDL_VERSION(&sysInfo.version);
|
||||||
if (SDL_GetWMInfo(&sysInfo) > 0)
|
if (SDL_GetWMInfo(&sysInfo) > 0)
|
||||||
{
|
{
|
||||||
RECT rcWindow;
|
int windowW = (XRES + BARSIZE) * scale;
|
||||||
GetWindowRect(sysInfo.window, &rcWindow);
|
int windowH = (YRES + MENUSIZE) * scale;
|
||||||
|
|
||||||
int windowW = rcWindow.right - rcWindow.left - 1;
|
|
||||||
int windowH = rcWindow.bottom - rcWindow.top - 1;
|
|
||||||
|
|
||||||
int savedWindowX = Client::Ref().GetPrefInteger("WindowX", INT_MAX);
|
int savedWindowX = Client::Ref().GetPrefInteger("WindowX", INT_MAX);
|
||||||
int savedWindowY = Client::Ref().GetPrefInteger("WindowY", INT_MAX);
|
int savedWindowY = Client::Ref().GetPrefInteger("WindowY", INT_MAX);
|
||||||
@@ -685,12 +682,10 @@ int main(int argc, char * argv[])
|
|||||||
tempScale = 1;
|
tempScale = 1;
|
||||||
|
|
||||||
int sdlStatus = SDLOpen();
|
int sdlStatus = SDLOpen();
|
||||||
sdl_scrn = SDLSetScreen(tempScale, tempFullscreen);
|
|
||||||
|
|
||||||
#ifdef WIN
|
#ifdef WIN
|
||||||
// Must be after SDLSetScreen to account for scale
|
LoadWindowPosition(tempScale);
|
||||||
LoadWindowPosition();
|
|
||||||
#endif
|
#endif
|
||||||
|
sdl_scrn = SDLSetScreen(tempScale, tempFullscreen);
|
||||||
|
|
||||||
#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