Reviewed `rcamera`/`rgestures` file-macros for consistency #3161

This commit is contained in:
Ray 2023-07-10 19:13:44 +02:00
parent 334e96d470
commit 0b9fae3c53
4 changed files with 24 additions and 24 deletions

View File

@ -3,12 +3,12 @@
* rcamera - Basic camera system with support for multiple camera modes * rcamera - Basic camera system with support for multiple camera modes
* *
* CONFIGURATION: * CONFIGURATION:
* #define CAMERA_IMPLEMENTATION * #define RCAMERA_IMPLEMENTATION
* Generates the implementation of the library into the included file. * Generates the implementation of the library into the included file.
* If not defined, the library is in header only mode and can be included in other headers * If not defined, the library is in header only mode and can be included in other headers
* or source files without problems. But only ONE file should hold the implementation. * or source files without problems. But only ONE file should hold the implementation.
* *
* #define CAMERA_STANDALONE * #define RCAMERA_STANDALONE
* If defined, the library can be used as standalone as a camera system but some * If defined, the library can be used as standalone as a camera system but some
* functions must be redefined to manage inputs accordingly. * functions must be redefined to manage inputs accordingly.
* *
@ -50,7 +50,7 @@
#define RLAPI // Functions defined as 'extern' by default (implicit specifiers) #define RLAPI // Functions defined as 'extern' by default (implicit specifiers)
#endif #endif
#if defined(CAMERA_STANDALONE) #if defined(RCAMERA_STANDALONE)
#define CAMERA_CULL_DISTANCE_NEAR 0.01 #define CAMERA_CULL_DISTANCE_NEAR 0.01
#define CAMERA_CULL_DISTANCE_FAR 1000.0 #define CAMERA_CULL_DISTANCE_FAR 1000.0
#else #else
@ -60,9 +60,9 @@
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Types and Structures Definition // Types and Structures Definition
// NOTE: Below types are required for CAMERA_STANDALONE usage // NOTE: Below types are required for standalone usage
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
#if defined(CAMERA_STANDALONE) #if defined(RCAMERA_STANDALONE)
// Vector2, 2 components // Vector2, 2 components
typedef struct Vector2 { typedef struct Vector2 {
float x; // Vector x component float x; // Vector x component
@ -138,7 +138,7 @@ RLAPI Matrix GetCameraProjectionMatrix(Camera* camera, float aspect);
} }
#endif #endif
#endif // CAMERA_H #endif // RCAMERA_H
/*********************************************************************************** /***********************************************************************************
@ -147,7 +147,7 @@ RLAPI Matrix GetCameraProjectionMatrix(Camera* camera, float aspect);
* *
************************************************************************************/ ************************************************************************************/
#if defined(CAMERA_IMPLEMENTATION) #if defined(RCAMERA_IMPLEMENTATION)
#include "raymath.h" // Required for vector maths: #include "raymath.h" // Required for vector maths:
// Vector3Add() // Vector3Add()
@ -417,7 +417,7 @@ Matrix GetCameraProjectionMatrix(Camera *camera, float aspect)
return MatrixIdentity(); return MatrixIdentity();
} }
#ifndef CAMERA_STANDALONE #if !defined(RCAMERA_STANDALONE)
// Update camera position for selected mode // Update camera position for selected mode
// Camera mode: CAMERA_FREE, CAMERA_FIRST_PERSON, CAMERA_THIRD_PERSON, CAMERA_ORBITAL or CUSTOM // Camera mode: CAMERA_FREE, CAMERA_FIRST_PERSON, CAMERA_THIRD_PERSON, CAMERA_ORBITAL or CUSTOM
void UpdateCamera(Camera *camera, int mode) void UpdateCamera(Camera *camera, int mode)
@ -483,7 +483,7 @@ void UpdateCamera(Camera *camera, int mode)
if (IsKeyPressed(KEY_KP_ADD)) CameraMoveToTarget(camera, -2.0f); if (IsKeyPressed(KEY_KP_ADD)) CameraMoveToTarget(camera, -2.0f);
} }
} }
#endif // !CAMERA_STANDALONE #endif // !RCAMERA_STANDALONE
// Update camera movement, movement/rotation values should be provided by user // Update camera movement, movement/rotation values should be provided by user
void UpdateCameraPro(Camera *camera, Vector3 movement, Vector3 rotation, float zoom) void UpdateCameraPro(Camera *camera, Vector3 movement, Vector3 rotation, float zoom)
@ -516,4 +516,4 @@ void UpdateCameraPro(Camera *camera, Vector3 movement, Vector3 rotation, float z
CameraMoveToTarget(camera, zoom); CameraMoveToTarget(camera, zoom);
} }
#endif // CAMERA_IMPLEMENTATION #endif // RCAMERA_IMPLEMENTATION

View File

@ -124,12 +124,12 @@
#include "raymath.h" // Vector3, Quaternion and Matrix functionality #include "raymath.h" // Vector3, Quaternion and Matrix functionality
#if defined(SUPPORT_GESTURES_SYSTEM) #if defined(SUPPORT_GESTURES_SYSTEM)
#define GESTURES_IMPLEMENTATION #define RGESTURES_IMPLEMENTATION
#include "rgestures.h" // Gestures detection functionality #include "rgestures.h" // Gestures detection functionality
#endif #endif
#if defined(SUPPORT_CAMERA_SYSTEM) #if defined(SUPPORT_CAMERA_SYSTEM)
#define CAMERA_IMPLEMENTATION #define RCAMERA_IMPLEMENTATION
#include "rcamera.h" // Camera system functionality #include "rcamera.h" // Camera system functionality
#endif #endif

View File

@ -3,12 +3,12 @@
* rgestures - Gestures system, gestures processing based on input events (touch/mouse) * rgestures - Gestures system, gestures processing based on input events (touch/mouse)
* *
* CONFIGURATION: * CONFIGURATION:
* #define GESTURES_IMPLEMENTATION * #define RGESTURES_IMPLEMENTATION
* Generates the implementation of the library into the included file. * Generates the implementation of the library into the included file.
* If not defined, the library is in header only mode and can be included in other headers * If not defined, the library is in header only mode and can be included in other headers
* or source files without problems. But only ONE file should hold the implementation. * or source files without problems. But only ONE file should hold the implementation.
* *
* #define GESTURES_STANDALONE * #define RGESTURES_STANDALONE
* If defined, the library can be used as standalone to process gesture events with * If defined, the library can be used as standalone to process gesture events with
* no external dependencies. * no external dependencies.
* *
@ -56,7 +56,7 @@
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Types and Structures Definition // Types and Structures Definition
// NOTE: Below types are required for GESTURES_STANDALONE usage // NOTE: Below types are required for standalone usage
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Boolean type // Boolean type
#if (defined(__STDC__) && __STDC_VERSION__ >= 199901L) || (defined(_MSC_VER) && _MSC_VER >= 1800) #if (defined(__STDC__) && __STDC_VERSION__ >= 199901L) || (defined(_MSC_VER) && _MSC_VER >= 1800)
@ -73,7 +73,7 @@ typedef struct Vector2 {
} Vector2; } Vector2;
#endif #endif
#if defined(GESTURES_STANDALONE) #if defined(RGESTURES_STANDALONE)
// Gestures type // Gestures type
// NOTE: It could be used as flags to enable only some gestures // NOTE: It could be used as flags to enable only some gestures
typedef enum { typedef enum {
@ -122,7 +122,7 @@ extern "C" { // Prevents name mangling of functions
void ProcessGestureEvent(GestureEvent event); // Process gesture event and translate it into gestures void ProcessGestureEvent(GestureEvent event); // Process gesture event and translate it into gestures
void UpdateGestures(void); // Update gestures detected (must be called every frame) void UpdateGestures(void); // Update gestures detected (must be called every frame)
#if defined(GESTURES_STANDALONE) #if defined(RGESTURES_STANDALONE)
void SetGesturesEnabled(unsigned int flags); // 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 bool IsGestureDetected(int gesture); // Check if a gesture have been detected
int GetGestureDetected(void); // Get latest detected gesture int GetGestureDetected(void); // Get latest detected gesture
@ -138,17 +138,17 @@ float GetGesturePinchAngle(void); // Get gesture pinch ang
} }
#endif #endif
#endif // GESTURES_H #endif // RGESTURES_H
/*********************************************************************************** /***********************************************************************************
* *
* GESTURES IMPLEMENTATION * RGESTURES IMPLEMENTATION
* *
************************************************************************************/ ************************************************************************************/
#if defined(GESTURES_IMPLEMENTATION) #if defined(RGESTURES_IMPLEMENTATION)
#if defined(GESTURES_STANDALONE) #if defined(RGESTURES_STANDALONE)
#if defined(_WIN32) #if defined(_WIN32)
#if defined(__cplusplus) #if defined(__cplusplus)
extern "C" { // Prevents name mangling of functions extern "C" { // Prevents name mangling of functions
@ -527,7 +527,7 @@ static double rgGetCurrentTime(void)
{ {
double time = 0; double time = 0;
#if !defined(GESTURES_STANDALONE) #if !defined(RGESTURES_STANDALONE)
time = GetTime(); time = GetTime();
#else #else
#if defined(_WIN32) #if defined(_WIN32)
@ -568,4 +568,4 @@ static double rgGetCurrentTime(void)
return time; return time;
} }
#endif // GESTURES_IMPLEMENTATION #endif // RGESTURES_IMPLEMENTATION

View File

@ -1244,7 +1244,7 @@ Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing
if (tempTextWidth < textWidth) tempTextWidth = textWidth; if (tempTextWidth < textWidth) tempTextWidth = textWidth;
byteCounter = 0; byteCounter = 0;
textWidth = 0; textWidth = 0;
// NOTE: Line spacing is a global variable, use SetTextLineSpacing() to setup // NOTE: Line spacing is a global variable, use SetTextLineSpacing() to setup
textHeight += (float)textLineSpacing; textHeight += (float)textLineSpacing;
} }