summaryrefslogtreecommitdiffhomepage
path: root/Stars45
diff options
context:
space:
mode:
Diffstat (limited to 'Stars45')
-rw-r--r--Stars45/CmpnScreen.cpp4
-rw-r--r--Stars45/DetailSet.cpp5
-rw-r--r--Stars45/Game.cpp32
-rw-r--r--Stars45/Game.h6
-rw-r--r--Stars45/GameWinDX9.cpp38
-rw-r--r--Stars45/GameWinDX9.h7
-rw-r--r--Stars45/LoadScreen.cpp4
-rw-r--r--Stars45/MenuScreen.cpp4
-rw-r--r--Stars45/PlanScreen.cpp4
-rw-r--r--Stars45/StarSystem.cpp4
-rw-r--r--Stars45/Starshatter.cpp20
-rw-r--r--Stars45/Starshatter.h3
12 files changed, 56 insertions, 75 deletions
diff --git a/Stars45/CmpnScreen.cpp b/Stars45/CmpnScreen.cpp
index 44a3863..b5b787b 100644
--- a/Stars45/CmpnScreen.cpp
+++ b/Stars45/CmpnScreen.cpp
@@ -28,7 +28,7 @@
#include "Player.h"
#include "MusicDirector.h"
-#include "Game.h"
+#include "GameWinDX9.h"
#include "ContentBundle.h"
#include "Video.h"
#include "Screen.h"
@@ -178,7 +178,7 @@ CmpnScreen::GetFieldOfView() const
void
CmpnScreen::ExecFrame()
{
- Game::GetInstance()->SetScreenColor(Color::Black);
+ GameWinDX9::GetInstance()->SetScreenColor(Color::Black);
if (cmd_orders_dlg && cmd_orders_dlg->IsShown()) {
cmd_orders_dlg->ExecFrame();
diff --git a/Stars45/DetailSet.cpp b/Stars45/DetailSet.cpp
index 5d8c2c6..c0e79ec 100644
--- a/Stars45/DetailSet.cpp
+++ b/Stars45/DetailSet.cpp
@@ -14,8 +14,7 @@
#include "MemDebug.h"
#include "DetailSet.h"
#include "Random.h"
-
-#include "Game.h"
+#include "Video.h"
// +--------------------------------------------------------------------+
@@ -162,7 +161,7 @@ DetailSet::GetDetailLevel()
index = 0;
if (rgn == ref_rgn) {
- double screen_width = Game::GetInstance()->GetScreenWidth();
+ double screen_width = Video::GetInstance()->Width();
Point delta = loc - ref_loc;
double distance = delta.length();
diff --git a/Stars45/Game.cpp b/Stars45/Game.cpp
index 322c068..7d88bf8 100644
--- a/Stars45/Game.cpp
+++ b/Stars45/Game.cpp
@@ -559,38 +559,6 @@ Game::GetInstance()
return game;
}
-Color
-Game::GetScreenColor()
-{
- return screen_color;
-}
-
-void
-Game::SetScreenColor(Color c)
-{
- screen_color = c;
- if (screen)
- screen->SetBackgroundColor(c);
-}
-
-int
-Game::GetScreenWidth()
-{
- if (video)
- return video->Width();
-
- return 0;
-}
-
-int
-Game::GetScreenHeight()
-{
- if (video)
- return video->Height();
-
- return 0;
-}
-
// +--------------------------------------------------------------------+
void
diff --git a/Stars45/Game.h b/Stars45/Game.h
index daf3fc5..f0bf968 100644
--- a/Stars45/Game.h
+++ b/Stars45/Game.h
@@ -74,11 +74,6 @@ public:
void SetMaxFrameLength(double seconds) { max_frame_length = seconds; }
double GetMaxFrameLength() { return max_frame_length; }
- Color GetScreenColor();
- void SetScreenColor(Color c);
- int GetScreenWidth();
- int GetScreenHeight();
-
bool Active() { return active; }
bool Paused() { return paused; }
bool Server() { return server; }
@@ -142,7 +137,6 @@ protected:
int status;
int exit_code;
- Color screen_color;
bool active;
bool paused;
diff --git a/Stars45/GameWinDX9.cpp b/Stars45/GameWinDX9.cpp
index 65cf2a0..d670351 100644
--- a/Stars45/GameWinDX9.cpp
+++ b/Stars45/GameWinDX9.cpp
@@ -9,6 +9,7 @@
#include <stdio.h>
#include <string.h>
+#include "Color.h"
#include "DataLoader.h"
#include "Game.h"
#include "MachineInfo.h"
@@ -28,7 +29,8 @@ GameWinDX9::GetInstance()
GameWinDX9::GameWinDX9() :
- max_tex_size {2048}
+ max_tex_size {2048},
+ screen_color {Color::Black}
{
if (instance != nullptr)
Panic::Panic("Multiple instances of GameWinDX9");
@@ -307,9 +309,43 @@ GameWinDX9::MaxTexAspect() const
}
+Color
+GameWinDX9::GetScreenColor() const
+{
+ return screen_color;
+}
+
+
+int
+GameWinDX9::GetScreenWidth() const
+{
+ if (video)
+ return video->Width();
+ return 0;
+}
+
+
+int
+GameWinDX9::GetScreenHeight() const
+{
+ if (video)
+ return video->Height();
+ return 0;
+}
+
+
void
GameWinDX9::SetMaxTexSize(int n)
{
if (n >= 64 && n <= 4096)
max_tex_size = n;
}
+
+
+void
+GameWinDX9::SetScreenColor(Color c)
+{
+ screen_color = c;
+ if (screen)
+ screen->SetBackgroundColor(c);
+}
diff --git a/Stars45/GameWinDX9.h b/Stars45/GameWinDX9.h
index 002983a..50484ff 100644
--- a/Stars45/GameWinDX9.h
+++ b/Stars45/GameWinDX9.h
@@ -7,6 +7,7 @@
#ifndef GameWinDX9_h
#define GameWinDX9_h
+#include "Color.h"
#include "Game.h"
#include "Types.h"
@@ -29,14 +30,20 @@ public:
int MaxTexSize() const;
int MaxTexAspect() const;
+ Color GetScreenColor() const;
+ int GetScreenWidth() const;
+ int GetScreenHeight() const;
void SetMaxTexSize(int n);
+ void SetScreenColor(Color c);
+
protected:
PALETTEENTRY standard_palette[256];
BYTE inverse_palette[32768];
int max_tex_size;
+ Color screen_color;
private:
static GameWinDX9* instance;
diff --git a/Stars45/LoadScreen.cpp b/Stars45/LoadScreen.cpp
index e541a36..2741178 100644
--- a/Stars45/LoadScreen.cpp
+++ b/Stars45/LoadScreen.cpp
@@ -13,7 +13,7 @@
#include "CmpLoadDlg.h"
#include "Starshatter.h"
-#include "Game.h"
+#include "GameWinDX9.h"
#include "Video.h"
#include "Screen.h"
#include "FormDef.h"
@@ -86,7 +86,7 @@ LoadScreen::TearDown()
void
LoadScreen::ExecFrame()
{
- Game::GetInstance()->SetScreenColor(Color::Black);
+ GameWinDX9::GetInstance()->SetScreenColor(Color::Black);
if (load_dlg && load_dlg->IsShown())
load_dlg->ExecFrame();
diff --git a/Stars45/MenuScreen.cpp b/Stars45/MenuScreen.cpp
index 9c53699..6b8e89a 100644
--- a/Stars45/MenuScreen.cpp
+++ b/Stars45/MenuScreen.cpp
@@ -48,7 +48,7 @@
#include "NetClientConfig.h"
#include "NetServerConfig.h"
-#include "Game.h"
+#include "GameWinDX9.h"
#include "Video.h"
#include "Screen.h"
#include "ActiveWindow.h"
@@ -331,7 +331,7 @@ MenuScreen::TearDown()
void
MenuScreen::ExecFrame()
{
- Game::GetInstance()->SetScreenColor(Color::Black);
+ GameWinDX9::GetInstance()->SetScreenColor(Color::Black);
if (menudlg && menudlg->IsShown())
menudlg->ExecFrame();
diff --git a/Stars45/PlanScreen.cpp b/Stars45/PlanScreen.cpp
index c8aecea..f613877 100644
--- a/Stars45/PlanScreen.cpp
+++ b/Stars45/PlanScreen.cpp
@@ -22,7 +22,7 @@
#include "Starshatter.h"
#include "StarSystem.h"
-#include "Game.h"
+#include "GameWinDX9.h"
#include "Video.h"
#include "Screen.h"
#include "ActiveWindow.h"
@@ -126,7 +126,7 @@ PlanScreen::TearDown()
void
PlanScreen::ExecFrame()
{
- Game::GetInstance()->SetScreenColor(Color::Black);
+ GameWinDX9::GetInstance()->SetScreenColor(Color::Black);
Mission* mission = 0;
Campaign* campaign = Campaign::GetCampaign();
diff --git a/Stars45/StarSystem.cpp b/Stars45/StarSystem.cpp
index a321afd..8bf1348 100644
--- a/Stars45/StarSystem.cpp
+++ b/Stars45/StarSystem.cpp
@@ -1409,7 +1409,7 @@ StarSystem::ExecFrame()
if (terrain) {
trgn = (TerrainRegion*) active_region;
Color tmp = trgn->SkyColor();
- Game::GetInstance()->SetScreenColor(tmp);
+ GameWinDX9::GetInstance()->SetScreenColor(tmp);
tvpn = (active_region->Location() - active_region->Primary()->Location());
tvpn.Normalize();
@@ -1457,7 +1457,7 @@ StarSystem::ExecFrame()
}
else {
- Game::GetInstance()->SetScreenColor(Color::Black);
+ GameWinDX9::GetInstance()->SetScreenColor(Color::Black);
}
double star_alt = 0;
diff --git a/Stars45/Starshatter.cpp b/Stars45/Starshatter.cpp
index 0e0f696..8edde69 100644
--- a/Stars45/Starshatter.cpp
+++ b/Stars45/Starshatter.cpp
@@ -485,26 +485,6 @@ Starshatter::RequestChangeVideo()
req_change_video = true;
}
-int
-Starshatter::GetScreenWidth()
-{
- if (video_settings)
- return video_settings->GetWidth();
-
- return 0;
-}
-
-// +--------------------------------------------------------------------+
-
-int
-Starshatter::GetScreenHeight()
-{
- if (video_settings)
- return video_settings->GetHeight();
-
- return 0;
-}
-
// +--------------------------------------------------------------------+
void
diff --git a/Stars45/Starshatter.h b/Stars45/Starshatter.h
index 6bb9f04..f18967d 100644
--- a/Stars45/Starshatter.h
+++ b/Stars45/Starshatter.h
@@ -94,9 +94,6 @@ public:
static Starshatter* GetInstance() { return instance; }
- int GetScreenWidth();
- int GetScreenHeight();
-
// graphic options:
int LensFlare() { return lens_flare; }
int Corona() { return corona; }