diff options
author | Brad Davis <[email protected]> | 2013-08-16 10:21:36 -0700 |
---|---|---|
committer | Brad Davis <[email protected]> | 2013-08-16 10:21:50 -0700 |
commit | f29e505a7df820e1376d97b41515bdc89d472499 (patch) | |
tree | 74c17222d3ab8790c2f004334c8ad5425ecc45e7 /Samples/CommonSrc/Platform/Linux_Gamepad.h | |
parent | da29f23ae3e9b7d8d168fda5d131c11121675b1c (diff) |
Official SDK version 0.24
Diffstat (limited to 'Samples/CommonSrc/Platform/Linux_Gamepad.h')
-rw-r--r-- | Samples/CommonSrc/Platform/Linux_Gamepad.h | 48 |
1 files changed, 40 insertions, 8 deletions
diff --git a/Samples/CommonSrc/Platform/Linux_Gamepad.h b/Samples/CommonSrc/Platform/Linux_Gamepad.h index 9e6413d..ba66e70 100644 --- a/Samples/CommonSrc/Platform/Linux_Gamepad.h +++ b/Samples/CommonSrc/Platform/Linux_Gamepad.h @@ -3,7 +3,7 @@ Filename : Linux_Gamepad.h Content : Linux implementation of Gamepad functionality. Created : May 6, 2013 -Authors : Lee Cooper +Authors : Lee Cooper, Simon Hallam Copyright : Copyright 2013 Oculus VR, Inc. All Rights reserved. @@ -28,22 +28,54 @@ limitations under the License. namespace OVR { namespace Platform { namespace Linux { +class Gamepad; // forward declaration for readability + class GamepadManager : public Platform::GamepadManager { public: + GamepadManager(); ~GamepadManager(); - virtual UInt32 GetGamepadCount(); - virtual bool GetGamepadState(UInt32 index, GamepadState* pState); + virtual UInt32 GetGamepadCount(); + virtual bool GetGamepadState(UInt32 index, GamepadState *pState); private: - // Dynamically ink to XInput to simplify projects. - //HMODULE hXInputModule; - //typedef DWORD (WINAPI *PFn_XInputGetState)(DWORD dwUserIndex, XINPUT_STATE* pState); - //PFn_XInputGetState pXInputGetState; - //UInt32 LastPadPacketNo; + Gamepad *pDevice; +}; + +class Gamepad +{ +public: + + Gamepad(); + virtual ~Gamepad(); + + bool Open(const String& devicePathName); + bool Close(); + bool IsSupportedType(); + const String& GetIdentifier(); + void UpdateState(); + const GamepadState* GetState(); + +private: + + void SetStateAxis(GamepadState *pState, UInt32 axis, SInt32 value); + void SetStateButton(GamepadState *pState, UInt32 button, SInt32 value); + + enum GamepadType + { + UNDEFINED, + XBOX360GAMEPADWIRELESS, + XBOX360GAMEPADWIRED + }; + + UInt32 FileDescriptor; + bool IsInitialized; + String Name; + GamepadType Type; + GamepadState State; }; }}} |