Gainput  v1.0.0
GainputTapGesture.h
1 
2 #ifndef GAINPUTTAPGESTURE_H_
3 #define GAINPUTTAPGESTURE_H_
4 
5 #ifdef GAINPUT_ENABLE_TAP_GESTURE
6 
7 namespace gainput
8 {
9 
12 {
14 };
15 
17 
30 class GAINPUT_LIBEXPORT TapGesture : public InputGesture
31 {
32 public:
34  TapGesture(InputManager& manager, DeviceId device, unsigned index, DeviceVariant variant);
36  ~TapGesture();
37 
39 
44  void Initialize(DeviceId actionButtonDevice, DeviceButtonId actionButton, uint64_t timeSpan = 500);
45 
46  bool IsValidButtonId(DeviceButtonId deviceButton) const { return deviceButton == TapTriggered; }
47 
48  ButtonType GetButtonType(DeviceButtonId deviceButton) const { GAINPUT_UNUSED(deviceButton); GAINPUT_ASSERT(IsValidButtonId(deviceButton)); return BT_BOOL; }
49 
50 protected:
51  void InternalUpdate(InputDeltaState* delta);
52 
53 private:
54  DeviceButtonSpec actionButton_;
55 
56  uint64_t timeSpan_;
57  uint64_t firstDownTime_;
58 
59 };
60 
61 }
62 
63 #endif
64 
65 #endif
66 
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
ButtonType GetButtonType(DeviceButtonId deviceButton) const
Returns the type of the given button.
Definition: GainputTapGesture.h:48
TapAction
Buttons provided by the TapGesture.
Definition: GainputTapGesture.h:11
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 tap-to-trigger gesture.
Definition: GainputTapGesture.h:30
bool IsValidButtonId(DeviceButtonId deviceButton) const
Returns if the given button is valid for this device.
Definition: GainputTapGesture.h:46
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
The button that is triggered by tapping.
Definition: GainputTapGesture.h:13