diff options
author | Brad Davis <[email protected]> | 2013-08-16 12:01:23 -0700 |
---|---|---|
committer | Brad Davis <[email protected]> | 2013-08-16 12:01:23 -0700 |
commit | e384cffd7245d1141f9ca81633ab62b07b8907f3 (patch) | |
tree | c5e4debbbe6079ff14b7862cde49bf3b916ffb62 /Samples/CommonSrc/Platform/Linux_Gamepad.h | |
parent | 20cfcf9dc9485002f05cf50d74ab45375cf0db59 (diff) | |
parent | f29e505a7df820e1376d97b41515bdc89d472499 (diff) |
Merge branch 'master' into stable
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; }; }}} |