563 h = r.bottom - r.top; |
565 h = r.bottom - r.top; |
564 x = (GetSystemMetrics(SM_CXSCREEN) - w) / 2; |
566 x = (GetSystemMetrics(SM_CXSCREEN) - w) / 2; |
565 y = (GetSystemMetrics(SM_CYSCREEN) - h) / 2; |
567 y = (GetSystemMetrics(SM_CYSCREEN) - h) / 2; |
566 |
568 |
567 if (_wnd.main_wnd) { |
569 if (_wnd.main_wnd) { |
|
570 ShowWindow(_wnd.main_wnd, SW_SHOWNORMAL); // remove maximize-flag |
568 SetWindowPos(_wnd.main_wnd, 0, x, y, w, h, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER); |
571 SetWindowPos(_wnd.main_wnd, 0, x, y, w, h, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER); |
569 } else { |
572 } else { |
570 char Windowtitle[50]; |
573 char Windowtitle[50]; |
571 |
574 |
572 snprintf(Windowtitle, lengthof(Windowtitle), "OpenTTD %s", _openttd_revision); |
575 snprintf(Windowtitle, lengthof(Windowtitle), "OpenTTD %s", _openttd_revision); |
573 |
576 |
574 _wnd.main_wnd = CreateWindow("OTTD", Windowtitle, style, x, y, w, h, 0, 0, GetModuleHandle(NULL), 0); |
577 _wnd.main_wnd = CreateWindow("OTTD", Windowtitle, style, x, y, w, h, 0, 0, GetModuleHandle(NULL), 0); |
575 if (_wnd.main_wnd == NULL) |
578 if (_wnd.main_wnd == NULL) error("CreateWindow failed"); |
576 error("CreateWindow failed"); |
579 |
|
580 /* On startup let's see if we quit maximized the last time, restore that */ |
|
581 if (_window_maximize) { |
|
582 ShowWindow(_wnd.main_wnd, SW_MAXIMIZE); |
|
583 _window_maximize = false; |
|
584 } |
577 } |
585 } |
578 } |
586 } |
579 GameSizeChanged(); // invalidate all windows, force redraw |
587 GameSizeChanged(); // invalidate all windows, force redraw |
580 } |
588 } |
581 |
589 |