diff options
author | Aki <please@ignore.pl> | 2024-02-29 00:43:41 +0100 |
---|---|---|
committer | Aki <please@ignore.pl> | 2024-02-29 00:43:41 +0100 |
commit | f616cfc78632fde437cfe15c7066bc8f31370d87 (patch) | |
tree | 8a8c2f04e95dbd2b578b7b6f1380c5f89429a277 /StarsEx/WndProc.cpp | |
parent | 9b12b549278c3dd462ee070f3520a31606d3f4dc (diff) | |
download | starshatter-f616cfc78632fde437cfe15c7066bc8f31370d87.zip starshatter-f616cfc78632fde437cfe15c7066bc8f31370d87.tar.gz starshatter-f616cfc78632fde437cfe15c7066bc8f31370d87.tar.bz2 |
Extracted window states out of GameWinDX9
Diffstat (limited to 'StarsEx/WndProc.cpp')
-rw-r--r-- | StarsEx/WndProc.cpp | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/StarsEx/WndProc.cpp b/StarsEx/WndProc.cpp index ae91a9a..0c48236 100644 --- a/StarsEx/WndProc.cpp +++ b/StarsEx/WndProc.cpp @@ -17,6 +17,12 @@ #endif +static struct { + bool maximized = false; + bool minimized = false; +} window_state; + + LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM uParam, LPARAM lParam) { @@ -54,31 +60,27 @@ WndProc(HWND hwnd, UINT message, WPARAM uParam, LPARAM lParam) // Pick up possible changes to window style due to maximize, etc. if (game && game->hwnd != NULL ) { game->window_style = GetWindowLong(game->hwnd, GWL_STYLE ); - if (uParam == SIZE_MINIMIZED) { - game->Pause(true); // Pause while we're minimized - game->is_minimized = true; - game->is_maximized = false; + game->Pause(true); + window_state.minimized = true; + window_state.maximized = false; } - else if (uParam == SIZE_MAXIMIZED) { - if (game->is_minimized) - game->Pause(false); // Unpause since we're no longer minimized - - game->is_minimized = false; - game->is_maximized = true; + if (window_state.minimized) + game->Pause(false); + window_state.minimized = false; + window_state.maximized = true; game->ResizeVideo(); } else if (uParam == SIZE_RESTORED) { - if (game->is_maximized) { - game->is_maximized = false; + if (window_state.maximized) { + window_state.maximized = false; game->ResizeVideo(); } - - else if (game->is_minimized) { - game->Pause(false); // Unpause since we're no longer minimized - game->is_minimized = false; + else if (window_state.minimized) { + game->Pause(false); + window_state.minimized = false; game->ResizeVideo(); } else { |