summaryrefslogtreecommitdiffhomepage
path: root/Stars45/Game.cpp
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-02-17 10:26:46 +0100
committerAki <please@ignore.pl>2022-02-17 10:26:46 +0100
commit2ae135bbe43065978a4659278d18d9533d8a3b27 (patch)
tree4ac25460a2d7fb9ef1a478b3da59f6ae78b6bda1 /Stars45/Game.cpp
parentf49d139c6bb975a68478eedd9763028443f47d25 (diff)
downloadstarshatter-2ae135bbe43065978a4659278d18d9533d8a3b27.zip
starshatter-2ae135bbe43065978a4659278d18d9533d8a3b27.tar.gz
starshatter-2ae135bbe43065978a4659278d18d9533d8a3b27.tar.bz2
Everything but panic and singleton impl is now instance based
Diffstat (limited to 'Stars45/Game.cpp')
-rw-r--r--Stars45/Game.cpp39
1 files changed, 16 insertions, 23 deletions
diff --git a/Stars45/Game.cpp b/Stars45/Game.cpp
index d0a5735..c1c4463 100644
--- a/Stars45/Game.cpp
+++ b/Stars45/Game.cpp
@@ -744,15 +744,13 @@ Game::InitContent()
void
Game::UseLocale(Locale* locale)
{
- if (game) {
- DataLoader* loader = DataLoader::GetLoader();
- loader->SetDataPath("Content/");
- delete game->content;
+ DataLoader* loader = DataLoader::GetLoader();
+ loader->SetDataPath("Content/");
+ delete content;
- game->content = new(__FILE__,__LINE__) ContentBundle("content", locale);
+ content = new(__FILE__,__LINE__) ContentBundle("content", locale);
- loader->SetDataPath(0);
- }
+ loader->SetDataPath(0);
}
// +--------------------------------------------------------------------+
@@ -1012,28 +1010,22 @@ Game::GetVideo()
Color
Game::GetScreenColor()
{
- if (game)
- return game->screen_color;
-
- return Color::Black;
+ return screen_color;
}
void
Game::SetScreenColor(Color c)
{
- if (game) {
- game->screen_color = c;
-
- if (game->screen)
- game->screen->SetBackgroundColor(c);
- }
+ screen_color = c;
+ if (screen)
+ screen->SetBackgroundColor(c);
}
int
Game::GetScreenWidth()
{
- if (game && game->video)
- return game->video->Width();
+ if (video)
+ return video->Width();
return 0;
}
@@ -1041,8 +1033,8 @@ Game::GetScreenWidth()
int
Game::GetScreenHeight()
{
- if (game && game->video)
- return game->video->Height();
+ if (video)
+ return video->Height();
return 0;
}
@@ -1141,7 +1133,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM uParam, LPARAM lParam)
break;
case WM_SETCURSOR:
- if (Game::ShowMouse()) {
+ if (game && game->ShowMouse()) {
return DefWindowProc(hwnd, message, uParam, lParam);
}
else {
@@ -1366,8 +1358,9 @@ GetKeyPlus(int& key, int& shift)
DWORD GetRealTime()
{
+ Game* game = Game::GetInstance();
if (game)
- return Game::RealTime();
+ return game->RealTime();
return timeGetTime();
}