Gainput
v1.0.0
lib
include
gainput
gestures
GainputPinchGesture.h
1
2
#ifndef GAINPUTPINCHGESTURE_H_
3
#define GAINPUTPINCHGESTURE_H_
4
5
#ifdef GAINPUT_ENABLE_PINCH_GESTURE
6
7
namespace
gainput
8
{
9
11
enum
PinchAction
12
{
13
PinchTriggered
,
14
PinchScale
15
};
16
18
32
class
GAINPUT_LIBEXPORT
PinchGesture
:
public
InputGesture
33
{
34
public
:
36
PinchGesture
(
InputManager
& manager,
DeviceId
device,
unsigned
index,
DeviceVariant
variant);
38
~
PinchGesture
();
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 ==
PinchTriggered
|| deviceButton ==
PinchScale
; }
63
64
ButtonType
GetButtonType
(
DeviceButtonId
deviceButton)
const
{ GAINPUT_ASSERT(IsValidButtonId(deviceButton));
return
deviceButton ==
PinchTriggered
?
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
pinching_;
78
float
initialDistance_;
79
};
80
81
}
82
83
#endif
84
85
#endif
86
gainput::PinchScale
The current pinch scale value if pinching is active.
Definition:
GainputPinchGesture.h:14
gainput::PinchAction
PinchAction
Buttons provided by the PinchGesture.
Definition:
GainputPinchGesture.h:11
gainput::InputManager
Manages all input devices and some other helpful stuff.
Definition:
GainputInputManager.h:24
gainput::PinchGesture
A multi-touch pinch-to-scale gesture.
Definition:
GainputPinchGesture.h:32
gainput::PinchTriggered
The button that triggers when both pinch buttons are down.
Definition:
GainputPinchGesture.h:13
gainput::BT_BOOL
A boolean value button, either down (true) or up (false).
Definition:
GainputInputDevice.h:12
gainput::ButtonType
ButtonType
Type of an input device button.
Definition:
GainputInputDevice.h:10
gainput::InputDeltaState
Stores a list of input state changes.
Definition:
GainputInputDeltaState.h:9
gainput::DeviceButtonSpec
Describes a device button on a specific device.
Definition:
gainput.h:112
gainput::DeviceId
unsigned int DeviceId
ID of an input device.
Definition:
gainput.h:107
gainput::InputDevice::DeviceVariant
DeviceVariant
Variant of an input device type.
Definition:
GainputInputDevice.h:51
gainput::InputGesture
Base class for all input gestures.
Definition:
GainputGestures.h:41
gainput::BT_FLOAT
A floating-point value button, between -1.0f and 1.0f or 0.0f and 1.0f.
Definition:
GainputInputDevice.h:13
gainput::PinchGesture::GetButtonType
ButtonType GetButtonType(DeviceButtonId deviceButton) const
Returns the type of the given button.
Definition:
GainputPinchGesture.h:64
gainput::PinchGesture::IsValidButtonId
bool IsValidButtonId(DeviceButtonId deviceButton) const
Returns if the given button is valid for this device.
Definition:
GainputPinchGesture.h:62
gainput::DeviceButtonId
unsigned int DeviceButtonId
ID of a specific button unique to an input device.
Definition:
gainput.h:109
gainput
Contains all Gainput related classes, types, and functions.
Definition:
gainput.h:103
Generated on Wed Sep 6 2017 20:47:59 for Gainput by
1.8.13