|
Cogs.Core
|
Classes | |
| struct | PointerState |
Public Member Functions | |
| void | update () |
| void | setDisplayScale (float scale) |
| void | pointerDown (PointerType pointerType, PointerId pointerId, MouseButton button, glm::vec2 position, double timestamp_ms) |
| void | pointerUp (PointerType pointerType, PointerId pointerId, MouseButton button, glm::vec2 position, double timestamp_ms) |
| void | pointerMove (PointerType pointerType, PointerId pointerId, glm::vec2 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 125 of file Gestures.h.
| Cogs::Gestures::Gestures | ( | ) |
Definition at line 13 of file Gestures.cpp.
|
private |
Definition at line 348 of file Gestures.cpp.
|
inline |
Return all gestures recognised in the previous frame. Use id to differentiate between gestures.
Definition at line 165 of file Gestures.h.
| Cogs::PointerType Cogs::Gestures::getPointerType | ( | ) |
Get the type of pointer that was last registered.
Definition at line 360 of file Gestures.cpp.
| void Cogs::Gestures::mouseWheelMove | ( | int32_t | delta | ) |
Definition at line 335 of file Gestures.cpp.
|
inlineprivate |
Definition at line 211 of file Gestures.h.
| void Cogs::Gestures::pointerDown | ( | PointerType | pointerType, |
| PointerId | pointerId, | ||
| MouseButton | button, | ||
| glm::vec2 | position, | ||
| double | timestamp_ms | ||
| ) |
Definition at line 35 of file Gestures.cpp.
| void Cogs::Gestures::pointerMove | ( | PointerType | pointerType, |
| PointerId | pointerId, | ||
| glm::vec2 | position, | ||
| double | timestamp_ms | ||
| ) |
Definition at line 214 of file Gestures.cpp.
| void Cogs::Gestures::pointerUp | ( | PointerType | pointerType, |
| PointerId | pointerId, | ||
| MouseButton | button, | ||
| glm::vec2 | position, | ||
| double | timestamp_ms | ||
| ) |
Definition at line 113 of file Gestures.cpp.
| void Cogs::Gestures::reset | ( | ) |
Definition at line 344 of file Gestures.cpp.
|
inline |
Definition at line 153 of file Gestures.h.
| void Cogs::Gestures::update | ( | ) |
Definition at line 19 of file Gestures.cpp.
|
private |
Definition at line 179 of file Gestures.h.
|
private |
Definition at line 173 of file Gestures.h.
|
private |
Set of currently active pointers.
Definition at line 208 of file Gestures.h.
|
private |
Definition at line 180 of file Gestures.h.
|
private |
Definition at line 182 of file Gestures.h.
|
private |
Definition at line 170 of file Gestures.h.
|
private |
Definition at line 178 of file Gestures.h.
|
private |
Definition at line 181 of file Gestures.h.
|
private |
Definition at line 168 of file Gestures.h.
| bool Cogs::Gestures::doubleTapEnable = true |
Allow/disallow double tap gesture.
Definition at line 132 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 142 of file Gestures.h.
| bool Cogs::Gestures::dragEnable = true |
Allow/disallow drag gesture.
Definition at line 134 of file Gestures.h.
| bool Cogs::Gestures::hoverEnable = true |
Allow/disallow hover gesture.
Definition at line 129 of file Gestures.h.
|
private |
Definition at line 210 of file Gestures.h.
|
private |
Definition at line 176 of file Gestures.h.
| float Cogs::Gestures::mouseMoveThreshold = 1.f |
Mouse pixel movement threshold before classifying move-based gestures.
Definition at line 144 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 147 of file Gestures.h.
| bool Cogs::Gestures::panEnable = true |
Allow/disallow pan gesture.
Definition at line 136 of file Gestures.h.
| bool Cogs::Gestures::pinchEnable = true |
Allow/disallow pinch gesture.
Definition at line 138 of file Gestures.h.
| float Cogs::Gestures::pinchThreshold = 0.1f |
Threshold of relative change before classifying a gesture as a pinch.
Definition at line 149 of file Gestures.h.
|
private |
Definition at line 172 of file Gestures.h.
| bool Cogs::Gestures::pressEnable = true |
Allow/disallow press gesture.
Definition at line 133 of file Gestures.h.
| bool Cogs::Gestures::rotateEnable = true |
Allow/disallow rotate gesture.
Definition at line 137 of file Gestures.h.
| float Cogs::Gestures::rotateThreshold = 0.05f |
Threshold in radians before classifying a gesture as a rotation.
Definition at line 148 of file Gestures.h.
| bool Cogs::Gestures::swipeEnable = true |
Allow/disallow swipe gesture.
Definition at line 135 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 143 of file Gestures.h.
| bool Cogs::Gestures::tapEnable = true |
Allow/disallow tap gesture.
Definition at line 131 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 141 of file Gestures.h.
| float Cogs::Gestures::touchMoveThreshold = 16.f |
Touch pixel movement threshold before classifying move-based gestures.
Definition at line 145 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 146 of file Gestures.h.
| bool Cogs::Gestures::wheelEnable = true |
Allow/disallow mouse wheel gesture.
Definition at line 130 of file Gestures.h.