summaryrefslogtreecommitdiffhomepage
path: root/StarsEx/GameWinDX9.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'StarsEx/GameWinDX9.cpp')
-rw-r--r--StarsEx/GameWinDX9.cpp33
1 files changed, 17 insertions, 16 deletions
diff --git a/StarsEx/GameWinDX9.cpp b/StarsEx/GameWinDX9.cpp
index d49dfdb..78bdefe 100644
--- a/StarsEx/GameWinDX9.cpp
+++ b/StarsEx/GameWinDX9.cpp
@@ -45,11 +45,8 @@ GameWinDX9::GameWinDX9() :
video_settings {nullptr},
soundcard {nullptr},
screen {nullptr},
- is_windowed {false},
is_active {false},
is_device_lost {false},
- is_minimized {false},
- is_maximized {false},
ignore_size_change {false},
is_device_initialized {false},
is_device_restored {false}
@@ -283,7 +280,6 @@ GameWinDX9::InitVideo()
// save a copy of the device-specific video settings:
else if (video->GetVideoSettings()) {
*video_settings = *video->GetVideoSettings();
- is_windowed = video_settings->IsWindowed();
}
}
@@ -319,7 +315,6 @@ GameWinDX9::ResetVideo()
// save a copy of the device-specific video settings:
if (video->GetVideoSettings()) {
*video_settings = *video->GetVideoSettings();
- is_windowed = video_settings->IsWindowed();
}
Color::UseVideo(video);
@@ -349,7 +344,7 @@ bool
GameWinDX9::ResizeVideo()
{
if (!video || !video_settings) return false;
- if (!is_windowed) return false;
+ if (!IsWindowed()) return false;
if (ignore_size_change) return true;
HRESULT hr = S_OK;
@@ -386,7 +381,6 @@ GameWinDX9::ResizeVideo()
// save a copy of the device-specific video settings:
if (video->GetVideoSettings()) {
*video_settings = *video->GetVideoSettings();
- is_windowed = video_settings->IsWindowed();
}
screen->Resize(video_settings->window_width, video_settings->window_height);
@@ -405,8 +399,7 @@ GameWinDX9::ToggleFullscreen()
ignore_size_change = true;
// Toggle the windowed state
- is_windowed = !is_windowed;
- video_settings->is_windowed = is_windowed;
+ video_settings->is_windowed = !video_settings->is_windowed;
// Prepare window for windowed/fullscreen change
AdjustWindowForChange();
@@ -416,10 +409,9 @@ GameWinDX9::ToggleFullscreen()
// reset failed, try to restore...
ignore_size_change = false;
- if (!is_windowed) {
+ if (!IsWindowed()) {
// Restore window type to windowed mode
- is_windowed = !is_windowed;
- video_settings->is_windowed = is_windowed;
+ video_settings->is_windowed = !video_settings->is_windowed;
AdjustWindowForChange();
@@ -432,7 +424,7 @@ GameWinDX9::ToggleFullscreen()
SWP_SHOWWINDOW);
}
- ::Print("Unable to toggle %s fullscreen mode.\n", is_windowed ? "into" : "out of");
+ ::Print("Unable to toggle %s fullscreen mode.\n", IsWindowed() ? "into" : "out of");
}
else {
@@ -447,7 +439,7 @@ GameWinDX9::ToggleFullscreen()
// changed to 1024x768, because windows cannot be larger than the
// desktop.
- if (is_windowed) {
+ if (IsWindowed()) {
SetWindowPos(hwnd,
HWND_NOTOPMOST,
bounds_rect.left,
@@ -460,7 +452,7 @@ GameWinDX9::ToggleFullscreen()
GetClientRect(hwnd, &client_rect); // Update our copy
Pause(false);
- if (is_windowed)
+ if (IsWindowed())
screen->Resize(video_settings->window_width,
video_settings->window_height);
@@ -479,7 +471,7 @@ GameWinDX9::ToggleFullscreen()
bool
GameWinDX9::AdjustWindowForChange()
{
- if (is_windowed) {
+ if (IsWindowed()) {
// Set windowed-mode style
SetWindowLong(hwnd, GWL_STYLE, window_style);
if (hmenu != NULL) {
@@ -501,6 +493,15 @@ GameWinDX9::AdjustWindowForChange()
bool
+GameWinDX9::IsWindowed()
+{
+ if (video_settings)
+ return video_settings->IsWindowed();
+ return true;
+}
+
+
+bool
GameWinDX9::SetupPalette()
{
if (LoadPalette(standard_palette, inverse_palette)) {