Gainput  v1.0.0
GainputRotateGesture.h
1 
2 #ifndef GAINPUTROTATEGESTURE_H_
3 #define GAINPUTROTATEGESTURE_H_
4 
5 #ifdef GAINPUT_ENABLE_ROTATE_GESTURE
6 
7 namespace gainput
8 {
9 
12 {
15 };
16 
18 
32 class GAINPUT_LIBEXPORT RotateGesture : public InputGesture
33 {
34 public:
36  RotateGesture(InputManager& manager, DeviceId device, unsigned index, DeviceVariant variant);
38  ~RotateGesture();
39 
41 
55  void Initialize(DeviceId downDevice, DeviceButtonId downButton,
56  DeviceId xAxisDevice, DeviceButtonId xAxis,
57  DeviceId yAxisDevice, DeviceButtonId yAxis,
58  DeviceId down2Device, DeviceButtonId downButton2,
59  DeviceId xAxis2Device, DeviceButtonId xAxis2,
60  DeviceId yAxis2Device, DeviceButtonId yAxis2);
61 
62  bool IsValidButtonId(DeviceButtonId deviceButton) const { return deviceButton == RotateTriggered || deviceButton == RotateAngle; }
63 
64  ButtonType GetButtonType(DeviceButtonId deviceButton) const { GAINPUT_ASSERT(IsValidButtonId(deviceButton)); return deviceButton == RotateTriggered ? BT_BOOL : BT_FLOAT; }
65 
66 protected:
67  void InternalUpdate(InputDeltaState* delta);
68 
69 private:
70  DeviceButtonSpec downButton_;
71  DeviceButtonSpec xAxis_;
72  DeviceButtonSpec yAxis_;
73  DeviceButtonSpec downButton2_;
74  DeviceButtonSpec xAxis2_;
75  DeviceButtonSpec yAxis2_;
76 
77  bool rotating_;
78  float initialAngle_;
79 
80 };
81 
82 }
83 
84 #endif
85 
86 #endif
87 
ButtonType GetButtonType(DeviceButtonId deviceButton) const
Returns the type of the given button.
Definition: GainputRotateGesture.h:64
RotateAction
Buttons provided by the RotateGesture.
Definition: GainputRotateGesture.h:11
Manages all input devices and some other helpful stuff.
Definition: GainputInputManager.h:24
A boolean value button, either down (true) or up (false).
Definition: GainputInputDevice.h:12
ButtonType
Type of an input device button.
Definition: GainputInputDevice.h:10
bool IsValidButtonId(DeviceButtonId deviceButton) const
Returns if the given button is valid for this device.
Definition: GainputRotateGesture.h:62
Stores a list of input state changes.
Definition: GainputInputDeltaState.h:9
Describes a device button on a specific device.
Definition: gainput.h:112
unsigned int DeviceId
ID of an input device.
Definition: gainput.h:107
DeviceVariant
Variant of an input device type.
Definition: GainputInputDevice.h:51
Base class for all input gestures.
Definition: GainputGestures.h:41
A floating-point value button, between -1.0f and 1.0f or 0.0f and 1.0f.
Definition: GainputInputDevice.h:13
The button that triggers when both rotate buttons are down.
Definition: GainputRotateGesture.h:13
unsigned int DeviceButtonId
ID of a specific button unique to an input device.
Definition: gainput.h:109
A multi-touch rotate gesture.
Definition: GainputRotateGesture.h:32
The current rotation angle in radians if rotation is triggered (RotateTriggered). ...
Definition: GainputRotateGesture.h:14
Contains all Gainput related classes, types, and functions.
Definition: gainput.h:103