Skip to content

Commit bc44b67

Browse files
authored
Merge pull request #443 from AbubakrBardien/format-codebase
Format codebase
2 parents 3cd43b6 + 9938172 commit bc44b67

60 files changed

Lines changed: 1499 additions & 1270 deletions

Some content is hidden

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

‎.clang-format‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,4 @@ Standard: c++11
160160
---
161161
Language: JavaScript
162162
IndentWidth: 2
163-
ColumnLimit: 100
163+
ColumnLimit: 100

‎CPPLINT.cfg‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ exclude_files=vendor
55
exclude_files=docs
66
filter=-runtime/explicit
77
filter=-legal/copyright
8+
filter=-whitespace/newline

‎examples/audio/audio_music_stream.cpp‎

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/*******************************************************************************************
2-
*
3-
* raylib [audio] example - Music playing (streaming)
4-
*
5-
* This example has been created using raylib 1.3 (www.raylib.com)
6-
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
7-
*
8-
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
9-
*
10-
********************************************************************************************/
2+
*
3+
* raylib [audio] example - Music playing (streaming)
4+
*
5+
* This example has been created using raylib 1.3 (www.raylib.com)
6+
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
7+
*
8+
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
9+
*
10+
********************************************************************************************/
1111

1212
#include "raylib-cpp.hpp"
1313

@@ -19,7 +19,7 @@ int main() {
1919

2020
raylib::Window window(screenWidth, screenHeight, "raylib [audio] example - music playing (streaming)");
2121

22-
raylib::AudioDevice audio; // Initialize audio device
22+
raylib::AudioDevice audio; // Initialize audio device
2323

2424
raylib::Music music("resources/target.ogg");
2525

@@ -28,14 +28,14 @@ int main() {
2828
float timePlayed = 0.0f;
2929
bool pause = false;
3030

31-
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
31+
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
3232
//--------------------------------------------------------------------------------------
3333

3434
// Main game loop
35-
while (!window.ShouldClose()) { // Detect window close button or ESC key
35+
while (!window.ShouldClose()) { // Detect window close button or ESC key
3636
// Update
3737
//----------------------------------------------------------------------------------
38-
music.Update(); // Update music buffer with new stream data
38+
music.Update(); // Update music buffer with new stream data
3939

4040
// Restart music playing (stop and play)
4141
if (IsKeyPressed(KEY_SPACE)) {
@@ -49,7 +49,8 @@ int main() {
4949

5050
if (pause) {
5151
music.Pause();
52-
} else {
52+
}
53+
else {
5354
music.Resume();
5455
}
5556
}

‎examples/audio/audio_sound_loading.cpp‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/*******************************************************************************************
2-
*
3-
* raylib [audio] example - Sound loading and playing
4-
*
5-
* This example has been created using raylib 1.0 (www.raylib.com)
6-
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
7-
*
8-
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
9-
*
10-
********************************************************************************************/
2+
*
3+
* raylib [audio] example - Sound loading and playing
4+
*
5+
* This example has been created using raylib 1.0 (www.raylib.com)
6+
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
7+
*
8+
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
9+
*
10+
********************************************************************************************/
1111

1212
#include "raylib-cpp.hpp"
1313

@@ -19,20 +19,20 @@ int main() {
1919

2020
raylib::Window window(screenWidth, screenHeight, "raylib [audio] example - sound loading and playing");
2121

22-
raylib::AudioDevice audiodevice; // Initialize audio device
22+
raylib::AudioDevice audiodevice; // Initialize audio device
2323

24-
raylib::Sound fxWav("resources/sound.wav"); // Load WAV audio file
25-
raylib::Sound fxOgg("resources/target.ogg"); // Load OGG audio file
24+
raylib::Sound fxWav("resources/sound.wav"); // Load WAV audio file
25+
raylib::Sound fxOgg("resources/target.ogg"); // Load OGG audio file
2626

27-
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
27+
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
2828
//--------------------------------------------------------------------------------------
2929

3030
// Main game loop
31-
while (!window.ShouldClose()) { // Detect window close button or ESC key
31+
while (!window.ShouldClose()) { // Detect window close button or ESC key
3232
// Update
3333
//----------------------------------------------------------------------------------
34-
if (IsKeyPressed(KEY_SPACE)) fxWav.Play(); // Play WAV sound
35-
if (IsKeyPressed(KEY_ENTER)) fxOgg.Play(); // Play OGG sound
34+
if (IsKeyPressed(KEY_SPACE)) fxWav.Play(); // Play WAV sound
35+
if (IsKeyPressed(KEY_ENTER)) fxOgg.Play(); // Play OGG sound
3636
//----------------------------------------------------------------------------------
3737

3838
// Draw

‎examples/core/core_basic_window.cpp‎

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
/*******************************************************************************************
2-
*
3-
* raylib [core] example - Basic window
4-
*
5-
* Welcome to raylib!
6-
*
7-
* To test examples, just press F6 and execute raylib_compile_execute script
8-
* Note that compiled executable is placed in the same folder as .c file
9-
*
10-
* You can find all basic examples on C:\raylib\raylib\examples folder or
11-
* raylib official webpage: www.raylib.com
12-
*
13-
* Enjoy using raylib. :)
14-
*
15-
* This example has been created using raylib 1.0 (www.raylib.com)
16-
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
17-
*
18-
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
19-
*
20-
********************************************************************************************/
2+
*
3+
* raylib [core] example - Basic window
4+
*
5+
* Welcome to raylib!
6+
*
7+
* To test examples, just press F6 and execute raylib_compile_execute script
8+
* Note that compiled executable is placed in the same folder as .c file
9+
*
10+
* You can find all basic examples on C:\raylib\raylib\examples folder or
11+
* raylib official webpage: www.raylib.com
12+
*
13+
* Enjoy using raylib. :)
14+
*
15+
* This example has been created using raylib 1.0 (www.raylib.com)
16+
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
17+
*
18+
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
19+
*
20+
********************************************************************************************/
2121

2222
#include "raylib-cpp.hpp"
2323

@@ -33,7 +33,7 @@ int main() {
3333
//--------------------------------------------------------------------------------------
3434

3535
// Main game loop
36-
while (!window.ShouldClose()) { // Detect window close button or ESC key
36+
while (!window.ShouldClose()) { // Detect window close button or ESC key
3737
// Update
3838
//----------------------------------------------------------------------------------
3939
// Update your variables here

‎examples/core/core_basic_window_web.cpp‎

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
/*******************************************************************************************
2-
*
3-
* raylib-cpp [core] example - Basic window (adapted for HTML5 platform)
4-
*
5-
* This example is prepared to compile for PLATFORM_WEB, PLATFORM_DESKTOP and PLATFORM_RPI
6-
* As you will notice, code structure is slightly diferent to the other examples...
7-
* To compile it for PLATFORM_WEB just uncomment #define PLATFORM_WEB at beginning
8-
*
9-
* This example has been created using raylib 1.3 (www.raylib.com)
10-
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
11-
*
12-
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
13-
*
14-
********************************************************************************************/
2+
*
3+
* raylib-cpp [core] example - Basic window (adapted for HTML5 platform)
4+
*
5+
* This example is prepared to compile for PLATFORM_WEB, PLATFORM_DESKTOP and PLATFORM_RPI
6+
* As you will notice, code structure is slightly diferent to the other examples...
7+
* To compile it for PLATFORM_WEB just uncomment #define PLATFORM_WEB at beginning
8+
*
9+
* This example has been created using raylib 1.3 (www.raylib.com)
10+
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
11+
*
12+
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
13+
*
14+
********************************************************************************************/
1515

1616
#include "raylib-cpp.hpp"
1717

1818
#if defined(PLATFORM_WEB)
19-
#include <emscripten/emscripten.h>
19+
#include <emscripten/emscripten.h>
2020
#endif
2121

2222
//----------------------------------------------------------------------------------
@@ -28,25 +28,24 @@ int screenHeight = 450;
2828
//----------------------------------------------------------------------------------
2929
// Module Functions Declaration
3030
//----------------------------------------------------------------------------------
31-
void UpdateDrawFrame(void); // Update and Draw one frame
31+
void UpdateDrawFrame(void); // Update and Draw one frame
3232

3333
//----------------------------------------------------------------------------------
3434
// Main Enry Point
3535
//----------------------------------------------------------------------------------
36-
int main()
37-
{
36+
int main() {
3837
// Initialization
3938
//--------------------------------------------------------------------------------------
4039
raylib::Window window(screenWidth, screenHeight, "raylib-cpp [core] example - basic window");
4140

4241
#if defined(PLATFORM_WEB)
4342
emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
4443
#else
45-
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
44+
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
4645
//--------------------------------------------------------------------------------------
4746

4847
// Main game loop
49-
while (!window.ShouldClose()) // Detect window close button or ESC key
48+
while (!window.ShouldClose()) // Detect window close button or ESC key
5049
{
5150
UpdateDrawFrame();
5251
}
@@ -58,8 +57,7 @@ int main()
5857
//----------------------------------------------------------------------------------
5958
// Module Functions Definition
6059
//----------------------------------------------------------------------------------
61-
void UpdateDrawFrame(void)
62-
{
60+
void UpdateDrawFrame(void) {
6361
// Update
6462
//----------------------------------------------------------------------------------
6563
// TODO: Update your variables here
@@ -69,9 +67,9 @@ void UpdateDrawFrame(void)
6967
//----------------------------------------------------------------------------------
7068
BeginDrawing();
7169

72-
ClearBackground(RAYWHITE);
70+
ClearBackground(RAYWHITE);
7371

74-
raylib::DrawText("Congrats! You created your first raylib-cpp window!", 190, 200, 20, LIGHTGRAY);
72+
raylib::DrawText("Congrats! You created your first raylib-cpp window!", 190, 200, 20, LIGHTGRAY);
7573

7674
EndDrawing();
7775
//----------------------------------------------------------------------------------

‎examples/core/core_drop_files.cpp‎

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
/*******************************************************************************************
2-
*
3-
* raylib [core] example - Windows drop files
4-
*
5-
* This example only works on platforms that support drag & drop (Windows, Linux, OSX, Html5?)
6-
*
7-
* This example has been created using raylib-cpp (www.raylib.com)
8-
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
9-
*
10-
* Copyright (c) 2020 Rob Loach (@RobLoach)
11-
*
12-
********************************************************************************************/
2+
*
3+
* raylib [core] example - Windows drop files
4+
*
5+
* This example only works on platforms that support drag & drop (Windows, Linux, OSX, Html5?)
6+
*
7+
* This example has been created using raylib-cpp (www.raylib.com)
8+
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
9+
*
10+
* Copyright (c) 2020 Rob Loach (@RobLoach)
11+
*
12+
********************************************************************************************/
1313

1414
#include "raylib-cpp.hpp"
1515

@@ -23,11 +23,11 @@ int main() {
2323

2424
std::vector<std::string> droppedFiles;
2525

26-
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
26+
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
2727
//--------------------------------------------------------------------------------------
2828

2929
// Main game loop
30-
while (!window.ShouldClose()) { // Detect window close button or ESC key
30+
while (!window.ShouldClose()) { // Detect window close button or ESC key
3131
// Update
3232
//----------------------------------------------------------------------------------
3333
if (IsFileDropped()) {
@@ -44,15 +44,16 @@ int main() {
4444
// Check if there are files to process.
4545
if (droppedFiles.empty()) {
4646
raylib::DrawText("Drop your files to this window!", 100, 40, 20, DARKGRAY);
47-
} else {
47+
}
48+
else {
4849
raylib::DrawText("Dropped files:", 100, 40, 20, DARKGRAY);
4950

5051
// Iterate through all the dropped files.
5152
for (int i = 0; i < (int)droppedFiles.size(); i++) {
5253
if (i % 2 == 0)
53-
DrawRectangle(0, 85 + 40*i, screenWidth, 40, Fade(LIGHTGRAY, 0.5f));
54+
DrawRectangle(0, 85 + 40 * i, screenWidth, 40, Fade(LIGHTGRAY, 0.5f));
5455
else
55-
DrawRectangle(0, 85 + 40*i, screenWidth, 40, Fade(LIGHTGRAY, 0.3f));
56+
DrawRectangle(0, 85 + 40 * i, screenWidth, 40, Fade(LIGHTGRAY, 0.3f));
5657

5758
// Display the path to the dropped file.
5859
raylib::DrawText(droppedFiles[i].c_str(), 120, 100 + 40 * i, 10, GRAY);

‎examples/core/core_input_mouse.cpp‎

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/*******************************************************************************************
2-
*
3-
* raylib [core] example - Mouse input
4-
*
5-
* This example has been created using raylib 1.0 (www.raylib.com)
6-
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
7-
*
8-
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
9-
*
10-
********************************************************************************************/
2+
*
3+
* raylib [core] example - Mouse input
4+
*
5+
* This example has been created using raylib 1.0 (www.raylib.com)
6+
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
7+
*
8+
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
9+
*
10+
********************************************************************************************/
1111

1212
#include "raylib-cpp.hpp"
1313

@@ -23,18 +23,21 @@ int main() {
2323
raylib::Color ballColor = raylib::Color::DarkBlue();
2424
raylib::Color textColor = raylib::Color::DarkGray();
2525

26-
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
26+
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
2727
//---------------------------------------------------------------------------------------
2828

2929
// Main game loop
30-
while (!window.ShouldClose()) { // Detect window close button or ESC key
30+
while (!window.ShouldClose()) { // Detect window close button or ESC key
3131
// Update
3232
//----------------------------------------------------------------------------------
3333
ballPosition = GetMousePosition();
3434

35-
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) ballColor = MAROON;
36-
else if (IsMouseButtonPressed(MOUSE_MIDDLE_BUTTON)) ballColor = LIME;
37-
else if (IsMouseButtonPressed(MOUSE_RIGHT_BUTTON)) ballColor = DARKBLUE;
35+
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
36+
ballColor = MAROON;
37+
else if (IsMouseButtonPressed(MOUSE_MIDDLE_BUTTON))
38+
ballColor = LIME;
39+
else if (IsMouseButtonPressed(MOUSE_RIGHT_BUTTON))
40+
ballColor = DARKBLUE;
3841
//----------------------------------------------------------------------------------
3942

4043
// Draw

0 commit comments

Comments
 (0)