diff options
-rw-r--r-- | Stars45/GameWinDX9.cpp | 15 | ||||
-rw-r--r-- | Stars45/GameWinDX9.h | 5 |
2 files changed, 20 insertions, 0 deletions
diff --git a/Stars45/GameWinDX9.cpp b/Stars45/GameWinDX9.cpp index bf7876f..efc825a 100644 --- a/Stars45/GameWinDX9.cpp +++ b/Stars45/GameWinDX9.cpp @@ -17,13 +17,28 @@ #include "Utils.h" +GameWinDX9* GameWinDX9::instance = nullptr; + + +GameWinDX9* +GameWinDX9::GetInstance() +{ + return instance; +} + + GameWinDX9::GameWinDX9() { + if (instance != nullptr) + Panic::Panic("Multiple instances of GameWinDX9"); + instance = this; } GameWinDX9::~GameWinDX9() { + if (instance != nullptr) + instance = nullptr; } diff --git a/Stars45/GameWinDX9.h b/Stars45/GameWinDX9.h index 9151bcd..5193a77 100644 --- a/Stars45/GameWinDX9.h +++ b/Stars45/GameWinDX9.h @@ -14,6 +14,8 @@ class GameWinDX9 : public Game { public: + static GameWinDX9* GetInstance(); + GameWinDX9(); virtual ~GameWinDX9(); @@ -28,6 +30,9 @@ public: protected: PALETTEENTRY standard_palette[256]; BYTE inverse_palette[32768]; + +private: + static GameWinDX9* instance; }; |