Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp')
-rw-r--r--source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
index 071301514fb..79da15721f3 100644
--- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
+++ b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
@@ -55,6 +55,34 @@ SCA_Joystick::~SCA_Joystick()
delete m_private;
}
+SCA_Joystick *SCA_Joystick::m_instance = NULL;
+int SCA_Joystick::m_refCount = 0;
+
+SCA_Joystick *SCA_Joystick::GetInstance()
+{
+ if (m_instance == 0)
+ {
+ m_instance = new SCA_Joystick();
+ m_instance->CreateJoystickDevice();
+ m_refCount = 1;
+ }
+ else
+ {
+ m_refCount++;
+ }
+ return m_instance;
+}
+
+void SCA_Joystick::ReleaseInstance()
+{
+ if (--m_refCount == 0)
+ {
+ DestroyJoystickDevice();
+ delete m_instance;
+ m_instance = NULL;
+ }
+}
+
bool SCA_Joystick::CreateJoystickDevice()
{