Cogs.Core
|
Classes | |
struct | PointerState |
Public Member Functions | |
void | update () |
void | setDisplayScale (float scale) |
void | pointerDown (PointerType pointerType, PointerId pointerId, MouseButton button, glm::ivec2 position, double timestamp_ms) |
void | pointerUp (PointerType pointerType, PointerId pointerId, MouseButton button, glm::ivec2 position, double timestamp_ms) |
void | pointerMove (PointerType pointerType, PointerId pointerId, glm::ivec2 position, double timestamp_ms) |
void | mouseWheelMove (int32_t delta) |
void | reset () |
PointerType | getPointerType () |
Get the type of pointer that was last registered. | |
const std::vector< Gesture > & | getGestures () const |
Return all gestures recognised in the previous frame. Use id to differentiate between gestures. | |
Public Attributes | |
bool | hoverEnable = true |
Allow/disallow hover gesture. | |
bool | wheelEnable = true |
Allow/disallow mouse wheel gesture. | |
bool | tapEnable = true |
Allow/disallow tap gesture. | |
bool | doubleTapEnable = true |
Allow/disallow double tap gesture. | |
bool | pressEnable = true |
Allow/disallow press gesture. | |
bool | dragEnable = true |
Allow/disallow drag gesture. | |
bool | swipeEnable = true |
Allow/disallow swipe gesture. | |
bool | panEnable = true |
Allow/disallow pan gesture. | |
bool | rotateEnable = true |
Allow/disallow rotate gesture. | |
bool | pinchEnable = true |
Allow/disallow pinch gesture. | |
uint32_t | tapMaxDuration = 250 |
Millisecond threshold between classifying a press as a press or a tap. | |
uint32_t | doubleTapTreshold = 300 |
Number of milliseconds between taps to be classified as a single double tap event. | |
uint32_t | swipeMaxDuration = 200 |
Millisecond threshold between classifying a drag as a drag or a swipe. | |
float | mouseMoveThreshold = 1.f |
Mouse pixel movement threshold before classifying move-based gestures. | |
float | touchMoveThreshold = 16.f |
Touch pixel movement threshold before classifying move-based gestures. | |
float | touchVelocityThreshold = 500.f |
Touch movement threshold between a swipe or a drag, in pixels/s. | |
float | mouseVelocityThreshold = 100.f |
Mouse movement threshold between a swipe or a drag, in pixels/s. | |
float | rotateThreshold = 0.05f |
Threshold in radians before classifying a gesture as a rotation. | |
float | pinchThreshold = 0.1f |
Threshold of relative change before classifying a gesture as a pinch. | |
Private Member Functions | |
uint32_t | nextGestureId () |
void | endUpdatingGesture (std::optional< Gesture > &gesture, Gesture::State state) |
Private Attributes | |
float | displayScale = 1.0f |
PointerType | currPointerType = PointerType::Unknown |
std::vector< Gesture > | presentedGestures |
std::vector< Gesture > | currentGestures |
double | lastTapTimestamp = 0 |
std::optional< Gesture > | currPress = std::nullopt |
std::optional< Gesture > | currDrag = std::nullopt |
std::optional< Gesture > | currPan = std::nullopt |
std::optional< Gesture > | currRotate = std::nullopt |
std::optional< Gesture > | currPinch = std::nullopt |
std::unordered_map< PointerId, PointerState > | currentPointers |
Set of currently active pointers. | |
uint32_t | idCounter = 0 |
Definition at line 126 of file Gestures.h.
Cogs::Gestures::Gestures | ( | ) |
Definition at line 13 of file Gestures.cpp.
|
private |
Definition at line 350 of file Gestures.cpp.
|
inline |
Return all gestures recognised in the previous frame. Use id to differentiate between gestures.
Definition at line 166 of file Gestures.h.
Cogs::PointerType Cogs::Gestures::getPointerType | ( | ) |
Get the type of pointer that was last registered.
Definition at line 362 of file Gestures.cpp.
void Cogs::Gestures::mouseWheelMove | ( | int32_t | delta | ) |
Definition at line 337 of file Gestures.cpp.
|
inlineprivate |
Definition at line 212 of file Gestures.h.
void Cogs::Gestures::pointerDown | ( | PointerType | pointerType, |
PointerId | pointerId, | ||
MouseButton | button, | ||
glm::ivec2 | position, | ||
double | timestamp_ms | ||
) |
Definition at line 35 of file Gestures.cpp.
void Cogs::Gestures::pointerMove | ( | PointerType | pointerType, |
PointerId | pointerId, | ||
glm::ivec2 | position, | ||
double | timestamp_ms | ||
) |
Definition at line 216 of file Gestures.cpp.
void Cogs::Gestures::pointerUp | ( | PointerType | pointerType, |
PointerId | pointerId, | ||
MouseButton | button, | ||
glm::ivec2 | position, | ||
double | timestamp_ms | ||
) |
Definition at line 115 of file Gestures.cpp.
void Cogs::Gestures::reset | ( | ) |
Definition at line 346 of file Gestures.cpp.
|
inline |
Definition at line 154 of file Gestures.h.
void Cogs::Gestures::update | ( | ) |
Definition at line 19 of file Gestures.cpp.
|
private |
Definition at line 180 of file Gestures.h.
|
private |
Definition at line 174 of file Gestures.h.
|
private |
Set of currently active pointers.
Definition at line 209 of file Gestures.h.
|
private |
Definition at line 181 of file Gestures.h.
|
private |
Definition at line 183 of file Gestures.h.
|
private |
Definition at line 171 of file Gestures.h.
|
private |
Definition at line 179 of file Gestures.h.
|
private |
Definition at line 182 of file Gestures.h.
|
private |
Definition at line 169 of file Gestures.h.
bool Cogs::Gestures::doubleTapEnable = true |
Allow/disallow double tap gesture.
Definition at line 133 of file Gestures.h.
uint32_t Cogs::Gestures::doubleTapTreshold = 300 |
Number of milliseconds between taps to be classified as a single double tap event.
Definition at line 143 of file Gestures.h.
bool Cogs::Gestures::dragEnable = true |
Allow/disallow drag gesture.
Definition at line 135 of file Gestures.h.
bool Cogs::Gestures::hoverEnable = true |
Allow/disallow hover gesture.
Definition at line 130 of file Gestures.h.
|
private |
Definition at line 211 of file Gestures.h.
|
private |
Definition at line 177 of file Gestures.h.
float Cogs::Gestures::mouseMoveThreshold = 1.f |
Mouse pixel movement threshold before classifying move-based gestures.
Definition at line 145 of file Gestures.h.
float Cogs::Gestures::mouseVelocityThreshold = 100.f |
Mouse movement threshold between a swipe or a drag, in pixels/s.
Touch duration is also a factor, see swipeMaxDuration.
Definition at line 148 of file Gestures.h.
bool Cogs::Gestures::panEnable = true |
Allow/disallow pan gesture.
Definition at line 137 of file Gestures.h.
bool Cogs::Gestures::pinchEnable = true |
Allow/disallow pinch gesture.
Definition at line 139 of file Gestures.h.
float Cogs::Gestures::pinchThreshold = 0.1f |
Threshold of relative change before classifying a gesture as a pinch.
Definition at line 150 of file Gestures.h.
|
private |
Definition at line 173 of file Gestures.h.
bool Cogs::Gestures::pressEnable = true |
Allow/disallow press gesture.
Definition at line 134 of file Gestures.h.
bool Cogs::Gestures::rotateEnable = true |
Allow/disallow rotate gesture.
Definition at line 138 of file Gestures.h.
float Cogs::Gestures::rotateThreshold = 0.05f |
Threshold in radians before classifying a gesture as a rotation.
Definition at line 149 of file Gestures.h.
bool Cogs::Gestures::swipeEnable = true |
Allow/disallow swipe gesture.
Definition at line 136 of file Gestures.h.
uint32_t Cogs::Gestures::swipeMaxDuration = 200 |
Millisecond threshold between classifying a drag as a drag or a swipe.
Pointer speed is also a factor, see mouseVelocityThreshold and touchVelocityThreshold.
Definition at line 144 of file Gestures.h.
bool Cogs::Gestures::tapEnable = true |
Allow/disallow tap gesture.
Definition at line 132 of file Gestures.h.
uint32_t Cogs::Gestures::tapMaxDuration = 250 |
Millisecond threshold between classifying a press as a press or a tap.
Definition at line 142 of file Gestures.h.
float Cogs::Gestures::touchMoveThreshold = 16.f |
Touch pixel movement threshold before classifying move-based gestures.
Definition at line 146 of file Gestures.h.
float Cogs::Gestures::touchVelocityThreshold = 500.f |
Touch movement threshold between a swipe or a drag, in pixels/s.
Touch duration is also a factor, see swipeMaxDuration.
Definition at line 147 of file Gestures.h.
bool Cogs::Gestures::wheelEnable = true |
Allow/disallow mouse wheel gesture.
Definition at line 131 of file Gestures.h.