video/win32_v.c
changeset 4258 3ac20963213d
parent 4077 d3022f976946
child 4300 687a17c9c557
equal deleted inserted replaced
4257:c738085d561e 4258:3ac20963213d
    27 	bool running;
    27 	bool running;
    28 } _wnd;
    28 } _wnd;
    29 
    29 
    30 bool _force_full_redraw;
    30 bool _force_full_redraw;
    31 bool _double_size;
    31 bool _double_size;
       
    32 bool _window_maximize;
    32 uint _display_hz;
    33 uint _display_hz;
    33 uint _fullscreen_bpp;
    34 uint _fullscreen_bpp;
    34 
    35 
    35 static void MakePalette(void)
    36 static void MakePalette(void)
    36 {
    37 {
   263 			DoExitSave();
   264 			DoExitSave();
   264 			_exit_game = true;
   265 			_exit_game = true;
   265 		} else {
   266 		} else {
   266 			AskExitGame();
   267 			AskExitGame();
   267 		}
   268 		}
       
   269 		_window_maximize = IsZoomed(_wnd.main_wnd);
   268 		return 0;
   270 		return 0;
   269 
   271 
   270 	case WM_LBUTTONDOWN:
   272 	case WM_LBUTTONDOWN:
   271 		SetCapture(hwnd);
   273 		SetCapture(hwnd);
   272 		_left_button_down = true;
   274 		_left_button_down = true;
   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