Skip to content

Commit c579eef

Browse files
committed
REVIEWED: Examples section comments, for better organization and consistency
1 parent 1fa3c15 commit c579eef

19 files changed

+253
-170
lines changed

examples/core/core_automation_events.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424

2525
#define MAX_ENVIRONMENT_ELEMENTS 5
2626

27+
//----------------------------------------------------------------------------------
28+
// Types and Structures Definition
29+
//----------------------------------------------------------------------------------
2730
typedef struct Player {
2831
Vector2 position;
2932
float speed;
@@ -36,7 +39,6 @@ typedef struct EnvElement {
3639
Color color;
3740
} EnvElement;
3841

39-
4042
//------------------------------------------------------------------------------------
4143
// Program main entry point
4244
//------------------------------------------------------------------------------------

examples/core/core_random_sequence.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ typedef struct ColorRect {
3131
//------------------------------------------------------------------------------------
3232
// Module Functions Declaration
3333
//------------------------------------------------------------------------------------
34-
static Color GenerateRandomColor();
34+
static Color GenerateRandomColor(void);
3535
static ColorRect *GenerateRandomColorRectSequence(float rectCount, float rectWidth, float screenWidth, float screenHeight);
3636
static void ShuffleColorRectSequence(ColorRect *rectangles, int rectCount);
3737

@@ -122,7 +122,7 @@ int main(void)
122122
//------------------------------------------------------------------------------------
123123
// Module Functions Definition
124124
//------------------------------------------------------------------------------------
125-
static Color GenerateRandomColor()
125+
static Color GenerateRandomColor(void)
126126
{
127127
Color color = {
128128
GetRandomValue(0, 255),

examples/core/core_storage_values.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ typedef enum {
2525
STORAGE_POSITION_HISCORE = 1
2626
} StorageData;
2727

28-
// Persistent storage functions
28+
//------------------------------------------------------------------------------------
29+
// Module Functions Declaration
30+
//------------------------------------------------------------------------------------
2931
static bool SaveStorageValue(unsigned int position, int value);
3032
static int LoadStorageValue(unsigned int position);
3133

@@ -101,6 +103,9 @@ int main(void)
101103
return 0;
102104
}
103105

106+
//------------------------------------------------------------------------------------
107+
// Module Functions Declaration
108+
//------------------------------------------------------------------------------------
104109
// Save integer value to storage file (to defined position)
105110
// NOTE: Storage positions is directly related to file memory layout (4 bytes each integer)
106111
bool SaveStorageValue(unsigned int position, int value)

examples/models/models_mesh_generation.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717

1818
#define NUM_MODELS 9 // Parametric 3d shapes to generate
1919

20+
//------------------------------------------------------------------------------------
21+
// Module Functions Declaration
22+
//------------------------------------------------------------------------------------
2023
static Mesh GenMeshCustom(void); // Generate a simple triangle mesh from code
2124

2225
//------------------------------------------------------------------------------------
@@ -136,6 +139,9 @@ int main(void)
136139
return 0;
137140
}
138141

142+
//------------------------------------------------------------------------------------
143+
// Module Functions Definition
144+
//------------------------------------------------------------------------------------
139145
// Generate a simple triangle mesh from code
140146
static Mesh GenMeshCustom(void)
141147
{

examples/models/models_point_rendering.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@
1818
#include "raylib.h"
1919

2020
#include <stdlib.h> // Required for: rand()
21-
#include <math.h> // Required for: cos(), sin()
21+
#include <math.h> // Required for: cosf(), sinf()
2222

2323
#define MAX_POINTS 10000000 // 10 million
2424
#define MIN_POINTS 1000 // 1 thousand
2525

26+
//------------------------------------------------------------------------------------
27+
// Module Functions Declaration
28+
//------------------------------------------------------------------------------------
2629
// Generate mesh using points
2730
static Mesh GenMeshPoints(int numPoints);
2831

@@ -148,6 +151,9 @@ int main()
148151
return 0;
149152
}
150153

154+
//------------------------------------------------------------------------------------
155+
// Module Functions Definition
156+
//------------------------------------------------------------------------------------
151157
// Generate a spherical point cloud
152158
static Mesh GenMeshPoints(int numPoints)
153159
{
@@ -158,7 +164,7 @@ static Mesh GenMeshPoints(int numPoints)
158164
.colors = (unsigned char*)MemAlloc(numPoints*4*sizeof(unsigned char)),
159165
};
160166

161-
// https://en.wikipedia.org/wiki/Spherical_coordinate_system
167+
// REF: https://en.wikipedia.org/wiki/Spherical_coordinate_system
162168
for (int i = 0; i < numPoints; i++)
163169
{
164170
float theta = ((float)PI*rand())/((float)RAND_MAX);

examples/models/models_skybox.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
#define GLSL_VERSION 100
2525
#endif
2626

27+
//------------------------------------------------------------------------------------
28+
// Module Functions Declaration
29+
//------------------------------------------------------------------------------------
2730
// Generate cubemap (6 faces) from equirectangular (panorama) texture
2831
static TextureCubemap GenTextureCubemap(Shader shader, Texture2D panorama, int size, int format);
2932

@@ -183,6 +186,9 @@ int main(void)
183186
return 0;
184187
}
185188

189+
//------------------------------------------------------------------------------------
190+
// Module Functions Definition
191+
//------------------------------------------------------------------------------------
186192
// Generate cubemap texture from HDR texture
187193
static TextureCubemap GenTextureCubemap(Shader shader, Texture2D panorama, int size, int format)
188194
{

examples/others/raylib_opengl_interop.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@
5454

5555
#define MAX_PARTICLES 1000
5656

57+
//------------------------------------------------------------------------------------
58+
// Module Functions Declaration
59+
//------------------------------------------------------------------------------------
5760
// Particle type
5861
typedef struct Particle {
5962
float x;

examples/others/rlgl_compute_shader.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
// Maximum amount of queued draw commands (squares draw from mouse down events)
3131
#define MAX_BUFFERED_TRANSFERTS 48
3232

33+
//----------------------------------------------------------------------------------
34+
// Types and Structures Definition
35+
//----------------------------------------------------------------------------------
3336
// Game Of Life Update Command
3437
typedef struct GolUpdateCmd {
3538
unsigned int x; // x coordinate of the gol command

examples/shaders/shaders_deferred_render.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535

3636
#define MAX_CUBES 30
3737

38+
//----------------------------------------------------------------------------------
39+
// Types and Structures Definition
40+
//----------------------------------------------------------------------------------
3841
// GBuffer data
3942
typedef struct GBuffer {
4043
unsigned int framebuffer;

examples/shaders/shaders_palette_switch.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
#define COLORS_PER_PALETTE 8
3535
#define VALUES_PER_COLOR 3
3636

37+
//------------------------------------------------------------------------------------
38+
// Global Variables Definition
39+
//------------------------------------------------------------------------------------
3740
static const int palettes[MAX_PALETTES][COLORS_PER_PALETTE*VALUES_PER_COLOR] = {
3841
{ // 3-BIT RGB
3942
0, 0, 0,

0 commit comments

Comments
 (0)