diff options
| author | git perforce import user <a@b> | 2016-10-25 12:29:14 -0600 |
|---|---|---|
| committer | Sheikh Dawood Abdul Ajees <Sheikh Dawood Abdul Ajees> | 2016-10-25 18:56:37 -0500 |
| commit | 3dfe2108cfab31ba3ee5527e217d0d8e99a51162 (patch) | |
| tree | fa6485c169e50d7415a651bf838f5bcd0fd3bfbd /KaplaDemo/samples/sampleViewer3/SampleViewerGamepad.h | |
| download | physx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.tar.xz physx-3.4-3dfe2108cfab31ba3ee5527e217d0d8e99a51162.zip | |
Initial commit:
PhysX 3.4.0 Update @ 21294896
APEX 1.4.0 Update @ 21275617
[CL 21300167]
Diffstat (limited to 'KaplaDemo/samples/sampleViewer3/SampleViewerGamepad.h')
| -rw-r--r-- | KaplaDemo/samples/sampleViewer3/SampleViewerGamepad.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/KaplaDemo/samples/sampleViewer3/SampleViewerGamepad.h b/KaplaDemo/samples/sampleViewer3/SampleViewerGamepad.h new file mode 100644 index 00000000..4b19a13a --- /dev/null +++ b/KaplaDemo/samples/sampleViewer3/SampleViewerGamepad.h @@ -0,0 +1,69 @@ +#ifndef SAMPLE_VIEWER_GAMEPAD_H +#define SAMPLE_VIEWER_GAMEPAD_H + +#include <WTypes.h> +#include <XInput.h> + +class SampleViewerScene; + +class SampleViewerGamepad +{ +public: + enum GamepadTrigger + { + GAMEPAD_RIGHT_SHOULDER_TRIGGER = 0, + GAMEPAD_LEFT_SHOULDER_TRIGGER = 1 + }; + + enum GamepadButtons + { + GAMEPAD_DPAD_UP = 0, + GAMEPAD_DPAD_DOWN, + GAMEPAD_DPAD_LEFT, + GAMEPAD_DPAD_RIGHT, + GAMEPAD_START, + GAMEPAD_BACK, + GAMEPAD_LEFT_THUMB, + GAMEPAD_RIGHT_THUMB, + GAMEPAD_Y, + GAMEPAD_A, + GAMEPAD_X, + GAMEPAD_B, + GAMEPAD_LEFT_SHOULDER, + GAMEPAD_RIGHT_SHOULDER + }; + + enum GamepadAxis + { + GAMEPAD_RIGHT_STICK_X = 0, + GAMEPAD_RIGHT_STICK_Y, + GAMEPAD_LEFT_STICK_X, + GAMEPAD_LEFT_STICK_Y + }; + + SampleViewerGamepad(); + ~SampleViewerGamepad(); + + void init(); + void release(); + + void processGamepads(SampleViewerScene& viewerScene); + +private: + bool hasXInput() const { return mpXInputGetState && mpXInputGetCapabilities; } + +private: + + bool mGamePadConnected; + unsigned int mConnectedPad; + + typedef DWORD(WINAPI *LPXINPUTGETSTATE)(DWORD, XINPUT_STATE*); + typedef DWORD(WINAPI *LPXINPUTGETCAPABILITIES)(DWORD, DWORD, XINPUT_CAPABILITIES*); + + HMODULE mXInputLibrary; + LPXINPUTGETSTATE mpXInputGetState; + LPXINPUTGETCAPABILITIES mpXInputGetCapabilities; + +}; + +#endif // SAMPLE_VIEWER_GAMEPAD_H |