From 8f32c502a7b612e8ba258b5172b2bc6e46b1576e Mon Sep 17 00:00:00 2001 From: Ray Date: Tue, 2 Sep 2025 12:10:40 +0200 Subject: [PATCH] REVIEWED: Code sections definition --- src/platforms/rcore_desktop_sdl.c | 2 +- src/platforms/rcore_drm.c | 2 +- src/platforms/rcore_web.c | 2 +- src/raudio.c | 5 ++--- src/raylib.h | 4 ++-- src/rlgl.h | 6 +++--- src/rmodels.c | 5 ++--- src/rshapes.c | 7 +++---- src/rtext.c | 6 ++---- src/rtextures.c | 5 ++--- 10 files changed, 19 insertions(+), 25 deletions(-) diff --git a/src/platforms/rcore_desktop_sdl.c b/src/platforms/rcore_desktop_sdl.c index c9b346fcf..33788d720 100644 --- a/src/platforms/rcore_desktop_sdl.c +++ b/src/platforms/rcore_desktop_sdl.c @@ -111,7 +111,7 @@ extern CoreData CORE; // Global CORE state context static PlatformData platform = { 0 }; // Platform specific data //---------------------------------------------------------------------------------- -// Local Variables Definition +// Global Variables Definition //---------------------------------------------------------------------------------- #define SCANCODE_MAPPED_NUM 232 static const KeyboardKey mapScancodeToKey[SCANCODE_MAPPED_NUM] = { diff --git a/src/platforms/rcore_drm.c b/src/platforms/rcore_drm.c index a2151ea38..b15df2dea 100644 --- a/src/platforms/rcore_drm.c +++ b/src/platforms/rcore_drm.c @@ -156,7 +156,7 @@ extern CoreData CORE; // Global CORE state context static PlatformData platform = { 0 }; // Platform specific data //---------------------------------------------------------------------------------- -// Local Variables Definition +// Global Variables Definition //---------------------------------------------------------------------------------- // NOTE: The complete evdev EV_KEY list can be found at /usr/include/linux/input-event-codes.h diff --git a/src/platforms/rcore_web.c b/src/platforms/rcore_web.c index 2712aa142..a32f9c59a 100644 --- a/src/platforms/rcore_web.c +++ b/src/platforms/rcore_web.c @@ -86,7 +86,7 @@ extern CoreData CORE; // Global CORE state context static PlatformData platform = { 0 }; // Platform specific data //---------------------------------------------------------------------------------- -// Local Variables Definition +// Global Variables Definition //---------------------------------------------------------------------------------- static const char cursorLUT[11][12] = { "default", // 0 MOUSE_CURSOR_DEFAULT diff --git a/src/raudio.c b/src/raudio.c index e9d76fa99..c883132d9 100644 --- a/src/raudio.c +++ b/src/raudio.c @@ -407,7 +407,7 @@ static AudioData AUDIO = { // Global AUDIO context }; //---------------------------------------------------------------------------------- -// Module specific Functions Declaration +// Module Internal Functions Declaration //---------------------------------------------------------------------------------- static void OnLog(void *pUserData, ma_uint32 level, const char *pMessage); @@ -2352,9 +2352,8 @@ void DetachAudioMixedProcessor(AudioCallback process) } //---------------------------------------------------------------------------------- -// Module specific Functions Definition +// Module Internal Functions Definition //---------------------------------------------------------------------------------- - // Log callback function static void OnLog(void *pUserData, ma_uint32 level, const char *pMessage) { diff --git a/src/raylib.h b/src/raylib.h index b5de3c71d..1d7321b46 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -115,7 +115,7 @@ #endif //---------------------------------------------------------------------------------- -// Some basic Defines +// Defines and Macros //---------------------------------------------------------------------------------- #ifndef PI #define PI 3.14159265358979323846f @@ -201,7 +201,7 @@ #define RAYWHITE CLITERAL(Color){ 245, 245, 245, 255 } // My own White (raylib logo) //---------------------------------------------------------------------------------- -// Structures Definition +// Types and Structures Definition //---------------------------------------------------------------------------------- // Boolean type #if (defined(__STDC__) && __STDC_VERSION__ >= 199901L) || (defined(_MSC_VER) && _MSC_VER >= 1800) diff --git a/src/rlgl.h b/src/rlgl.h index 324d8aac5..884110c56 100644 --- a/src/rlgl.h +++ b/src/rlgl.h @@ -1039,7 +1039,7 @@ RLAPI void rlLoadDrawQuad(void); // Load and draw a quad #endif //---------------------------------------------------------------------------------- -// Types and Structures Definition +// Module Types and Structures Definition //---------------------------------------------------------------------------------- #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) @@ -1145,7 +1145,7 @@ static PFNGLVERTEXATTRIBDIVISOREXTPROC glVertexAttribDivisor = NULL; #endif //---------------------------------------------------------------------------------- -// Module specific Functions Declaration +// Module Functions Declaration //---------------------------------------------------------------------------------- #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) static void rlLoadShaderDefault(void); // Load default shader @@ -4864,7 +4864,7 @@ const char *rlGetPixelFormatName(unsigned int format) } //---------------------------------------------------------------------------------- -// Module specific Functions Definition +// Module Functions Definition //---------------------------------------------------------------------------------- #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) // Load default shader (just vertex positioning and texture coloring) diff --git a/src/rmodels.c b/src/rmodels.c index 5a824ce44..3ac416847 100644 --- a/src/rmodels.c +++ b/src/rmodels.c @@ -144,7 +144,7 @@ // ... //---------------------------------------------------------------------------------- -// Module specific Functions Declaration +// Module Internal Functions Declaration //---------------------------------------------------------------------------------- #if defined(SUPPORT_FILEFORMAT_OBJ) static Model LoadOBJ(const char *fileName); // Load OBJ mesh data @@ -171,7 +171,6 @@ static void ProcessMaterialsOBJ(Material *rayMaterials, tinyobj_material_t *mate //---------------------------------------------------------------------------------- // Module Functions Definition //---------------------------------------------------------------------------------- - // Draw a line in 3D world space void DrawLine3D(Vector3 startPos, Vector3 endPos, Color color) { @@ -4244,7 +4243,7 @@ RayCollision GetRayCollisionQuad(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3, Ve } //---------------------------------------------------------------------------------- -// Module specific Functions Definition +// Module Internal Functions Definition //---------------------------------------------------------------------------------- #if defined(SUPPORT_FILEFORMAT_IQM) || defined(SUPPORT_FILEFORMAT_GLTF) // Build pose from parent joints diff --git a/src/rshapes.c b/src/rshapes.c index 38ad75c7d..14e3f856a 100644 --- a/src/rshapes.c +++ b/src/rshapes.c @@ -83,14 +83,13 @@ static Texture2D texShapes = { 1, 1, 1, 1, 7 }; // Texture used o static Rectangle texShapesRec = { 0.0f, 0.0f, 1.0f, 1.0f }; // Texture source rectangle used on shapes drawing //---------------------------------------------------------------------------------- -// Module specific Functions Declaration +// Module Internal Functions Declaration //---------------------------------------------------------------------------------- static float EaseCubicInOut(float t, float b, float c, float d); // Cubic easing //---------------------------------------------------------------------------------- // Module Functions Definition //---------------------------------------------------------------------------------- - // Set texture and rectangle to be used on shapes drawing // NOTE: It can be useful when using basic shapes and one single font, // defining a font char white rectangle would allow drawing everything in a single draw call @@ -2371,7 +2370,7 @@ bool CheckCollisionPointLine(Vector2 point, Vector2 p1, Vector2 p2, int threshol } // Check if circle collides with a line created between two points [p1] and [p2] -RLAPI bool CheckCollisionCircleLine(Vector2 center, float radius, Vector2 p1, Vector2 p2) +bool CheckCollisionCircleLine(Vector2 center, float radius, Vector2 p1, Vector2 p2) { float dx = p1.x - p2.x; float dy = p1.y - p2.y; @@ -2420,7 +2419,7 @@ Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2) } //---------------------------------------------------------------------------------- -// Module specific Functions Definition +// Module Internal Functions Definition //---------------------------------------------------------------------------------- // Cubic easing in-out diff --git a/src/rtext.c b/src/rtext.c index ffa432ed3..ffcaa3d46 100644 --- a/src/rtext.c +++ b/src/rtext.c @@ -141,7 +141,7 @@ static int textLineSpacing = 2; // Text vertical line spacing in //... //---------------------------------------------------------------------------------- -// Module specific Functions Declaration +// Module Internal Functions Declaration //---------------------------------------------------------------------------------- #if defined(SUPPORT_FILEFORMAT_FNT) static Font LoadBMFont(const char *fileName); // Load a BMFont file (AngelCode font file) @@ -2197,7 +2197,7 @@ int GetCodepointPrevious(const char *text, int *codepointSize) } //---------------------------------------------------------------------------------- -// Module specific Functions Definition +// Module Internal Functions Definition //---------------------------------------------------------------------------------- #if defined(SUPPORT_FILEFORMAT_FNT) || defined(SUPPORT_FILEFORMAT_BDF) // Read a line from memory @@ -2380,11 +2380,9 @@ static Font LoadBMFont(const char *fileName) return font; } - #endif #if defined(SUPPORT_FILEFORMAT_BDF) - // Convert hexadecimal to decimal (single digit) static unsigned char HexToInt(char hex) { diff --git a/src/rtextures.c b/src/rtextures.c index a4c34b000..18ee1af99 100644 --- a/src/rtextures.c +++ b/src/rtextures.c @@ -258,7 +258,7 @@ extern void LoadFontDefault(void); // [Module: text] Loads default font, required by ImageDrawText() //---------------------------------------------------------------------------------- -// Module specific Functions Declaration +// Module Internal Functions Declaration //---------------------------------------------------------------------------------- static float HalfToFloat(unsigned short x); static unsigned short FloatToHalf(float x); @@ -267,7 +267,6 @@ static Vector4 *LoadImageDataNormalized(Image image); // Load pixel data f //---------------------------------------------------------------------------------- // Module Functions Definition //---------------------------------------------------------------------------------- - // Load image from file into CPU memory (RAM) Image LoadImage(const char *fileName) { @@ -5406,7 +5405,7 @@ int GetPixelDataSize(int width, int height, int format) } //---------------------------------------------------------------------------------- -// Module specific Functions Definition +// Module Internal Functions Definition //---------------------------------------------------------------------------------- // Convert half-float (stored as unsigned short) to float // REF: https://stackoverflow.com/questions/1659440/32-bit-to-16-bit-floating-point-conversion/60047308#60047308