22 auto pInputInterfaceClass =
TClass::Find(
"TInputDXInterface" );
23 auto pInputInterface = pInputInterfaceClass->CreateObject();
26 m_pMouseDevice =
TNULL;
27 m_pKeyboardDevice =
TNULL;
28 m_pMainController =
TNULL;
31 m_bHadInputLastFrame =
TFALSE;
49 m_InputListener.Connect(
53 return a_pInputHandler->ProcessInputEvent( a_pInputInterface, a_pEvent );
64 m_bHadInputLastFrame =
TFALSE;
65 m_fDeltaTime = a_fDeltaTime;
72TBOOL AInputHandler::ProcessInputEvent( Toshi::TInputInterface* a_pInputInterface, Toshi::TInputInterface::InputEvent* a_pEvent )
79 auto pInputSource = a_pEvent->GetSource();
81 if ( pInputSource != m_pMouseDevice && pInputSource != m_pKeyboardDevice )
83 if ( m_Devices.Find( pInputSource ) == m_Devices.End() )
89 if ( m_pMainController ==
TNULL )
91 if ( pInputSource->GetClass()->IsA( &
TGetClass( TInputDeviceController ) ) )
93 if ( a_pEvent->GetEventType() == Toshi::TInputInterface::EVENT_TYPE_GONE_DOWN &&
94 pInputSource == m_Devices[ 0 ] )
96 m_pMainController =
TSTATICCAST( TInputDeviceController, pInputSource );
101 if ( !AGameStateController::GetSingleton()->ProcessInput( a_pEvent ) )
103 TFIXME(
"Do some check with AControlComponentManager" );
104 if ( !ARootTask::GetSingleton()->IsGameSystemCreated() &&
TTRUE )
106 if ( pInputSource->GetClass()->IsA( &
TGetClass( TInputDeviceMouse ) ) )
108 m_bHadInputLastFrame =
TTRUE;
115 m_bHadInputLastFrame =
TTRUE;
Input system interface for the Toshi engine.
#define TSTATICCAST(POINTERTYPE, VALUE)
#define TOSHI_NAMESPACE_USING
#define TDEFINE_CLASS(...)
TInputDevice * GetDeviceByIndex(TClass *a_pClass, TUINT a_uiIndex)
virtual TBOOL Initialise()=0
virtual TINT ProcessEvents(TFLOAT a_fDeltaTime)
virtual TBOOL AcquireAll()
static TClass * Find(const TCHAR *name, TClass *parent=TNULL)
static TFORCEINLINE void DestroySingleton()
static TFORCEINLINE TInputInterface * GetSingleton()
virtual TBOOL OnUpdate(TFLOAT a_fDeltaTime) override
virtual TBOOL OnCreate() override