summaryrefslogtreecommitdiffhomepage
path: root/Stars45/GameWinDX9.cpp
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-03-14 18:37:12 +0100
committerAki <please@ignore.pl>2022-03-14 18:37:12 +0100
commit92f7c58068c6a7bfe0b32af5c1ace6bdde2f3951 (patch)
tree9f237622f6dac613823c013f0db662af7557374f /Stars45/GameWinDX9.cpp
parent01954b1d34a42fa4a51a3e0d690ba4ad5a1f8298 (diff)
downloadstarshatter-92f7c58068c6a7bfe0b32af5c1ace6bdde2f3951.zip
starshatter-92f7c58068c6a7bfe0b32af5c1ace6bdde2f3951.tar.gz
starshatter-92f7c58068c6a7bfe0b32af5c1ace6bdde2f3951.tar.bz2
Added instance retrieval method to GameWinDX9
I don't like having a singleton with inheritance. At all. It needs to be removed as soon as possible and functionalities need to be moved outside of this monolith and this is a step into that direction. I think.
Diffstat (limited to 'Stars45/GameWinDX9.cpp')
-rw-r--r--Stars45/GameWinDX9.cpp15
1 files changed, 15 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;
}