OpenBarnyard
 
Loading...
Searching...
No Matches
TInputDXInterface Class Reference

#include <TInputInterface_Win.h>

Inheritance diagram for TInputDXInterface:
TInputInterface TObject TSingleton< TInputInterface >

Public Member Functions

 TDECLARE_CLASS (TInputDXInterface, TInputInterface)
 
 TInputDXInterface ()
 
virtual ~TInputDXInterface () override
 
virtual TBOOL Initialise () override
 
virtual TBOOL Deinitialise () override
 
virtual void SetExclusiveMode (TBOOL a_bIsExclusive) override
 
virtual void RefreshDirect ()
 
TBOOL LostDevice ()
 
HWND GetMainWindow () const
 
void SetMainWindow (HWND a_hMainWindow)
 
- Public Member Functions inherited from TInputInterface
 TDECLARE_CLASS (TInputInterface, TObject)
 
 TInputInterface ()
 
 ~TInputInterface ()
 
virtual TBOOL AcquireAll ()
 
virtual TBOOL UnacquireAll ()
 
virtual TBOOL FlushAll ()
 
virtual TBOOL GetExclusiveMode () const
 
virtual TINT ProcessEvents (TFLOAT a_fDeltaTime)
 
virtual void StopAllRepeats ()
 
void AddDevice (TInputDevice *device)
 
void RemoveDevice (TInputDevice *device)
 
void ReleaseAllDevices ()
 
TInputDeviceGetDeviceByIndex (TClass *a_pClass, TUINT a_uiIndex)
 
EventEmitterGetInputEventEmitter ()
 
template<class C>
C * GetDeviceByIndex (TUINT a_uiIndex=0)
 
- Public Member Functions inherited from TObject
virtual Toshi::TClass * GetClass ()
 
virtual void Delete ()
 
virtual ~TObject ()
 
TBOOL IsExactly (TClass *a_pClass)
 
TBOOL IsA (TClass *a_pClass)
 
- Public Member Functions inherited from TSingleton< TInputInterface >
 TSingleton (const TSingleton &)=delete
 
 TSingleton (const TSingleton &&)=delete
 
TSingletonoperator= (const TSingleton &)=delete
 
TSingletonoperator= (const TSingleton &&)=delete
 

Additional Inherited Members

- Public Types inherited from TInputInterface
enum  EVENT_TYPE {
  EVENT_TYPE_GONE_DOWN , EVENT_TYPE_GONE_UP , EVENT_TYPE_REPEAT , EVENT_TYPE_VIRTUAL ,
  EVENT_TYPE_MOVED
}
 
using EventEmitter = TEmitter<TInputInterface, TInputInterface::InputEvent>
 
- Public Types inherited from TObject
enum  { IsTObject = TTRUE }
 
- Static Public Member Functions inherited from TObject
static Toshi::TObject * CreateTObject ()
 
static Toshi::TObject * CreateTObjectInPlace (void *a_pPtr)
 
static void InitialiseClass ()
 
static void DeinitialiseClass ()
 
static TFORCEINLINE TClassGetClassStatic ()
 
- Static Public Member Functions inherited from TSingleton< TInputInterface >
static TFORCEINLINE TInputInterfaceCreateSingleton (Args &&... args)
 
static TFORCEINLINE D * CreateSingleton (Args &&... args)
 
static TFORCEINLINE void DestroySingleton ()
 
static TFORCEINLINE TInputInterfaceGetSingletonSafe ()
 
static TFORCEINLINE TBOOL IsSingletonCreated ()
 
static TFORCEINLINE TInputInterfaceGetSingleton ()
 
- Static Public Attributes inherited from TObject
static constexpr Toshi::TClass * PARENTCLASS = TNULL
 
static constinit Toshi::TClass ms_oClass = Toshi::TClass( "TObject", TObject::CreateTObject, TObject::CreateTObjectInPlace, TObject::InitialiseClass, TObject::DeinitialiseClass, 0, 2, sizeof( TObject ), alignof( TObject ) )
 
- Protected Member Functions inherited from TSingleton< TInputInterface >
TFORCEINLINE TSingleton ()
 
TFORCEINLINE ~TSingleton ()
 
- Static Protected Attributes inherited from TSingleton< TInputInterface >
static TInputInterfacems_pSingleton
 

Detailed Description

Definition at line 7 of file TInputInterface_Win.h.

Constructor & Destructor Documentation

◆ TInputDXInterface()

TInputDXInterface::TInputDXInterface ( )
inline

Definition at line 13 of file TInputInterface_Win.h.

14 {
15 m_poDirectInput8 = NULL;
16 m_hMainWindow = NULL;
17 m_bExclusive = TTRUE;
18 }
#define TTRUE
Definition Typedefs.h:25

◆ ~TInputDXInterface()

virtual TInputDXInterface::~TInputDXInterface ( )
inlineoverridevirtual

Definition at line 20 of file TInputInterface_Win.h.

21 {
23
24 if ( m_poDirectInput8 )
25 {
26 m_poDirectInput8->Release();
27 m_poDirectInput8 = TNULL;
28 }
29 }
#define TNULL
Definition Typedefs.h:23

Member Function Documentation

◆ Deinitialise()

TBOOL TInputDXInterface::Deinitialise ( )
overridevirtual

Implements TInputInterface.

Definition at line 45 of file TInputInterface_Win.cpp.

46{
48
49 if ( m_poDirectInput8 != NULL )
50 {
51 m_poDirectInput8->Release();
52 m_poDirectInput8 = NULL;
53 }
54
55 return TTRUE;
56}

◆ GetMainWindow()

HWND TInputDXInterface::GetMainWindow ( ) const
inline

Definition at line 38 of file TInputInterface_Win.h.

39 {
40 return m_hMainWindow;
41 }

◆ Initialise()

TBOOL TInputDXInterface::Initialise ( )
overridevirtual

Implements TInputInterface.

Definition at line 18 of file TInputInterface_Win.cpp.

19{
20 TASSERT( TNULL == m_poDirectInput8 );
21 HRESULT hRes = DirectInput8Create( GetModuleHandle( NULL ), DIRECTINPUT_VERSION, IID_IDirectInput8, (LPVOID*)&m_poDirectInput8, NULL );
22
23 if ( SUCCEEDED( hRes ) )
24 {
25 if ( m_hMainWindow == NULL )
26 {
27 m_hMainWindow = FindWindowA( "TRenderD3DInterface", NULL );
28 }
29
30 hRes = m_poDirectInput8->EnumDevices( DI8DEVCLASS_ALL, TInputDXInterface::EnumerateDeviceCallback, this, DIEDFL_ATTACHEDONLY );
31
32 if ( hRes == DI_OK )
33 {
34 return TTRUE;
35 }
36 else
37 {
39 }
40 }
41
42 return TFALSE;
43}
#define DIRECTINPUT_VERSION
Definition Includes.h:1
#define TASSERT(X,...)
Definition Defines.h:138
#define TFALSE
Definition Typedefs.h:24
virtual TBOOL Deinitialise() override

◆ LostDevice()

TBOOL TInputDXInterface::LostDevice ( )

Definition at line 67 of file TInputInterface_Win.cpp.

68{
69 auto input = GetDirectInput();
70
71 if ( input != NULL )
72 {
73 return input->EnumDevices( DI8DEVCLASS_ALL, EnumerateDeviceCallback, this, DIEDFL_ATTACHEDONLY ) != DI_OK;
74 }
75
76 return TFALSE;
77}

◆ RefreshDirect()

virtual void TInputDXInterface::RefreshDirect ( )
inlinevirtual

Definition at line 34 of file TInputInterface_Win.h.

34{}

◆ SetExclusiveMode()

void TInputDXInterface::SetExclusiveMode ( TBOOL a_bIsExclusive)
overridevirtual

Reimplemented from TInputInterface.

Definition at line 58 of file TInputInterface_Win.cpp.

59{
61 pMouse->Unacquire();
62 pMouse->SetExclusive( m_hMainWindow, a_bIsExclusive );
63 pMouse->Acquire();
64 TInputInterface::SetExclusiveMode( a_bIsExclusive );
65}
TInputDevice * GetDeviceByIndex(TClass *a_pClass, TUINT a_uiIndex)
virtual void SetExclusiveMode(TBOOL a_bIsExclusive)

◆ SetMainWindow()

void TInputDXInterface::SetMainWindow ( HWND a_hMainWindow)
inline

Definition at line 43 of file TInputInterface_Win.h.

44 {
45 m_hMainWindow = a_hMainWindow;
46 }

◆ TDECLARE_CLASS()

TInputDXInterface::TDECLARE_CLASS ( TInputDXInterface ,
TInputInterface  )

The documentation for this class was generated from the following files: