aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorraysan5 <raysan5@gmail.com>2014-09-29 23:41:05 +0200
committerraysan5 <raysan5@gmail.com>2014-09-29 23:41:05 +0200
commit51688c004cb9b41cd573b7f84ce8574ca2a4b9d7 (patch)
tree1d8bf01ec8deb3acabb747182f2a1384cec2ec49
parente2ff32eb847f0332d546f51c442f336e0dc7b309 (diff)
downloadraylib-51688c004cb9b41cd573b7f84ce8574ca2a4b9d7.tar.gz
raylib-51688c004cb9b41cd573b7f84ce8574ca2a4b9d7.zip
Code cleaning, removed useless spaces
-rw-r--r--examples/audio_music_stream.c36
-rw-r--r--examples/audio_sound_loading.c22
-rw-r--r--examples/core_3d_mode.c20
-rw-r--r--examples/core_basic_window.c14
-rw-r--r--examples/core_color_select.c34
-rw-r--r--examples/core_input_gamepad.c22
-rw-r--r--examples/core_input_keys.c22
-rw-r--r--examples/core_input_mouse.c24
-rw-r--r--examples/core_mouse_wheel.c20
-rw-r--r--examples/core_random_values.c20
-rw-r--r--examples/models_billboard.c24
-rw-r--r--examples/models_cubesmap.c34
-rw-r--r--examples/models_geometric_shapes.c28
-rw-r--r--examples/models_heightmap.c28
-rw-r--r--examples/models_obj_loading.c24
-rw-r--r--examples/models_planes.c18
-rw-r--r--examples/shapes_basic_shapes.c24
-rw-r--r--examples/shapes_colors_palette.c22
-rw-r--r--examples/shapes_logo_raylib.c16
-rw-r--r--examples/shapes_logo_raylib_anim.c54
-rw-r--r--examples/text_font_select.c68
-rw-r--r--examples/text_format_text.c24
-rw-r--r--examples/text_rbmf_fonts.c28
-rw-r--r--examples/text_sprite_fonts.c30
-rw-r--r--examples/textures_compressed_dds.c24
-rw-r--r--examples/textures_image_loading.c20
-rw-r--r--examples/textures_logo_raylib.c24
-rw-r--r--examples/textures_mipmaps.c18
-rw-r--r--examples/textures_rectangle.c28
-rw-r--r--examples/textures_srcrec_dstrec.c20
30 files changed, 395 insertions, 395 deletions
diff --git a/examples/audio_music_stream.c b/examples/audio_music_stream.c
index 0d026506..5fd4a054 100644
--- a/examples/audio_music_stream.c
+++ b/examples/audio_music_stream.c
@@ -19,59 +19,59 @@ int main()
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
-
+
InitWindow(screenWidth, screenHeight, "raylib [audio] example - music playing (streaming)");
-
+
InitAudioDevice(); // Initialize audio device
-
+
PlayMusicStream("resources/audio/guitar_noodling.ogg"); // Play music stream
-
+
int framesCounter = 0;
float volume = 1.0;
float timePlayed = 0;
-
+
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
framesCounter++;
-
+
// Testing music fading from one file to another
/*
if (framesCounter > 600) // Wait for 10 seconds (600 frames)
{
volume -= 0.01; // Decrement music volume level
-
- // When music volume level equal or lower than 0,
+
+ // When music volume level equal or lower than 0,
// restore volume level and init another music file
- if (volume <= 0)
+ if (volume <= 0)
{
volume = 1.0;
framesCounter = 0;
PlayMusicStream("resources/audio/another_file.ogg");
}
-
+
SetMusicVolume(volume);
}
*/
timePlayed = GetMusicTimePlayed() / GetMusicTimeLength() * 100 * 4; // We scale by 4 to fit 400 pixels
//----------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
-
+
ClearBackground(RAYWHITE);
-
+
DrawText("MUSIC SHOULD BE PLAYING!", 255, 200, 20, LIGHTGRAY);
-
+
DrawRectangle(200, 250, 400, 12, LIGHTGRAY);
DrawRectangle(200, 250, (int)timePlayed, 12, MAROON);
-
+
EndDrawing();
//----------------------------------------------------------------------------------
}
@@ -79,9 +79,9 @@ int main()
// De-Initialization
//--------------------------------------------------------------------------------------
CloseAudioDevice(); // Close audio device (music streaming is automatically stopped)
-
+
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+
return 0;
} \ No newline at end of file
diff --git a/examples/audio_sound_loading.c b/examples/audio_sound_loading.c
index 68f8dca9..359af0af 100644
--- a/examples/audio_sound_loading.c
+++ b/examples/audio_sound_loading.c
@@ -19,15 +19,15 @@ int main()
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
-
+
InitWindow(screenWidth, screenHeight, "raylib [audio] example - sound loading and playing");
-
+
InitAudioDevice(); // Initialize audio device
-
+
Sound fxWav = LoadSound("resources/audio/weird.wav"); // Load WAV audio file
Sound fxOgg = LoadSound("resources/audio/tanatana.ogg"); // Load OGG audio file
//--------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
@@ -37,17 +37,17 @@ int main()
if (IsKeyPressed(KEY_ENTER)) PlaySound(fxOgg); // Play OGG sound
//----------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
-
+
ClearBackground(RAYWHITE);
-
+
DrawText("Press SPACE to PLAY the WAV sound!", 200, 180, 20, LIGHTGRAY);
DrawText("Press ENTER to PLAY the OGG sound!", 200, 220, 20, LIGHTGRAY);
-
+
EndDrawing();
//----------------------------------------------------------------------------------
}
@@ -56,11 +56,11 @@ int main()
//--------------------------------------------------------------------------------------
UnloadSound(fxWav); // Unload sound data
UnloadSound(fxOgg); // Unload sound data
-
+
CloseAudioDevice(); // Close audio device
-
+
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+
return 0;
} \ No newline at end of file
diff --git a/examples/core_3d_mode.c b/examples/core_3d_mode.c
index e62247f6..2275058d 100644
--- a/examples/core_3d_mode.c
+++ b/examples/core_3d_mode.c
@@ -27,7 +27,7 @@ int main()
//SetTargetFPS(60); // Set our game to run at 60 frames-per-second, but not now...
//--------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
@@ -35,26 +35,26 @@ int main()
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
-
+
ClearBackground(WHITE);
-
+
Begin3dMode(camera);
-
+
DrawCube(cubePosition, 2, 2, 2, RED);
DrawCubeWires(cubePosition, 2, 2, 2, MAROON);
DrawGrid(10.0, 1.0);
-
+
End3dMode();
-
+
DrawText("Welcome to the third dimension!", 10, 40, 20, DARKGRAY);
-
+
DrawFPS(10, 10);
-
+
EndDrawing();
//----------------------------------------------------------------------------------
}
@@ -63,6 +63,6 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+
return 0;
} \ No newline at end of file
diff --git a/examples/core_basic_window.c b/examples/core_basic_window.c
index 2feff985..505d8df4 100644
--- a/examples/core_basic_window.c
+++ b/examples/core_basic_window.c
@@ -17,10 +17,10 @@ int main()
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
-
+
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
//--------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
@@ -28,15 +28,15 @@ int main()
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
-
+
ClearBackground(RAYWHITE);
-
+
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
-
+
EndDrawing();
//----------------------------------------------------------------------------------
}
@@ -45,6 +45,6 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+
return 0;
} \ No newline at end of file
diff --git a/examples/core_color_select.c b/examples/core_color_select.c
index 6648a259..a2a79ed9 100644
--- a/examples/core_color_select.c
+++ b/examples/core_color_select.c
@@ -19,13 +19,13 @@ int main()
int screenHeight = 400;
InitWindow(screenWidth, screenHeight, "raylib [core] example - color selection (collision detection)");
-
+
Color colors[21] = { DARKGRAY, MAROON, ORANGE, DARKGREEN, DARKBLUE, DARKPURPLE, DARKBROWN,
GRAY, RED, GOLD, LIME, BLUE, VIOLET, BROWN, LIGHTGRAY, PINK, YELLOW,
GREEN, SKYBLUE, PURPLE, BEIGE };
-
+
Rectangle colorsRecs[21]; // Rectangles array
-
+
// Fills colorsRecs data (for every rectangle)
for (int i = 0; i < 21; i++)
{
@@ -34,43 +34,43 @@ int main()
colorsRecs[i].width = 100;
colorsRecs[i].height = 100;
}
-
+
bool selected[21] = { false }; // Selected rectangles indicator
-
+
Vector2 mousePoint;
-
+
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
mousePoint = GetMousePosition();
-
+
for (int i = 0; i < 21; i++) // Iterate along all the rectangles
{
if (CheckCollisionPointRec(mousePoint, colorsRecs[i]))
- {
+ {
colors[i].a = 120;
-
+
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) selected[i] = !selected[i];
}
else colors[i].a = 255;
}
//----------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
-
+
ClearBackground(RAYWHITE);
-
+
for (int i = 0; i < 21; i++) // Draw all rectangles
{
DrawRectangleRec(colorsRecs[i], colors[i]);
-
+
// Draw four rectangles around selected rectangle
if (selected[i])
{
@@ -80,15 +80,15 @@ int main()
DrawRectangle(colorsRecs[i].x, colorsRecs[i].y + 90, 100, 10, RAYWHITE); // Square bottom rectangle
}
}
-
+
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
- //--------------------------------------------------------------------------------------
+ //--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+
return 0;
} \ No newline at end of file
diff --git a/examples/core_input_gamepad.c b/examples/core_input_gamepad.c
index 9ce5b6ff..384ef989 100644
--- a/examples/core_input_gamepad.c
+++ b/examples/core_input_gamepad.c
@@ -20,15 +20,15 @@ int main()
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
-
+
InitWindow(screenWidth, screenHeight, "raylib [core] example - gamepad input");
-
+
Vector2 ballPosition = { screenWidth/2, screenHeight/2 };
Vector2 gamepadMovement = { 0, 0 };
SetTargetFPS(60); // Set target frames-per-second
//--------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
@@ -37,10 +37,10 @@ int main()
if (IsGamepadAvailable(GAMEPAD_PLAYER1))
{
gamepadMovement = GetGamepadMovement(GAMEPAD_PLAYER1);
-
+
ballPosition.x += gamepadMovement.x;
ballPosition.y -= gamepadMovement.y;
-
+
if (IsGamepadButtonPressed(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_A))
{
ballPosition.x = screenWidth/2;
@@ -48,17 +48,17 @@ int main()
}
}
//----------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
-
+
ClearBackground(RAYWHITE);
-
+
DrawText("move the ball with gamepad", 10, 10, 20, DARKGRAY);
-
+
DrawCircleV(ballPosition, 50, MAROON);
-
+
EndDrawing();
//----------------------------------------------------------------------------------
}
@@ -67,6 +67,6 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+
return 0;
} \ No newline at end of file
diff --git a/examples/core_input_keys.c b/examples/core_input_keys.c
index 086edd9f..442ae840 100644
--- a/examples/core_input_keys.c
+++ b/examples/core_input_keys.c
@@ -1,6 +1,6 @@
/*******************************************************************************************
*
-* raylib [core] example - Keyboard input
+* raylib [core] example - Keyboard input
*
* This example has been created using raylib 1.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
@@ -12,19 +12,19 @@
#include "raylib.h"
int main()
-{
+{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
-
+
InitWindow(screenWidth, screenHeight, "raylib [core] example - keyboard input");
- Vector2 ballPosition = { screenWidth/2, screenHeight/2 };
+ Vector2 ballPosition = { screenWidth/2, screenHeight/2 };
SetTargetFPS(60); // Set target frames-per-second
//--------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
@@ -35,17 +35,17 @@ int main()
if (IsKeyDown(KEY_UP)) ballPosition.y -= 0.8;
if (IsKeyDown(KEY_DOWN)) ballPosition.y += 0.8;
//----------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
-
+
ClearBackground(RAYWHITE);
-
+
DrawText("move the ball with arrow keys", 10, 10, 20, DARKGRAY);
-
+
DrawCircleV(ballPosition, 50, MAROON);
-
+
EndDrawing();
//----------------------------------------------------------------------------------
}
@@ -54,6 +54,6 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+
return 0;
} \ No newline at end of file
diff --git a/examples/core_input_mouse.c b/examples/core_input_mouse.c
index 419238ad..eeef8c7a 100644
--- a/examples/core_input_mouse.c
+++ b/examples/core_input_mouse.c
@@ -1,6 +1,6 @@
/*******************************************************************************************
*
-* raylib [core] example - Mouse input
+* raylib [core] example - Mouse input
*
* This example has been created using raylib 1.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
@@ -17,13 +17,13 @@ int main()
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
-
- InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse input");
-
+
+ InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse input");
+
int mouseX, mouseY;
Vector2 ballPosition = { -100.0, -100.0 };
//---------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
@@ -33,22 +33,22 @@ int main()
{
mouseX = GetMouseX();
mouseY = GetMouseY();
-
+
ballPosition.x = (float)mouseX;
ballPosition.y = (float)mouseY;
}
//----------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
-
+
ClearBackground(RAYWHITE);
-
+
DrawCircleV(ballPosition, 40, GOLD);
-
+
DrawText("mouse click to draw the ball", 10, 10, 20, DARKGRAY);
-
+
EndDrawing();
//----------------------------------------------------------------------------------
}
@@ -57,6 +57,6 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+
return 0;
} \ No newline at end of file
diff --git a/examples/core_mouse_wheel.c b/examples/core_mouse_wheel.c
index 11b43573..08c2ee1e 100644
--- a/examples/core_mouse_wheel.c
+++ b/examples/core_mouse_wheel.c
@@ -17,15 +17,15 @@ int main()
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
-
+
InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse wheel");
-
+
int boxPositionY = screenHeight/2 - 40;
int scrollSpeed = 4; // Scrolling speed in pixels
-
+
SetTargetFPS(60);
//--------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
@@ -33,16 +33,16 @@ int main()
//----------------------------------------------------------------------------------
boxPositionY -= (GetMouseWheelMove()*scrollSpeed);
//----------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
-
+
ClearBackground(RAYWHITE);
-
+
DrawRectangle(screenWidth/2 - 40, boxPositionY, 80, 80, MAROON);
-
- DrawText("Use mouse wheel to move the cube up and down!", 10, 10, 20, GRAY);
+
+ DrawText("Use mouse wheel to move the cube up and down!", 10, 10, 20, GRAY);
DrawText(FormatText("Box position Y: %03i", boxPositionY), 10, 40, 20, LIGHTGRAY);
EndDrawing();
@@ -53,6 +53,6 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+
return 0;
} \ No newline at end of file
diff --git a/examples/core_random_values.c b/examples/core_random_values.c
index 9cb10b8c..20989ee1 100644
--- a/examples/core_random_values.c
+++ b/examples/core_random_values.c
@@ -18,40 +18,40 @@ int main()
int screenWidth = 800;
int screenHeight = 450;
- InitWindow(screenWidth, screenHeight, "raylib [core] example - generate random values");
-
+ InitWindow(screenWidth, screenHeight, "raylib [core] example - generate random values");
+
int framesCounter = 0; // Variable used to count frames
int randValue = GetRandomValue(-8,5); // Get a random integer number between -8 and 5 (both included)
-
+
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
framesCounter++;
-
+
// Every two seconds (120 frames) a new random value is generated
if (((framesCounter/120)%2) == 1)
- {
+ {
randValue = GetRandomValue(-8,5);
framesCounter = 0;
}
//----------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
-
+
ClearBackground(RAYWHITE);
DrawText("Every 2 seconds a new random value is generated:", 130, 100, 20, MAROON);
DrawText(FormatText("%i", randValue), 360, 180, 80, LIGHTGRAY);
-
+
EndDrawing();
//----------------------------------------------------------------------------------
}
@@ -60,6 +60,6 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+
return 0;
} \ No newline at end of file
diff --git a/examples/models_billboard.c b/examples/models_billboard.c
index 19054c36..a58ec7d7 100644
--- a/examples/models_billboard.c
+++ b/examples/models_billboard.c
@@ -19,7 +19,7 @@ int main()
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [models] example - drawing billboards");
-
+
// Define the camera to look into our 3d world
Camera camera = {{ 10.0, 8.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
@@ -29,7 +29,7 @@ int main()
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
@@ -40,24 +40,24 @@ int main()
if (IsKeyDown(KEY_UP)) camera.position.y -= 0.2;
if (IsKeyDown(KEY_DOWN)) camera.position.y += 0.2;
//----------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
-
+
ClearBackground(RAYWHITE);
-
+
Begin3dMode(camera);
-
+
//DrawBillboard(camera, lena, billPosition, 1.0, WHITE);
DrawBillboardRec(camera, lena, eyesRec, billPosition, 4.0, WHITE);
-
+
DrawGrid(10.0, 1.0); // Draw a grid
-
+
End3dMode();
-
+
DrawFPS(10, 10);
-
+
EndDrawing();
//----------------------------------------------------------------------------------
}
@@ -65,9 +65,9 @@ int main()
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadTexture(lena); // Unload texture
-
+
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+
return 0;
} \ No newline at end of file
diff --git a/examples/models_cubesmap.c b/examples/models_cubesmap.c
index ff113483..580d67e6 100644
--- a/examples/models_cubesmap.c
+++ b/examples/models_cubesmap.c
@@ -19,10 +19,10 @@ int main()
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [models] example - cubesmap loading and drawing");
-
+
// Define the camera to look into our 3d world
Camera camera = {{ 7.0, 7.0, 7.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
-
+
Image img = LoadImage("resources/cubesmap.png"); // Load cubesmap image (RAM)
Texture2D texture = CreateTexture(img, false); // Convert image to texture (VRAM)
Model map = LoadCubesmap(img); // Load cubesmap model
@@ -30,10 +30,10 @@ int main()
Vector3 mapPosition = { -1, 0.0, -1 }; // Set model position
UnloadImage(img); // Unload cubesmap image from RAM, already uploaded to VRAM
-
+
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
@@ -41,29 +41,29 @@ int main()
//----------------------------------------------------------------------------------
if (IsKeyDown(KEY_UP)) camera.position.y += 0.2f;
else if (IsKeyDown(KEY_DOWN)) camera.position.y -= 0.2f;
-
+
if (IsKeyDown(KEY_RIGHT)) camera.position.z += 0.2f;
else if (IsKeyDown(KEY_LEFT)) camera.position.z -= 0.2f;
//----------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
-
+
ClearBackground(RAYWHITE);
-
+
Begin3dMode(camera);
-
+
DrawModel(map, mapPosition, 1.0f, MAROON);
-
+
DrawGrid(10.0, 1.0);
-
- DrawGizmo(mapPosition);
-
+
+ DrawGizmo(mapPosition);
+
End3dMode();
-
+
DrawFPS(10, 10);
-
+
EndDrawing();
//----------------------------------------------------------------------------------
}
@@ -72,9 +72,9 @@ int main()
//--------------------------------------------------------------------------------------
UnloadTexture(texture); // Unload texture
UnloadModel(map); // Unload model
-
+
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+
return 0;
} \ No newline at end of file
diff --git a/examples/models_geometric_shapes.c b/examples/models_geometric_shapes.c
index b5243fb1..3a649a3a 100644
--- a/examples/models_geometric_shapes.c
+++ b/examples/models_geometric_shapes.c
@@ -22,10 +22,10 @@ int main()
// Define the camera to look into our 3d world
Camera camera = {{ 0.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
-
+
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
@@ -33,35 +33,35 @@ int main()
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
-
+
ClearBackground(RAYWHITE);
-
+
Begin3dMode(camera);
-
+
DrawCube((Vector3){-4, 0, 2}, 2, 5, 2, RED);
DrawCubeWires((Vector3){-4, 0, 2}, 2, 5, 2, GOLD);
DrawCubeWires((Vector3){-4, 0, -2}, 3, 6, 2, MAROON);
-
- DrawSphere((Vector3){-1, 0, -2}, 1, GREEN);
+
+ DrawSphere((Vector3){-1, 0, -2}, 1, GREEN);
DrawSphereWires((Vector3){1, 0, 2}, 2, 16, 16, LIME);
-
+
DrawCylinder((Vector3){4, 0, -2}, 1, 2, 3, 4, SKYBLUE);
DrawCylinderWires((Vector3){4, 0, -2}, 1, 2, 3, 4, DARKBLUE);
DrawCylinderWires((Vector3){4.5, -1, 2}, 1, 1, 2, 6, BROWN);
-
+
DrawCylinder((Vector3){1, 0, -4}, 0, 1.5, 3, 8, GOLD);
DrawCylinderWires((Vector3){1, 0, -4}, 0, 1.5, 3, 8, PINK);
DrawGrid(10.0, 1.0); // Draw a grid
-
+
End3dMode();
-
+
DrawFPS(10, 10);
-
+
EndDrawing();
//----------------------------------------------------------------------------------
}
@@ -70,6 +70,6 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+
return 0;
} \ No newline at end of file
diff --git a/examples/models_heightmap.c b/examples/models_heightmap.c
index 644f9723..6e807b8c 100644
--- a/examples/models_heightmap.c
+++ b/examples/models_heightmap.c
@@ -30,10 +30,10 @@ int main()
Vector3 mapPosition = { -4, 0.0, -4 }; // Set model position
UnloadImage(img); // Unload heightmap image from RAM, already uploaded to VRAM
-
+
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
@@ -41,25 +41,25 @@ int main()
//----------------------------------------------------------------------------------
// ...
//----------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
-
+
ClearBackground(RAYWHITE);
-
+
Begin3dMode(camera);
-
+
DrawModel(map, mapPosition, 0.5f, MAROON);
-
+
DrawGrid(10.0, 1.0);
-
- DrawGizmo(mapPosition);
-
+
+ DrawGizmo(mapPosition);
+
End3dMode();
-
+
DrawFPS(10, 10);
-
+
EndDrawing();
//----------------------------------------------------------------------------------
}
@@ -68,9 +68,9 @@ int main()
//--------------------------------------------------------------------------------------
UnloadTexture(texture); // Unload texture
UnloadModel(map); // Unload model
-
+
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+
return 0;
} \ No newline at end of file
diff --git a/examples/models_obj_loading.c b/examples/models_obj_loading.c
index 3c2da62f..fd3b6959 100644
--- a/examples/models_obj_loading.c
+++ b/examples/models_obj_loading.c
@@ -28,9 +28,9 @@ int main()
SetModelTexture(&cat, texture); // Bind texture to model
Vector3 catPosition = { 0.0, 0.0, 0.0 }; // Set model position
- SetTargetFPS(60); // Set our game to run at 60 frames-per-second
+ SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
@@ -41,25 +41,25 @@ int main()
if (IsKeyDown(KEY_UP)) catPosition.z -= 0.2;
if (IsKeyDown(KEY_DOWN)) catPosition.z += 0.2;
//----------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
-
+
ClearBackground(RAYWHITE);
-
+
Begin3dMode(camera);
-
+
DrawModel(cat, catPosition, 0.1f, WHITE); // Draw 3d model with texture
DrawGrid(10.0, 1.0); // Draw a grid
-
+
DrawGizmo(catPosition); // Draw gizmo
-
+
End3dMode();
-
+
DrawFPS(10, 10);
-
+
EndDrawing();
//----------------------------------------------------------------------------------
}
@@ -68,9 +68,9 @@ int main()
//--------------------------------------------------------------------------------------
UnloadTexture(texture); // Unload texture
UnloadModel(cat); // Unload model
-
+
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+
return 0;
} \ No newline at end of file
diff --git a/examples/models_planes.c b/examples/models_planes.c
index 4ddded21..b0a6b878 100644
--- a/examples/models_planes.c
+++ b/examples/models_planes.c
@@ -25,7 +25,7 @@ int main()
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
@@ -33,24 +33,24 @@ int main()
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
-
+
ClearBackground(RAYWHITE);
-
+
Begin3dMode(camera);
-
+
DrawPlane((Vector3){ 0, 0, 0 }, (Vector2){ 4, 4 }, (Vector3){ 0, 45, 0 }, RED);
//DrawPlaneEx((Vector3){ 0, 8, 0 }, (Vector2){ 2, 1 }, (Vector3){ 0, 0, 0 }, 4, 4, SKYBLUE);
DrawGrid(10.0, 1.0);
-
+
End3dMode();
-
+
DrawFPS(10, 10);
-
+
EndDrawing();
//----------------------------------------------------------------------------------
}
@@ -59,6 +59,6 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+
return 0;
} \ No newline at end of file
diff --git a/examples/shapes_basic_shapes.c b/examples/shapes_basic_shapes.c
index 655f996b..4ae9f4df 100644
--- a/examples/shapes_basic_shapes.c
+++ b/examples/shapes_basic_shapes.c
@@ -20,7 +20,7 @@ int main()
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - basic shapes drawing");
//--------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
@@ -28,13 +28,13 @@ int main()
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
-
+
ClearBackground(RAYWHITE);
-
+
DrawText("some basic shapes available on raylib", 20, 20, 20, DARKGRAY);
DrawLine(18, 42, screenWidth - 18, 42, BLACK);
@@ -47,16 +47,16 @@ int main()
DrawRectangleGradient(screenWidth/4*2 - 90, 170, 180, 130, MAROON, GOLD);
DrawRectangleLines(screenWidth/4*2 - 40, 320, 80, 60, ORANGE);
- DrawTriangle((Vector2){screenWidth/4*3, 80},
- (Vector2){screenWidth/4*3 - 60, 150},
+ DrawTriangle((Vector2){screenWidth/4*3, 80},
+ (Vector2){screenWidth/4*3 - 60, 150},
(Vector2){screenWidth/4*3 + 60, 150}, VIOLET);
-
- DrawTriangleLines((Vector2){screenWidth/4*3, 160},
- (Vector2){screenWidth/4*3 - 20, 230},
+
+ DrawTriangleLines((Vector2){screenWidth/4*3, 160},
+ (Vector2){screenWidth/4*3 - 20, 230},
(Vector2){screenWidth/4*3 + 20, 230}, DARKBLUE);
-
+
DrawPoly((Vector2){screenWidth/4*3, 320}, 6, 80, 0, BROWN);
-
+
EndDrawing();
//----------------------------------------------------------------------------------
}
@@ -65,6 +65,6 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+
return 0;
} \ No newline at end of file
diff --git a/examples/shapes_colors_palette.c b/examples/shapes_colors_palette.c
index 2b98f909..926dcdf8 100644
--- a/examples/shapes_colors_palette.c
+++ b/examples/shapes_colors_palette.c
@@ -17,10 +17,10 @@ int main()
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
-
- InitWindow(screenWidth, screenHeight, "raylib [shapes] example - raylib colors palette");
+
+ InitWindow(screenWidth, screenHeight, "raylib [shapes] example - raylib color palette");
//--------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
@@ -28,15 +28,15 @@ int main()
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
-
+
ClearBackground(RAYWHITE);
-
+
DrawText("raylib color palette", 28, 42, 20, BLACK);
-
+
DrawRectangle(26, 80, 100, 100, DARKGRAY);
DrawRectangle(26, 188, 100, 100, GRAY);
DrawRectangle(26, 296, 100, 100, LIGHTGRAY);
@@ -59,7 +59,7 @@ int main()
DrawRectangle(674, 188, 100, 100, BROWN);
DrawRectangle(674, 296, 100, 100, BEIGE);
-
+
DrawText("DARKGRAY", 65, 166, 10, BLACK);
DrawText("GRAY", 93, 274, 10, BLACK);
DrawText("LIGHTGRAY", 61, 382, 10, BLACK);
@@ -81,7 +81,7 @@ int main()
DrawText("DARKBROWN", 705, 166, 10, BLACK);
DrawText("BROWN", 733, 274, 10, BLACK);
DrawText("BEIGE", 737, 382, 10, BLACK);
-
+
EndDrawing();
//----------------------------------------------------------------------------------
}
@@ -90,6 +90,6 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+
return 0;
-}
+} \ No newline at end of file
diff --git a/examples/shapes_logo_raylib.c b/examples/shapes_logo_raylib.c
index 669de4bd..a9e5104a 100644
--- a/examples/shapes_logo_raylib.c
+++ b/examples/shapes_logo_raylib.c
@@ -17,10 +17,10 @@ int main()
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
-
+
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - raylib logo using shapes");
//--------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
@@ -28,19 +28,19 @@ int main()
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
-
+
ClearBackground(RAYWHITE);
-
+
DrawRectangle(screenWidth/2 - 128, screenHeight/2 - 128, 256, 256, BLACK);
DrawRectangle(screenWidth/2 - 112, screenHeight/2 - 112, 224, 224, RAYWHITE);
DrawText("raylib", screenWidth/2 - 44, screenHeight/2 + 48, 50, BLACK);
-
+
DrawText("this is NOT a texture!", 350, 370, 10, GRAY);
-
+
EndDrawing();
//----------------------------------------------------------------------------------
}
@@ -49,6 +49,6 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+
return 0;
} \ No newline at end of file
diff --git a/examples/shapes_logo_raylib_anim.c b/examples/shapes_logo_raylib_anim.c
index 830787c8..cd3a4aa6 100644
--- a/examples/shapes_logo_raylib_anim.c
+++ b/examples/shapes_logo_raylib_anim.c
@@ -17,31 +17,31 @@ int main()
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
-
+
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - raylib logo animation");
-
+
int logoPositionX = screenWidth/2 - 128;
int logoPositionY = screenHeight/2 - 128;
-
+
int framesCounter = 0;
int lettersCount = 0;
-
+
int topSideRecWidth = 16;
int leftSideRecHeight = 16;
-
+
int bottomSideRecWidth = 16;
int rightSideRecHeight = 16;
-
+
char raylib[8] = " \0"; // raylib text array, max 8 letters
-
+
int state = 0; // Tracking animation states (State Machine)
float alpha = 1.0; // Useful for fading
-
+
SetTargetFPS(60);
//--------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
@@ -50,9 +50,9 @@ int main()
if (state == 0) // State 0: Small box blinking
{
framesCounter++;
-
+
if (framesCounter == 120)
- {
+ {
state = 1;
framesCounter = 0; // Reset counter... will be used later...
}
@@ -61,26 +61,26 @@ int main()
{
topSideRecWidth += 4;
leftSideRecHeight += 4;
-
+
if (topSideRecWidth == 256) state = 2;
}
else if (state == 2) // State 2: Bottom and right bars growing
{
bottomSideRecWidth += 4;
rightSideRecHeight += 4;
-
+
if (bottomSideRecWidth == 256) state = 3;
}
else if (state == 3) // State 3: Letters appearing (one by one)
{
framesCounter++;
-
+
if (framesCounter/12) // Every 12 frames, one more letter!
- {
+ {
lettersCount++;
framesCounter = 0;
}
-
+
switch (lettersCount)
{
case 1: raylib[0] = 'r'; break;
@@ -91,11 +91,11 @@ int main()
case 6: raylib[5] = 'b'; break;
default: break;
}
-
+
if (lettersCount >= 10) // When all letters have appeared, just fade out everything
{
alpha -= 0.02;
-
+
if (alpha <= 0)
{
alpha = 0;
@@ -109,13 +109,13 @@ int main()
{
framesCounter = 0;
lettersCount = 0;
-
+
topSideRecWidth = 16;
leftSideRecHeight = 16;
-
+
bottomSideRecWidth = 16;
rightSideRecHeight = 16;
-
+
for (int i = 0; i < 7; i++) raylib[i] = ' ';
raylib[7] = '\0'; // Last character is end-of-line
@@ -126,13 +126,13 @@ int main()
}
}
//----------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
-
+
ClearBackground(RAYWHITE);
-
+
if (state == 0)
{
if ((framesCounter/15)%2) DrawRectangle(logoPositionX, logoPositionY, 16, 16, BLACK);
@@ -146,7 +146,7 @@ int main()
{
DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, BLACK);
DrawRectangle(logoPositionX, logoPositionY, 16, leftSideRecHeight, BLACK);
-
+
DrawRectangle(logoPositionX + 240, logoPositionY, 16, rightSideRecHeight, BLACK);
DrawRectangle(logoPositionX, logoPositionY + 240, bottomSideRecWidth, 16, BLACK);
}
@@ -166,7 +166,7 @@ int main()
{
DrawText("[R] REPLAY", 340, 200, 20, GRAY);
}
-
+
EndDrawing();
//----------------------------------------------------------------------------------
}
@@ -175,6 +175,6 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+
return 0;
} \ No newline at end of file
diff --git a/examples/text_font_select.c b/examples/text_font_select.c
index 0ddda8ef..d6976b4f 100644
--- a/examples/text_font_select.c
+++ b/examples/text_font_select.c
@@ -19,10 +19,10 @@ int main()
int screenHeight = 150;
InitWindow(screenWidth, screenHeight, "raylib [text] example - font selector");
-
+
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
SpriteFont fonts[8]; // SpriteFont array
-
+
fonts[0] = LoadSpriteFont("resources/fonts/alagard.rbmf"); // SpriteFont loading
fonts[1] = LoadSpriteFont("resources/fonts/pixelplay.rbmf"); // SpriteFont loading
fonts[2] = LoadSpriteFont("resources/fonts/mecha.rbmf"); // SpriteFont loading
@@ -31,50 +31,50 @@ int main()
fonts[5] = LoadSpriteFont("resources/fonts/pixantiqua.rbmf"); // SpriteFont loading
fonts[6] = LoadSpriteFont("resources/fonts/alpha_beta.rbmf"); // SpriteFont loading
fonts[7] = LoadSpriteFont("resources/fonts/jupiter_crash.rbmf"); // SpriteFont loading
-
+
int currentFont = 0; // Selected font
-
+
Color colors[8] = { MAROON, ORANGE, DARKGREEN, DARKBLUE, DARKPURPLE, LIME, GOLD, RED };
-
- const char fontNames[8][20] = { "[0] Alagard", "[1] PixelPlay", "[2] MECHA", "[3] Setback",
+
+ const char fontNames[8][20] = { "[0] Alagard", "[1] PixelPlay", "[2] MECHA", "[3] Setback",
"[4] Romulus", "[5] PixAntiqua", "[6] Alpha Beta", "[7] Jupiter Crash" };
-
+
const char text[50] = "THIS is THE FONT you SELECTED!"; // Main text
-
+
Vector2 textSize = MeasureTextEx(fonts[currentFont], text, GetFontBaseSize(fonts[currentFont])*3, 1);
-
+
Vector2 mousePoint;
-
+
Rectangle btnNextRec = { 673, 18, 109, 44 }; // Button rectangle (useful for collision)
-
+
Color btnNextOutColor = DARKBLUE; // Button color (outside line)
Color btnNextInColor = SKYBLUE; // Button color (inside)
-
+
int framesCounter = 0; // Useful to count frames button is 'active' = clicked
-
+
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
-
+
// Keyboard-based font selection (easy)
if (IsKeyPressed(KEY_RIGHT))
{
if (currentFont < 7) currentFont++;
}
-
+
if (IsKeyPressed(KEY_LEFT))
{
if (currentFont > 0) currentFont--;
}
-
+
// Mouse-based font selection (NEXT button logic)
mousePoint = GetMousePosition();
-
+
if (CheckCollisionPointRec(mousePoint, btnNextRec))
{
// Mouse hover button logic
@@ -83,7 +83,7 @@ int main()
btnNextOutColor = DARKPURPLE;
btnNextInColor = PURPLE;
}
-
+
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
{
framesCounter = 20; // Frames button is 'active'
@@ -97,38 +97,38 @@ int main()
btnNextOutColor = DARKBLUE;
btnNextInColor = SKYBLUE;
}
-
+
if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON) && (framesCounter > 0)) framesCounter--;
-
+
if (framesCounter == 1) // We change font on frame 1
- {
+ {
currentFont++;
if (currentFont > 7) currentFont = 0;
}
-
+
// Text measurement for better positioning on screen
textSize = MeasureTextEx(fonts[currentFont], text, GetFontBaseSize(fonts[currentFont])*3, 1);
//----------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
-
+
ClearBackground(RAYWHITE);
-
+
DrawRectangle(18, 18, 644, 44, DARKGRAY);
DrawRectangle(20, 20, 640, 40, LIGHTGRAY);
DrawText(fontNames[currentFont], 30, 31, 20, BLACK);
DrawText("< >", 610, 26, 30, BLACK);
-
+
DrawRectangleRec(btnNextRec, btnNextOutColor);
DrawRectangle(675, 20, 105, 40, btnNextInColor);
DrawText("NEXT", 700, 31, 20, btnNextOutColor);
-
- DrawTextEx(fonts[currentFont], text, (Vector2){ screenWidth/2 - textSize.x/2,
- 75 + (70 - textSize.y)/2 }, GetFontBaseSize(fonts[currentFont])*3,
- 1, colors[currentFont]);
-
+
+ DrawTextEx(fonts[currentFont], text, (Vector2){ screenWidth/2 - textSize.x/2,
+ 75 + (70 - textSize.y)/2 }, GetFontBaseSize(fonts[currentFont])*3,
+ 1, colors[currentFont]);
+
EndDrawing();
//----------------------------------------------------------------------------------
}
@@ -136,9 +136,9 @@ int main()
// De-Initialization
//--------------------------------------------------------------------------------------
for (int i = 0; i < 8; i++) UnloadSpriteFont(fonts[i]); // SpriteFont(s) unloading
-
+
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+
return 0;
} \ No newline at end of file
diff --git a/examples/text_format_text.c b/examples/text_format_text.c
index b9034b46..516e3ecf 100644
--- a/examples/text_format_text.c
+++ b/examples/text_format_text.c
@@ -17,16 +17,16 @@ int main()
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
-
+
InitWindow(screenWidth, screenHeight, "raylib [text] example - text formatting");
-
+
int score = 100020;
int hiscore = 200450;
int lives = 5;
-
+
SetTargetFPS(60);
//--------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
@@ -34,21 +34,21 @@ int main()
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
-
+
ClearBackground(RAYWHITE);
-
+
DrawText(FormatText("Score: %08i", score), 200, 80, 20, RED);
-
+
DrawText(FormatText("HiScore: %08i", hiscore), 200, 120, 20, GREEN);
-
+
DrawText(FormatText("Lives: %02i", lives), 200, 160, 40, BLUE);
-
+
DrawText(FormatText("Elapsed Time: %02.02f ms", GetFrameTime()*1000), 200, 220, 20, BLACK);
-
+
EndDrawing();
//----------------------------------------------------------------------------------
}
@@ -57,6 +57,6 @@ int main()
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+
return 0;
} \ No newline at end of file
diff --git a/examples/text_rbmf_fonts.c b/examples/text_rbmf_fonts.c
index 788e27b8..02c77367 100644
--- a/examples/text_rbmf_fonts.c
+++ b/examples/text_rbmf_fonts.c
@@ -22,7 +22,7 @@ int main()
int screenHeight = 800;
InitWindow(screenWidth, screenHeight, "raylib [text] example - rBMF fonts");
-
+
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
SpriteFont font1 = LoadSpriteFont("resources/fonts/alagard.rbmf"); // rBMF font loading
SpriteFont font2 = LoadSpriteFont("resources/fonts/pixelplay.rbmf"); // rBMF font loading
@@ -33,7 +33,7 @@ int main()
SpriteFont font7 = LoadSpriteFont("resources/fonts/alpha_beta.rbmf"); // rBMF font loading
SpriteFont font8 = LoadSpriteFont("resources/fonts/jupiter_crash.rbmf"); // rBMF font loading
//--------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
@@ -41,22 +41,22 @@ int main()
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
-
+
ClearBackground(RAYWHITE);
-
+
DrawTextEx(font1, "TESTING ALAGARD FONT", (Vector2){ 100, 100 }, GetFontBaseSize(font1)*2, 2, MAROON);
- DrawTextEx(font2, "TESTING PIXELPLAY FONT", (Vector2){ 100, 180 }, GetFontBaseSize(font2)*2, 4, ORANGE);
- DrawTextEx(font3, "TESTING MECHA FONT", (Vector2){ 100, 260 }, GetFontBaseSize(font3)*2, 8, DARKGREEN);
- DrawTextEx(font4, "TESTING SETBACK FONT", (Vector2){ 100, 350 }, GetFontBaseSize(font4)*2, 4, DARKBLUE);
+ DrawTextEx(font2, "TESTING PIXELPLAY FONT", (Vector2){ 100, 180 }, GetFontBaseSize(font2)*2, 4, ORANGE);
+ DrawTextEx(font3, "TESTING MECHA FONT", (Vector2){ 100, 260 }, GetFontBaseSize(font3)*2, 8, DARKGREEN);
+ DrawTextEx(font4, "TESTING SETBACK FONT", (Vector2){ 100, 350 }, GetFontBaseSize(font4)*2, 4, DARKBLUE);
DrawTextEx(font5, "TESTING ROMULUS FONT", (Vector2){ 100, 430 }, GetFontBaseSize(font5)*2, 3, DARKPURPLE);
- DrawTextEx(font6, "TESTING PIXANTIQUA FONT", (Vector2){ 100, 510 }, GetFontBaseSize(font6)*2, 4, LIME);
- DrawTextEx(font7, "TESTING ALPHA_BETA FONT", (Vector2){ 100, 590 }, GetFontBaseSize(font7)*2, 4, GOLD);
- DrawTextEx(font8, "TESTING JUPITER_CRASH FONT", (Vector2){ 100, 660 }, GetFontBaseSize(font8)*2, 1, RED);
-
+ DrawTextEx(font6, "TESTING PIXANTIQUA FONT", (Vector2){ 100, 510 }, GetFontBaseSize(font6)*2, 4, LIME);
+ DrawTextEx(font7, "TESTING ALPHA_BETA FONT", (Vector2){ 100, 590 }, GetFontBaseSize(font7)*2, 4, GOLD);
+ DrawTextEx(font8, "TESTING JUPITER_CRASH FONT", (Vector2){ 100, 660 }, GetFontBaseSize(font8)*2, 1, RED);
+
EndDrawing();
//----------------------------------------------------------------------------------
}
@@ -71,9 +71,9 @@ int main()
UnloadSpriteFont(font6); // SpriteFont unloading
UnloadSpriteFont(font7); // SpriteFont unloading
UnloadSpriteFont(font8); // SpriteFont unloading
-
+
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+
return 0;
} \ No newline at end of file
diff --git a/examples/text_sprite_fonts.c b/examples/text_sprite_fonts.c
index 77273e4f..e27e8c08 100644
--- a/examples/text_sprite_fonts.c
+++ b/examples/text_sprite_fonts.c
@@ -19,7 +19,7 @@ int main()
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [text] example - sprite fonts usage");
-
+
const char msg1[50] = "THIS IS A custom SPRITE FONT...";
const char msg2[50] = "...and this is ANOTHER CUSTOM font...";
const char msg3[50] = "...and a THIRD one! GREAT! :D";
@@ -28,20 +28,20 @@ int main()
SpriteFont font1 = LoadSpriteFont("resources/fonts/custom_mecha.png"); // SpriteFont loading
SpriteFont font2 = LoadSpriteFont("resources/fonts/custom_alagard.png"); // SpriteFont loading
SpriteFont font3 = LoadSpriteFont("resources/fonts/custom_jupiter_crash.png"); // SpriteFont loading
-
+
Vector2 fontPosition1, fontPosition2, fontPosition3;
-
+
fontPosition1.x = screenWidth/2 - MeasureTextEx(font1, msg1, GetFontBaseSize(font1), -3).x/2;
fontPosition1.y = screenHeight/2 - GetFontBaseSize(font1)/2 - 80;
-
+
fontPosition2.x = screenWidth/2 - MeasureTextEx(font2, msg2, GetFontBaseSize(font2), -2).x/2;
fontPosition2.y = screenHeight/2 - GetFontBaseSize(font2)/2 - 10;
-
+
fontPosition3.x = screenWidth/2 - MeasureTextEx(font3, msg3, GetFontBaseSize(font3), 2).x/2;
fontPosition3.y = screenHeight/2 - GetFontBaseSize(font3)/2 + 50;
-
+
//--------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
@@ -49,17 +49,17 @@ int main()
//----------------------------------------------------------------------------------
// TODO: Update variables here...
//----------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
-
+
ClearBackground(RAYWHITE);
-
+
DrawTextEx(font1, msg1, fontPosition1, GetFontBaseSize(font1), -3, WHITE);
- DrawTextEx(font2, msg2, fontPosition2, GetFontBaseSize(font2), -2, WHITE);
- DrawTextEx(font3, msg3, fontPosition3, GetFontBaseSize(font3), 2, WHITE);
-
+ DrawTextEx(font2, msg2, fontPosition2, GetFontBaseSize(font2), -2, WHITE);
+ DrawTextEx(font3, msg3, fontPosition3, GetFontBaseSize(font3), 2, WHITE);
+
EndDrawing();
//----------------------------------------------------------------------------------
}
@@ -69,9 +69,9 @@ int main()
UnloadSpriteFont(font1); // SpriteFont unloading
UnloadSpriteFont(font2); // SpriteFont unloading
UnloadSpriteFont(font3); // SpriteFont unloading
-
+
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+
return 0;
} \ No newline at end of file
diff --git a/examples/textures_compressed_dds.c b/examples/textures_compressed_dds.c
index d1d59f21..d2ba58c8 100644
--- a/examples/textures_compressed_dds.c
+++ b/examples/textures_compressed_dds.c
@@ -2,7 +2,7 @@
*
* raylib [textures] example - DDS Texture loading and drawing (compressed and uncompressed)
*
-* NOTE: This example requires raylib OpenGL 3.3+ or ES2 versions for compressed texture,
+* NOTE: This example requires raylib OpenGL 3.3+ or ES2 versions for compressed texture,
* OpenGL 1.1 does not support compressed textures, only uncompressed version.
*
* This example has been created using raylib 1.2 (www.raylib.com)
@@ -15,21 +15,21 @@
#include "raylib.h"
int main()
-{
+{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [textures] example - DDS texture loading and drawing");
-
+
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
//Texture2D texture = LoadTexture("resources/raylib_logo.dds"); // Texture loading (compressed)
Texture2D texture = LoadTexture("resources/raylib_logo_uncompressed.dds"); // Texture loading (uncompressed)
-
+
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//---------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
@@ -37,18 +37,18 @@ int main()
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
-
+
ClearBackground(RAYWHITE);
-
+
DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2, WHITE);
-
+
DrawText("this may be a compressed texture!", 320, 370, 10, GRAY);
-
+
EndDrawing();
//----------------------------------------------------------------------------------
}
@@ -56,9 +56,9 @@ int main()
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadTexture(texture); // Texture unloading
-
+
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+
return 0;
} \ No newline at end of file
diff --git a/examples/textures_image_loading.c b/examples/textures_image_loading.c
index c2929d9c..179cf84c 100644
--- a/examples/textures_image_loading.c
+++ b/examples/textures_image_loading.c
@@ -14,14 +14,14 @@
#include "raylib.h"
int main()
-{
+{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [textures] example - image loading");
-
+
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
Image img = LoadImage("resources/raylib_logo.png"); // Loaded in CPU memory (RAM)
@@ -29,7 +29,7 @@ int main()
UnloadImage(img); // Once image has been converted to texture and uploaded to VRAM, it can be unloaded from RAM
//---------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
@@ -37,17 +37,17 @@ int main()
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
-
+
ClearBackground(RAYWHITE);
-
+
DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2, WHITE);
-
+
DrawText("this IS a texture loaded from an image!", 300, 370, 10, GRAY);
-
+
EndDrawing();
//----------------------------------------------------------------------------------
}
@@ -55,9 +55,9 @@ int main()
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadTexture(texture); // Texture unloading
-
+
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+
return 0;
} \ No newline at end of file
diff --git a/examples/textures_logo_raylib.c b/examples/textures_logo_raylib.c
index 23ee75ad..f4aeb738 100644
--- a/examples/textures_logo_raylib.c
+++ b/examples/textures_logo_raylib.c
@@ -1,6 +1,6 @@
/*******************************************************************************************
*
-* raylib [textures] example - Texture loading and drawing
+* raylib [textures] example - Texture loading and drawing
*
* This example has been created using raylib 1.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
@@ -12,18 +12,18 @@
#include "raylib.h"
int main()
-{
+{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [textures] example - texture loading and drawing");
-
+
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
Texture2D texture = LoadTexture("resources/raylib_logo.png"); // Texture loading
//---------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
@@ -31,18 +31,18 @@ int main()
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
-
+
ClearBackground(RAYWHITE);
-
- DrawTexture(texture, screenWidth/2 - texture.width/2,
+
+ DrawTexture(texture, screenWidth/2 - texture.width/2,
screenHeight/2 - texture.height/2, WHITE);
-
+
DrawText("this IS a texture!", 360, 370, 10, GRAY);
-
+
EndDrawing();
//----------------------------------------------------------------------------------
}
@@ -50,9 +50,9 @@ int main()
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadTexture(texture); // Texture unloading
-
+
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+
return 0;
} \ No newline at end of file
diff --git a/examples/textures_mipmaps.c b/examples/textures_mipmaps.c
index 889303a4..ee79f513 100644
--- a/examples/textures_mipmaps.c
+++ b/examples/textures_mipmaps.c
@@ -31,7 +31,7 @@ int main()
UnloadImage(image); // Once texture has been created, we can unload image data from RAM
//--------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
@@ -39,18 +39,18 @@ int main()
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
-
+
ClearBackground(RAYWHITE);
-
- DrawTexture(texture, screenWidth/2 - texture.width/2,
+
+ DrawTexture(texture, screenWidth/2 - texture.width/2,
screenHeight/2 - texture.height/2 - 30, WHITE);
-
+
DrawText("this IS a texture with mipmaps! really!", 210, 360, 20, GRAY);
-
+
EndDrawing();
//----------------------------------------------------------------------------------
}
@@ -58,9 +58,9 @@ int main()
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadTexture(texture); // Texture unloading
-
+
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+
return 0;
} \ No newline at end of file
diff --git a/examples/textures_rectangle.c b/examples/textures_rectangle.c
index 95caf0a4..c0fb0d97 100644
--- a/examples/textures_rectangle.c
+++ b/examples/textures_rectangle.c
@@ -1,6 +1,6 @@
/*******************************************************************************************
*
-* raylib [textures] example - Texture loading and drawing a part defined by a rectangle
+* raylib [textures] example - Texture loading and drawing a part defined by a rectangle
*
* This example has been created using raylib 1.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
@@ -19,18 +19,18 @@ int main()
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [texture] example - texture rectangle");
-
+
const char textLine1[] = "Lena image is a standard test image which has been in use since 1973.";
const char textLine2[] = "It comprises 512x512 pixels, and it is probably the most widely used";
const char textLine3[] = "test image for all sorts of image processing algorithms.";
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
Texture2D texture = LoadTexture("resources/lena.png"); // Texture loading
-
+
Rectangle eyesRec = { 225, 240, 155, 50 }; // Part of the texture to draw
Vector2 position = { 369, 241 };
//--------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
@@ -38,23 +38,23 @@ int main()
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
-
+
ClearBackground(RAYWHITE);
-
+
DrawText("LENA", 220, 100, 20, PINK);
-
+
DrawTexture(texture, screenWidth/2 - 256, 0, Fade(WHITE, 0.1f)); // Draw background image
-
+
DrawTextureRec(texture, eyesRec, position, WHITE); // Draw eyes part of image
DrawText(textLine1, 220, 140, 10, DARKGRAY);
- DrawText(textLine2, 220, 160, 10, DARKGRAY);
- DrawText(textLine3, 220, 180, 10, DARKGRAY);
-
+ DrawText(textLine2, 220, 160, 10, DARKGRAY);
+ DrawText(textLine3, 220, 180, 10, DARKGRAY);
+
EndDrawing();
//----------------------------------------------------------------------------------
}
@@ -62,9 +62,9 @@ int main()
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadTexture(texture); // Texture unloading
-
+
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+
return 0;
} \ No newline at end of file
diff --git a/examples/textures_srcrec_dstrec.c b/examples/textures_srcrec_dstrec.c
index 27d9610e..1f0b56e2 100644
--- a/examples/textures_srcrec_dstrec.c
+++ b/examples/textures_srcrec_dstrec.c
@@ -19,11 +19,11 @@ int main()
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [textures] examples - texture source and destination rectangles");
-
+
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
Texture2D texture = LoadTexture("resources/raylib_logo.png"); // Texture loading
- // NOTE: Source rectangle (part of the texture to use for drawing)
+ // NOTE: Source rectangle (part of the texture to use for drawing)
Rectangle sourceRec = { 128, 128, 128, 128 };
// NOTE: Destination rectangle (screen rectangle where drawing part of texture)
@@ -32,7 +32,7 @@ int main()
// NOTE: Origin of the texture in case of rotation, it's relative to destination rectangle size
Vector2 origin = { 128, 128 };
//--------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
@@ -40,19 +40,19 @@ int main()
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
-
+
ClearBackground(RAYWHITE);
-
+
// NOTE: Using DrawTexturePro() we can easily rotate and scale the part of the texture we draw
DrawTexturePro(texture, sourceRec, destRec, origin, 45, LIGHTGRAY);
-
+
DrawLine(destRec.x, 0, destRec.x, screenHeight, RED);
DrawLine(0, destRec.y, screenWidth, destRec.y, RED);
-
+
EndDrawing();
//----------------------------------------------------------------------------------
}
@@ -60,9 +60,9 @@ int main()
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadTexture(texture); // Texture unloading
-
+
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+
return 0;
} \ No newline at end of file