BGE bug [#4839] fixed: joystick keeps working after an overlay scene is removed

This commit is contained in:
Benoit Bolsee
2008-04-04 20:39:31 +00:00
parent b46ef6ecb3
commit 1bdc909555
3 changed files with 43 additions and 11 deletions

View File

@@ -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()
{