Gainput  v1.0.0
GainputInputDeviceMouse.h
1 
2 #ifndef GAINPUTINPUTDEVICEMOUSE_H_
3 #define GAINPUTINPUTDEVICEMOUSE_H_
4 
5 namespace gainput
6 {
7 
10 {
11  MouseButton0 = 0,
12  MouseButtonLeft = MouseButton0,
13  MouseButton1,
14  MouseButtonMiddle = MouseButton1,
15  MouseButton2,
16  MouseButtonRight = MouseButton2,
17  MouseButton3,
18  MouseButtonWheelUp = MouseButton3,
19  MouseButton4,
20  MouseButtonWheelDown = MouseButton4,
21  MouseButton5,
22  MouseButton6,
23  MouseButton7,
24  MouseButton8,
25  MouseButton9,
26  MouseButton10,
27  MouseButton11,
28  MouseButton12,
29  MouseButton13,
30  MouseButton14,
31  MouseButton15,
32  MouseButton16,
33  MouseButton17,
34  MouseButton18,
35  MouseButton19,
36  MouseButton20,
37  MouseButtonMax = MouseButton20,
38  MouseButtonCount,
39  MouseAxisX = MouseButtonCount,
40  MouseAxisY,
41  MouseButtonCount_,
42  MouseAxisCount = MouseButtonCount_ - MouseAxisX
43 };
44 
45 
46 
47 class InputDeviceMouseImpl;
48 
50 
60 class GAINPUT_LIBEXPORT InputDeviceMouse : public InputDevice
61 {
62 public:
64 
70  InputDeviceMouse(InputManager& manager, DeviceId device, unsigned index, DeviceVariant variant);
73 
75  DeviceType GetType() const { return DT_MOUSE; }
76  DeviceVariant GetVariant() const;
77  const char* GetTypeName() const { return "mouse"; }
78  bool IsValidButtonId(DeviceButtonId deviceButton) const { return deviceButton < MouseButtonCount_; }
79 
80  size_t GetAnyButtonDown(DeviceButtonSpec* outButtons, size_t maxButtonCount) const;
81 
82  size_t GetButtonName(DeviceButtonId deviceButton, char* buffer, size_t bufferLength) const;
83  ButtonType GetButtonType(DeviceButtonId deviceButton) const;
84  DeviceButtonId GetButtonByName(const char* name) const;
85 
87  InputDeviceMouseImpl* GetPimpl() { return impl_; }
88 
89 protected:
90  void InternalUpdate(InputDeltaState* delta);
91  DeviceState InternalGetState() const;
92 
93 private:
94  InputDeviceMouseImpl* impl_;
95 
96 };
97 
98 }
99 
100 #endif
101 
bool IsValidButtonId(DeviceButtonId deviceButton) const
Returns if the given button is valid for this device.
Definition: GainputInputDeviceMouse.h:78
Manages all input devices and some other helpful stuff.
Definition: GainputInputManager.h:24
A mouse input device.
Definition: GainputInputDeviceMouse.h:60
ButtonType
Type of an input device button.
Definition: GainputInputDevice.h:10
Stores a list of input state changes.
Definition: GainputInputDeltaState.h:9
Describes a device button on a specific device.
Definition: gainput.h:112
const char * GetTypeName() const
Returns the device type&#39;s name.
Definition: GainputInputDeviceMouse.h:77
unsigned int DeviceId
ID of an input device.
Definition: gainput.h:107
DeviceState
State of an input device.
Definition: GainputInputDevice.h:59
DeviceVariant
Variant of an input device type.
Definition: GainputInputDevice.h:51
MouseButton
All valid device buttons for InputDeviceMouse.
Definition: GainputInputDeviceMouse.h:9
DeviceType
Type of an input device.
Definition: GainputInputDevice.h:37
InputDeviceMouseImpl * GetPimpl()
Returns the platform-specific implementation of this device (internal use only).
Definition: GainputInputDeviceMouse.h:87
Interface for anything that provides device inputs.
Definition: GainputInputDevice.h:33
DeviceType GetType() const
Returns DT_MOUSE.
Definition: GainputInputDeviceMouse.h:75
unsigned int DeviceButtonId
ID of a specific button unique to an input device.
Definition: gainput.h:109
Contains all Gainput related classes, types, and functions.
Definition: gainput.h:103