| 1 | //************************************ bs::framework - Copyright 2018 Marko Pintera **************************************// |
| 2 | //*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********// |
| 3 | #pragma once |
| 4 | |
| 5 | #include "BsCorePrerequisites.h" |
| 6 | |
| 7 | namespace bs |
| 8 | { |
| 9 | struct GamepadInfo; |
| 10 | |
| 11 | /** Represents a single hardware gamepad. Used by the Input to report gamepad input events. */ |
| 12 | class BS_CORE_EXPORT Gamepad |
| 13 | { |
| 14 | public: |
| 15 | struct Pimpl; |
| 16 | |
| 17 | Gamepad(const String& name, const GamepadInfo& gamepadInfo, Input* owner); |
| 18 | ~Gamepad(); |
| 19 | |
| 20 | /** Returns the name of the device. */ |
| 21 | String getName() const { return mName; } |
| 22 | |
| 23 | /** Captures the input since the last call and triggers the events on the parent Input. */ |
| 24 | void capture(); |
| 25 | |
| 26 | /** Minimum allowed value as reported by the axis movement events. */ |
| 27 | static constexpr int MIN_AXIS = -32768; |
| 28 | |
| 29 | /** Maximum allowed value as reported by the axis movement events. */ |
| 30 | static constexpr int MAX_AXIS = 32767; |
| 31 | private: |
| 32 | friend class Input; |
| 33 | |
| 34 | /** Changes the capture context. Should be called when focus is moved to a new window. */ |
| 35 | void changeCaptureContext(UINT64 windowHandle); |
| 36 | |
| 37 | String mName; |
| 38 | Input* mOwner; |
| 39 | |
| 40 | Pimpl* m; |
| 41 | }; |
| 42 | } |
| 43 | |