Skip to content

Commit b6ae380

Browse files
committed
REVIEWED: Examples comments, consistent code sections
1 parent 864459c commit b6ae380

26 files changed

+131
-94
lines changed

examples/audio/audio_sound_positioning.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919

2020
#include "raymath.h"
2121

22-
// Sound positioning function
22+
//------------------------------------------------------------------------------------
23+
// Module Functions Declaration
24+
//------------------------------------------------------------------------------------
2325
static void SetSoundPosition(Camera listener, Sound sound, Vector3 position, float maxDist);
2426

2527
//------------------------------------------------------------------------------------
@@ -94,7 +96,10 @@ int main(void)
9496
//--------------------------------------------------------------------------------------
9597
}
9698

97-
// Sound positioning function
99+
//------------------------------------------------------------------------------------
100+
// Module Functions Definition
101+
//------------------------------------------------------------------------------------
102+
// Set sound 3d position
98103
static void SetSoundPosition(Camera listener, Sound sound, Vector3 position, float maxDist)
99104
{
100105
// Calculate direction vector and distance between listener and sound source

examples/audio/audio_stream_effects.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717

1818
#include <stdlib.h> // Required for: NULL
1919

20-
// Required delay effect variables
20+
//----------------------------------------------------------------------------------
21+
// Global Variables Definition
22+
//----------------------------------------------------------------------------------
2123
static float *delayBuffer = NULL;
2224
static unsigned int delayBufferSize = 0;
2325
static unsigned int delayReadIndex = 2;

examples/core/core_2d_camera_platformer.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
#define PLAYER_JUMP_SPD 350.0f
2323
#define PLAYER_HOR_SPD 200.0f
2424

25+
//----------------------------------------------------------------------------------
26+
// Types and Structures Definition
27+
//----------------------------------------------------------------------------------
2528
typedef struct Player {
2629
Vector2 position;
2730
float speed;
@@ -35,7 +38,7 @@ typedef struct EnvItem {
3538
} EnvItem;
3639

3740
//----------------------------------------------------------------------------------
38-
// Module functions declaration
41+
// Module Functions Declaration
3942
//----------------------------------------------------------------------------------
4043
void UpdatePlayer(Player *player, EnvItem *envItems, int envItemsLength, float delta);
4144
void UpdateCameraCenter(Camera2D *camera, Player *player, EnvItem *envItems, int envItemsLength, float delta, int width, int height);

examples/core/core_3d_camera_fps.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ static float headLerp = STAND_HEIGHT;
6464
static Vector2 lean = { 0 };
6565

6666
//----------------------------------------------------------------------------------
67-
// Module functions declaration
67+
// Module Functions Declaration
6868
//----------------------------------------------------------------------------------
6969
static void DrawLevel(void);
7070
static void UpdateCameraFPS(Camera *camera);
@@ -172,9 +172,10 @@ int main(void)
172172
}
173173

174174
//----------------------------------------------------------------------------------
175-
// Module functions definition
175+
// Module Functions Definition
176176
//----------------------------------------------------------------------------------
177-
void UpdateBody(Body* body, float rot, char side, char forward, bool jumpPressed, bool crouchHold)
177+
// Update body considering current world state
178+
void UpdateBody(Body *body, float rot, char side, char forward, bool jumpPressed, bool crouchHold)
178179
{
179180
Vector2 input = (Vector2){ (float)side, (float)-forward };
180181

@@ -236,7 +237,7 @@ void UpdateBody(Body* body, float rot, char side, char forward, bool jumpPressed
236237
}
237238
}
238239

239-
// Update camera
240+
// Update camera for FPS behaviour
240241
static void UpdateCameraFPS(Camera *camera)
241242
{
242243
const Vector3 up = (Vector3){ 0.0f, 1.0f, 0.0f };

examples/core/core_basic_window_web.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const int screenWidth = 800;
3232
const int screenHeight = 450;
3333

3434
//----------------------------------------------------------------------------------
35-
// Module functions declaration
35+
// Module Functions Declaration
3636
//----------------------------------------------------------------------------------
3737
void UpdateDrawFrame(void); // Update and Draw one frame
3838

examples/core/core_high_dpi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include "raylib.h"
1515

1616
//------------------------------------------------------------------------------------
17-
// Module functions declaration
17+
// Module Functions Declaration
1818
//------------------------------------------------------------------------------------
1919
static void DrawTextCenter(const char *text, int x, int y, int fontSize, Color color);
2020

@@ -120,7 +120,7 @@ int main(void)
120120
}
121121

122122
//------------------------------------------------------------------------------------
123-
// Module functions definition
123+
// Module Functions Definition
124124
//------------------------------------------------------------------------------------
125125
static void DrawTextCenter(const char *text, int x, int y, int fontSize, Color color)
126126
{

examples/core/core_loading_thread.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,18 @@
2020
// WARNING: This example does not build on Windows with MSVC compiler
2121
#include "pthread.h" // POSIX style threads management
2222

23-
#include <stdatomic.h> // C11 atomic data types
24-
23+
#include <stdatomic.h> // Required for: C11 atomic data types
2524
#include <time.h> // Required for: clock()
2625

2726
// Using C11 atomics for synchronization
2827
// NOTE: A plain bool (or any plain data type for that matter) can't be used for inter-thread synchronization
29-
static atomic_bool dataLoaded = false; // Data Loaded completion indicator
30-
static void *LoadDataThread(void *arg); // Loading data thread function declaration
28+
static atomic_bool dataLoaded = false; // Data Loaded completion indicator
29+
static atomic_int dataProgress = 0; // Data progress accumulator
3130

32-
static atomic_int dataProgress = 0; // Data progress accumulator
31+
//------------------------------------------------------------------------------------
32+
// Module Functions Declaration
33+
//------------------------------------------------------------------------------------
34+
static void *LoadDataThread(void *arg); // Loading data thread function declaration
3335

3436
//------------------------------------------------------------------------------------
3537
// Program main entry point
@@ -134,6 +136,9 @@ int main(void)
134136
return 0;
135137
}
136138

139+
//------------------------------------------------------------------------------------
140+
// Module Functions Definition
141+
//------------------------------------------------------------------------------------
137142
// Loading data thread function definition
138143
static void *LoadDataThread(void *arg)
139144
{

examples/core/core_random_sequence.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,18 @@
1818
#include "raylib.h"
1919
#include "raymath.h"
2020

21-
#include <stdlib.h> // Required for: malloc() and free()
21+
#include <stdlib.h> // Required for: malloc(), free()
2222

23+
//----------------------------------------------------------------------------------
24+
// Types and Structures Definition
25+
//----------------------------------------------------------------------------------
2326
typedef struct ColorRect {
2427
Color c;
2528
Rectangle r;
2629
} ColorRect;
2730

2831
//------------------------------------------------------------------------------------
29-
// Module functions declaration
32+
// Module Functions Declaration
3033
//------------------------------------------------------------------------------------
3134
static Color GenerateRandomColor();
3235
static ColorRect *GenerateRandomColorRectSequence(float rectCount, float rectWidth, float screenWidth, float screenHeight);
@@ -114,7 +117,7 @@ int main(void)
114117
}
115118

116119
//------------------------------------------------------------------------------------
117-
// Module functions definition
120+
// Module Functions Definition
118121
//------------------------------------------------------------------------------------
119122
static Color GenerateRandomColor()
120123
{

examples/models/models_rlgl_solar_system.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,8 @@ int main(void)
128128
}
129129

130130
//--------------------------------------------------------------------------------------------
131-
// Module Functions Definitions (local)
131+
// Module Functions Definition
132132
//--------------------------------------------------------------------------------------------
133-
134133
// Draw sphere without any matrix transformation
135134
// NOTE: Sphere is drawn in world position ( 0, 0, 0 ) with radius 1.0f
136135
void DrawSphereBasic(Color color)

examples/others/rlgl_standalone.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
#define DARKGRAY (Color){ 80, 80, 80, 255 } // Dark Gray
7878

7979
//----------------------------------------------------------------------------------
80-
// Structures Definition
80+
// Types and Structures Definition
8181
//----------------------------------------------------------------------------------
8282
// Color, 4 components, R8G8B8A8 (32bit)
8383
typedef struct Color {
@@ -97,7 +97,7 @@ typedef struct Camera {
9797
} Camera;
9898

9999
//----------------------------------------------------------------------------------
100-
// Module specific Functions Declaration
100+
// Module Functions Declaration
101101
//----------------------------------------------------------------------------------
102102
static void ErrorCallback(int error, const char *description);
103103
static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods);
@@ -260,7 +260,7 @@ int main(void)
260260
}
261261

262262
//----------------------------------------------------------------------------------
263-
// Module specific Functions Definitions
263+
// Module Functions Definitions
264264
//----------------------------------------------------------------------------------
265265

266266
// GLFW3: Error callback

0 commit comments

Comments
 (0)