summaryrefslogtreecommitdiff
path: root/libs/raylib/src/gestures.h
diff options
context:
space:
mode:
Diffstat (limited to 'libs/raylib/src/gestures.h')
-rw-r--r--libs/raylib/src/gestures.h30
1 files changed, 15 insertions, 15 deletions
diff --git a/libs/raylib/src/gestures.h b/libs/raylib/src/gestures.h
index 9b3600d..ece65b3 100644
--- a/libs/raylib/src/gestures.h
+++ b/libs/raylib/src/gestures.h
@@ -24,7 +24,7 @@
*
* LICENSE: zlib/libpng
*
-* Copyright (c) 2014-2020 Ramon Santamaria (@raysan5)
+* Copyright (c) 2014-2021 Ramon Santamaria (@raysan5)
*
* This software is provided "as-is", without any express or implied warranty. In no event
* will the authors be held liable for any damages arising from the use of this software.
@@ -90,7 +90,7 @@
typedef enum { TOUCH_UP, TOUCH_DOWN, TOUCH_MOVE } TouchAction;
-// Gesture events
+// Gesture event
// NOTE: MAX_TOUCH_POINTS fixed to 4
typedef struct {
int touchAction;
@@ -115,7 +115,7 @@ void ProcessGestureEvent(GestureEvent event); // Process gesture event
void UpdateGestures(void); // Update gestures detected (must be called every frame)
#if defined(GESTURES_STANDALONE)
-void SetGesturesEnabled(unsigned int gestureFlags); // Enable a set of gestures using flags
+void SetGesturesEnabled(unsigned int flags); // Enable a set of gestures using flags
bool IsGestureDetected(int gesture); // Check if a gesture have been detected
int GetGestureDetected(void); // Get latest detected gesture
int GetTouchPointsCount(void); // Get touch points count
@@ -154,7 +154,6 @@ float GetGesturePinchAngle(void); // Get gesture pinch ang
#include <math.h> // Required for: sqrtf(), atan2f()
#endif
-
#if defined(__APPLE__) // macOS also defines __MACH__
#include <mach/clock.h> // Required for: clock_get_time()
#include <mach/mach.h> // Required for: mach_timespec_t
@@ -163,19 +162,20 @@ float GetGesturePinchAngle(void); // Get gesture pinch ang
//----------------------------------------------------------------------------------
// Defines and Macros
//----------------------------------------------------------------------------------
-#define FORCE_TO_SWIPE 0.0005f // Measured in normalized screen units/time
-#define MINIMUM_DRAG 0.015f // Measured in normalized screen units (0.0f to 1.0f)
-#define MINIMUM_PINCH 0.005f // Measured in normalized screen units (0.0f to 1.0f)
-#define TAP_TIMEOUT 300 // Time in milliseconds
-#define PINCH_TIMEOUT 300 // Time in milliseconds
-#define DOUBLETAP_RANGE 0.03f // Measured in normalized screen units (0.0f to 1.0f)
+#define FORCE_TO_SWIPE 0.0005f // Swipe force, measured in normalized screen units/time
+#define MINIMUM_DRAG 0.015f // Drag minimum force, measured in normalized screen units (0.0f to 1.0f)
+#define MINIMUM_PINCH 0.005f // Pinch minimum force, measured in normalized screen units (0.0f to 1.0f)
+#define TAP_TIMEOUT 300 // Tap minimum time, measured in milliseconds
+#define PINCH_TIMEOUT 300 // Pinch minimum time, measured in milliseconds
+#define DOUBLETAP_RANGE 0.03f // DoubleTap range, measured in normalized screen units (0.0f to 1.0f)
//----------------------------------------------------------------------------------
// Types and Structures Definition
//----------------------------------------------------------------------------------
+// Gestures module state context [136 bytes]
typedef struct {
- int current; // Current detected gesture
+ unsigned int current; // Current detected gesture
unsigned int enabledFlags; // Enabled gestures flags
struct {
int firstId; // Touch id for first touch point
@@ -215,8 +215,8 @@ typedef struct {
//----------------------------------------------------------------------------------
static GesturesData GESTURES = {
.Touch.firstId = -1,
- .current = GESTURE_NONE,
- .enabledFlags = 0b0000001111111111 // All gestures enabled by default
+ .current = GESTURE_NONE, // No current gesture detected
+ .enabledFlags = 0b0000001111111111 // All gestures supported by default
};
//----------------------------------------------------------------------------------
@@ -234,9 +234,9 @@ static double GetCurrentTime(void);
//----------------------------------------------------------------------------------
// Enable only desired getures to be detected
-void SetGesturesEnabled(unsigned int gestureFlags)
+void SetGesturesEnabled(unsigned int flags)
{
- GESTURES.enabledFlags = gestureFlags;
+ GESTURES.enabledFlags = flags;
}
// Check if a gesture have been detected