mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 07:35:48 +08:00
refs #453 Refactor CInputManger and low level input handlers
This commit is contained in:
committed by
Mathew Sutcliffe
parent
63c7c6be0d
commit
199a1e5fcb
@@ -21,27 +21,23 @@
|
||||
|
||||
namespace BlackInput
|
||||
{
|
||||
IJoystick *IJoystick::m_instance = nullptr;
|
||||
|
||||
IJoystick::IJoystick(QObject *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
IJoystick *IJoystick::getInstance()
|
||||
std::unique_ptr<IJoystick> IJoystick::create(QObject *parent)
|
||||
{
|
||||
if (!m_instance)
|
||||
{
|
||||
#if defined(Q_OS_WIN)
|
||||
m_instance = new CJoystickWindows;
|
||||
std::unique_ptr<IJoystick> ptr(new CJoystickWindows(parent));
|
||||
#elif defined(Q_OS_LINUX)
|
||||
m_instance = new CJoystickLinux;
|
||||
std::unique_ptr<IJoystick> ptr(new CJoystickLinux(parent));
|
||||
#elif defined(Q_OS_OSX)
|
||||
m_instance = new CJoystickMac;
|
||||
std::unique_ptr<IJoystick> ptr(new CJoystickMac(parent));
|
||||
#endif
|
||||
Q_ASSERT_X(m_instance, "IJoystick::getInstance", "Pointer to IJoystick is nullptr!");
|
||||
}
|
||||
return m_instance;
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
} // BlackInput
|
||||
|
||||
Reference in New Issue
Block a user