CUGL 2.1
Cornell University Game Library
|
#include <CUCoreGesture.h>
Public Member Functions | |
CoreGestureEvent () | |
CoreGestureEvent (const Timestamp &start) | |
CoreGestureEvent (const CoreGestureEvent &event) | |
void | clear () |
Public Attributes | |
Timestamp | start |
Timestamp | now |
CoreGestureType | type |
Vec2 | origPosition |
Vec2 | currPosition |
float | origSpread |
float | currSpread |
float | origAngle |
float | currAngle |
This simple class is a struct to hold a core gesture event.
A core gesture is a gesture with duration. Hence this event stores information about the start of the event, as well as the current status of the event.
A core gesture contains three bits of information: the position of the fingers (computed as the average), the distance spread between the fingers, and the current angle of the line between the two fingers. All three values are continually updated regardless of the gesture type.
The gesture type is initially CoreGestureType::NONE, but transitions to one of the other types when a threshold is passed. The threshold limits are defined in CoreGesture.
The value of pan and pinch events is typically measured in pixels, as it is assumed that the touch device is also the display (e.g. most mobile devices). However, in situtations where that is not the case (e.g. MacBook trackpad), the values will be measured assuming the touch device is a unit square. In that case all pan positions are (0,0) to (1,1), while all pinch spreads are 0 to sqrt(2).
|
inline |
Constructs a new gesture event with the default values
|
inline |
Constructs a new gesture event with the given timestamps
start | The initial timestamp |
|
inline |
Constructs a new gesture event that is a copy of the given one
event | The event to copy |
|
inline |
Clears the contents of this gesture event
float cugl::CoreGestureEvent::currAngle |
The current angle of the gesture
Vec2 cugl::CoreGestureEvent::currPosition |
The current position of the gesture
float cugl::CoreGestureEvent::currSpread |
The current finger separation of the gesture
Timestamp cugl::CoreGestureEvent::now |
The current time of the gesture
float cugl::CoreGestureEvent::origAngle |
The initial angle of the gesture
Vec2 cugl::CoreGestureEvent::origPosition |
The initial position of the gesture
float cugl::CoreGestureEvent::origSpread |
The initial finger separation of the gesture
Timestamp cugl::CoreGestureEvent::start |
The starting time of the gesture
CoreGestureType cugl::CoreGestureEvent::type |
The gesture type