Skip to content

Commit f0889a7

Browse files
committed
EXAMPLES: Format tweaks
1 parent 9f07cfe commit f0889a7

File tree

91 files changed

+409
-397
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+409
-397
lines changed

examples/audio/audio_mixed_processor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*******************************************************************************************
22
*
3-
* raylib [audio] example - Mixed audio processing
3+
* raylib [audio] example - mixed audio processing
44
*
55
* Example complexity rating: [★★★★] 4/4
66
*

examples/audio/audio_music_stream.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ int main(void)
4545
// Update
4646
//----------------------------------------------------------------------------------
4747
UpdateMusicStream(music); // Update music buffer with new stream data
48-
48+
4949
// Restart music playing (stop and play)
5050
if (IsKeyPressed(KEY_SPACE))
5151
{

examples/audio/audio_sound_positioning.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*******************************************************************************************
22
*
3-
* raylib [audio] example - Playing spatialized 3D sound
3+
* raylib [audio] example - spatialized 3D sound
44
*
55
* Example complexity rating: [★★☆☆] 2/4
66
*
@@ -31,9 +31,9 @@ int main(void)
3131
//--------------------------------------------------------------------------------------
3232
const int screenWidth = 800;
3333
const int screenHeight = 450;
34-
35-
InitWindow(screenWidth, screenHeight, "raylib [audio] example - Playing spatialized 3D sound");
36-
34+
35+
InitWindow(screenWidth, screenHeight, "raylib [audio] example - spatialized 3D sound");
36+
3737
InitAudioDevice();
3838

3939
Sound sound = LoadSound("resources/coin.wav");
@@ -45,9 +45,9 @@ int main(void)
4545
.fovy = 60,
4646
.projection = CAMERA_PERSPECTIVE
4747
};
48-
48+
4949
DisableCursor();
50-
50+
5151
SetTargetFPS(60);
5252
//--------------------------------------------------------------------------------------
5353

@@ -89,7 +89,7 @@ int main(void)
8989
//--------------------------------------------------------------------------------------
9090
UnloadSound(sound);
9191
CloseAudioDevice(); // Close audio device
92-
92+
9393
CloseWindow(); // Close window and OpenGL context
9494
//--------------------------------------------------------------------------------------
9595
}
@@ -100,23 +100,23 @@ static void SetSoundPosition(Camera listener, Sound sound, Vector3 position, flo
100100
// Calculate direction vector and distance between listener and sound source
101101
Vector3 direction = Vector3Subtract(position, listener.position);
102102
float distance = Vector3Length(direction);
103-
103+
104104
// Apply logarithmic distance attenuation and clamp between 0-1
105105
float attenuation = 1.0f/(1.0f + (distance/maxDist));
106106
attenuation = Clamp(attenuation, 0.0f, 1.0f);
107-
107+
108108
// Calculate normalized vectors for spatial positioning
109109
Vector3 normalizedDirection = Vector3Normalize(direction);
110110
Vector3 forward = Vector3Normalize(Vector3Subtract(listener.target, listener.position));
111111
Vector3 right = Vector3Normalize(Vector3CrossProduct(listener.up, forward));
112-
112+
113113
// Reduce volume for sounds behind the listener
114114
float dotProduct = Vector3DotProduct(forward, normalizedDirection);
115115
if (dotProduct < 0.0f) attenuation *= (1.0f + dotProduct*0.5f);
116-
116+
117117
// Set stereo panning based on sound position relative to listener
118118
float pan = 0.5f + 0.5f*Vector3DotProduct(normalizedDirection, right);
119-
119+
120120
// Apply final sound properties
121121
SetSoundVolume(sound, attenuation);
122122
SetSoundPan(sound, pan);

examples/audio/audio_stream_effects.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ int main(void)
5353

5454
float timePlayed = 0.0f; // Time played normalized [0.0f..1.0f]
5555
bool pause = false; // Music playing paused
56-
56+
5757
bool enableEffectLPF = false; // Enable effect low-pass-filter
5858
bool enableEffectDelay = false; // Enable effect delay (1 second)
5959

@@ -98,7 +98,7 @@ int main(void)
9898
if (enableEffectDelay) AttachAudioStreamProcessor(music.stream, AudioProcessEffectDelay);
9999
else DetachAudioStreamProcessor(music.stream, AudioProcessEffectDelay);
100100
}
101-
101+
102102
// Get normalized time played for current music stream
103103
timePlayed = GetMusicTimePlayed(music)/GetMusicTimeLength(music);
104104

@@ -119,7 +119,7 @@ int main(void)
119119

120120
DrawText("PRESS SPACE TO RESTART MUSIC", 215, 230, 20, LIGHTGRAY);
121121
DrawText("PRESS P TO PAUSE/RESUME MUSIC", 208, 260, 20, LIGHTGRAY);
122-
122+
123123
DrawText(TextFormat("PRESS F TO TOGGLE LPF EFFECT: %s", enableEffectLPF? "ON" : "OFF"), 200, 320, 20, GRAY);
124124
DrawText(TextFormat("PRESS D TO TOGGLE DELAY EFFECT: %s", enableEffectDelay? "ON" : "OFF"), 180, 350, 20, GRAY);
125125

examples/core/core_2d_camera_mouse_zoom.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ int main ()
4747
//----------------------------------------------------------------------------------
4848
if (IsKeyPressed(KEY_ONE)) zoomMode = 0;
4949
else if (IsKeyPressed(KEY_TWO)) zoomMode = 1;
50-
50+
5151
// Translate based on mouse right click
5252
if (IsMouseButtonDown(MOUSE_BUTTON_LEFT))
5353
{
@@ -68,7 +68,7 @@ int main ()
6868
// Set the offset to where the mouse is
6969
camera.offset = GetMousePosition();
7070

71-
// Set the target to match, so that the camera maps the world space point
71+
// Set the target to match, so that the camera maps the world space point
7272
// under the cursor to the screen space point under the cursor at any zoom
7373
camera.target = mouseWorldPos;
7474

@@ -89,7 +89,7 @@ int main ()
8989
// Set the offset to where the mouse is
9090
camera.offset = GetMousePosition();
9191

92-
// Set the target to match, so that the camera maps the world space point
92+
// Set the target to match, so that the camera maps the world space point
9393
// under the cursor to the screen space point under the cursor at any zoom
9494
camera.target = mouseWorldPos;
9595
}
@@ -111,7 +111,7 @@ int main ()
111111

112112
BeginMode2D(camera);
113113

114-
// Draw the 3d grid, rotated 90 degrees and centered around 0,0
114+
// Draw the 3d grid, rotated 90 degrees and centered around 0,0
115115
// just so we have something in the XY plane
116116
rlPushMatrix();
117117
rlTranslatef(0, 25*50, 0);
@@ -121,19 +121,19 @@ int main ()
121121

122122
// Draw a reference circle
123123
DrawCircle(GetScreenWidth()/2, GetScreenHeight()/2, 50, MAROON);
124-
124+
125125
EndMode2D();
126-
126+
127127
// Draw mouse reference
128128
//Vector2 mousePos = GetWorldToScreen2D(GetMousePosition(), camera)
129129
DrawCircleV(GetMousePosition(), 4, DARKGRAY);
130-
DrawTextEx(GetFontDefault(), TextFormat("[%i, %i]", GetMouseX(), GetMouseY()),
130+
DrawTextEx(GetFontDefault(), TextFormat("[%i, %i]", GetMouseX(), GetMouseY()),
131131
Vector2Add(GetMousePosition(), (Vector2){ -44, -24 }), 20, 2, BLACK);
132132

133133
DrawText("[1][2] Select mouse zoom mode (Wheel or Move)", 20, 20, 20, DARKGRAY);
134134
if (zoomMode == 0) DrawText("Mouse left button drag to move, mouse wheel to zoom", 20, 50, 20, DARKGRAY);
135135
else DrawText("Mouse left button drag to move, mouse press and move to zoom", 20, 50, 20, DARKGRAY);
136-
136+
137137
EndDrawing();
138138
//----------------------------------------------------------------------------------
139139
}

examples/core/core_2d_camera_platformer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ int main(void)
137137

138138
Rectangle playerRect = { player.position.x - 20, player.position.y - 40, 40.0f, 40.0f };
139139
DrawRectangleRec(playerRect, RED);
140-
140+
141141
DrawCircleV(player.position, 5.0f, GOLD);
142142

143143
EndMode2D();

examples/core/core_2d_camera_split_screen.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Example complexity rating: [★★★★] 4/4
66
*
7-
* Addapted from the core_3d_camera_split_screen example:
7+
* Addapted from the core_3d_camera_split_screen example:
88
* https://github.com/raysan5/raylib/blob/master/examples/core/core_3d_camera_split_screen.c
99
*
1010
* Example originally created with raylib 4.5, last time updated with raylib 4.5
@@ -81,9 +81,9 @@ int main(void)
8181
//----------------------------------------------------------------------------------
8282
BeginTextureMode(screenCamera1);
8383
ClearBackground(RAYWHITE);
84-
84+
8585
BeginMode2D(camera1);
86-
86+
8787
// Draw full scene with first camera
8888
for (int i = 0; i < screenWidth/PLAYER_SIZE + 1; i++)
8989
{
@@ -106,17 +106,17 @@ int main(void)
106106
DrawRectangleRec(player1, RED);
107107
DrawRectangleRec(player2, BLUE);
108108
EndMode2D();
109-
109+
110110
DrawRectangle(0, 0, GetScreenWidth()/2, 30, Fade(RAYWHITE, 0.6f));
111111
DrawText("PLAYER1: W/S/A/D to move", 10, 10, 10, MAROON);
112-
112+
113113
EndTextureMode();
114114

115115
BeginTextureMode(screenCamera2);
116116
ClearBackground(RAYWHITE);
117-
117+
118118
BeginMode2D(camera2);
119-
119+
120120
// Draw full scene with second camera
121121
for (int i = 0; i < screenWidth/PLAYER_SIZE + 1; i++)
122122
{
@@ -138,21 +138,21 @@ int main(void)
138138

139139
DrawRectangleRec(player1, RED);
140140
DrawRectangleRec(player2, BLUE);
141-
141+
142142
EndMode2D();
143-
143+
144144
DrawRectangle(0, 0, GetScreenWidth()/2, 30, Fade(RAYWHITE, 0.6f));
145145
DrawText("PLAYER2: UP/DOWN/LEFT/RIGHT to move", 10, 10, 10, DARKBLUE);
146-
146+
147147
EndTextureMode();
148148

149149
// Draw both views render textures to the screen side by side
150150
BeginDrawing();
151151
ClearBackground(BLACK);
152-
152+
153153
DrawTextureRec(screenCamera1.texture, splitScreenRect, (Vector2){ 0, 0 }, WHITE);
154154
DrawTextureRec(screenCamera2.texture, splitScreenRect, (Vector2){ screenWidth/2.0f, 0 }, WHITE);
155-
155+
156156
DrawRectangle(GetScreenWidth()/2 - 2, 0, 4, GetScreenHeight(), LIGHTGRAY);
157157
EndDrawing();
158158
}

examples/core/core_3d_camera_first_person.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ int main(void)
127127
UpdateCameraPro(&camera,
128128
(Vector3){
129129
(IsKeyDown(KEY_W) || IsKeyDown(KEY_UP))*0.1f - // Move forward-backward
130-
(IsKeyDown(KEY_S) || IsKeyDown(KEY_DOWN))*0.1f,
130+
(IsKeyDown(KEY_S) || IsKeyDown(KEY_DOWN))*0.1f,
131131
(IsKeyDown(KEY_D) || IsKeyDown(KEY_RIGHT))*0.1f - // Move right-left
132132
(IsKeyDown(KEY_A) || IsKeyDown(KEY_LEFT))*0.1f,
133133
0.0f // Move up-down

examples/core/core_3d_camera_split_screen.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ int main(void)
5151

5252
// Build a flipped rectangle the size of the split view to use for drawing later
5353
Rectangle splitScreenRect = { 0.0f, 0.0f, (float)screenPlayer1.texture.width, (float)-screenPlayer1.texture.height };
54-
54+
5555
// Grid data
5656
int count = 5;
5757
float spacing = 4;
@@ -98,9 +98,9 @@ int main(void)
9898
// Draw Player1 view to the render texture
9999
BeginTextureMode(screenPlayer1);
100100
ClearBackground(SKYBLUE);
101-
101+
102102
BeginMode3D(cameraPlayer1);
103-
103+
104104
// Draw scene: grid of cube trees on a plane to make a "world"
105105
DrawPlane((Vector3){ 0, 0, 0 }, (Vector2){ 50, 50 }, BEIGE); // Simple world plane
106106

@@ -116,20 +116,20 @@ int main(void)
116116
// Draw a cube at each player's position
117117
DrawCube(cameraPlayer1.position, 1, 1, 1, RED);
118118
DrawCube(cameraPlayer2.position, 1, 1, 1, BLUE);
119-
119+
120120
EndMode3D();
121-
121+
122122
DrawRectangle(0, 0, GetScreenWidth()/2, 40, Fade(RAYWHITE, 0.8f));
123123
DrawText("PLAYER1: W/S to move", 10, 10, 20, MAROON);
124-
124+
125125
EndTextureMode();
126126

127127
// Draw Player2 view to the render texture
128128
BeginTextureMode(screenPlayer2);
129129
ClearBackground(SKYBLUE);
130-
130+
131131
BeginMode3D(cameraPlayer2);
132-
132+
133133
// Draw scene: grid of cube trees on a plane to make a "world"
134134
DrawPlane((Vector3){ 0, 0, 0 }, (Vector2){ 50, 50 }, BEIGE); // Simple world plane
135135

@@ -145,21 +145,21 @@ int main(void)
145145
// Draw a cube at each player's position
146146
DrawCube(cameraPlayer1.position, 1, 1, 1, RED);
147147
DrawCube(cameraPlayer2.position, 1, 1, 1, BLUE);
148-
148+
149149
EndMode3D();
150-
150+
151151
DrawRectangle(0, 0, GetScreenWidth()/2, 40, Fade(RAYWHITE, 0.8f));
152152
DrawText("PLAYER2: UP/DOWN to move", 10, 10, 20, DARKBLUE);
153-
153+
154154
EndTextureMode();
155155

156156
// Draw both views render textures to the screen side by side
157157
BeginDrawing();
158158
ClearBackground(BLACK);
159-
159+
160160
DrawTextureRec(screenPlayer1.texture, splitScreenRect, (Vector2){ 0, 0 }, WHITE);
161161
DrawTextureRec(screenPlayer2.texture, splitScreenRect, (Vector2){ screenWidth/2.0f, 0 }, WHITE);
162-
162+
163163
DrawRectangle(GetScreenWidth()/2 - 2, 0, 4, GetScreenHeight(), LIGHTGRAY);
164164
EndDrawing();
165165
}

0 commit comments

Comments
 (0)