aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorraysan5 <raysan5@gmail.com>2013-11-28 19:59:56 +0100
committerraysan5 <raysan5@gmail.com>2013-11-28 19:59:56 +0100
commite9143b8a8d2eb439b01b94c00518db2b59ffb1e7 (patch)
tree8539603494a773f852721da1d6f7b19bca0d8f64 /examples
parent818e79638b5ff14fdae9f6a162e596bf119f82c5 (diff)
downloadraylib-e9143b8a8d2eb439b01b94c00518db2b59ffb1e7.tar.gz
raylib-e9143b8a8d2eb439b01b94c00518db2b59ffb1e7.zip
Added some functions and Updated examples
View CHANGELOG for details
Diffstat (limited to 'examples')
-rw-r--r--examples/ex01_basic_window.c20
-rw-r--r--examples/ex01_basic_window.exebin316491 -> 318993 bytes
-rw-r--r--examples/ex02a_logo_raylib.c22
-rw-r--r--examples/ex02a_logo_raylib.exebin321924 -> 324426 bytes
-rw-r--r--examples/ex02b_basic_shapes.c20
-rw-r--r--examples/ex02c_color_palette.c62
-rw-r--r--examples/ex02c_color_palette.exebin325510 -> 327500 bytes
-rw-r--r--examples/ex02c_color_palette.pngbin18166 -> 5230 bytes
-rw-r--r--examples/ex03a_input_keys.c24
-rw-r--r--examples/ex03a_input_keys.exebin322416 -> 324918 bytes
-rw-r--r--examples/ex03b_input_mouse.c20
-rw-r--r--examples/ex03b_input_mouse.exebin321924 -> 324426 bytes
-rw-r--r--examples/ex03c_input_gamepad.c22
-rw-r--r--examples/ex03c_input_gamepad.exebin321926 -> 324428 bytes
-rw-r--r--examples/ex04a_textures.c24
-rw-r--r--examples/ex04a_textures.exebin316471 -> 318973 bytes
-rw-r--r--examples/ex04b_texture_rectangle.c20
-rw-r--r--examples/ex05a_sprite_fonts.c20
-rw-r--r--examples/ex05b_rbmf_fonts.c20
-rw-r--r--examples/ex06a_color_select.c18
-rw-r--r--examples/ex06b_shape_select.c20
-rw-r--r--examples/ex06c_font_select.c20
-rw-r--r--examples/ex07a_3d_mode.c50
-rw-r--r--examples/ex07a_3d_mode.exebin337783 -> 339228 bytes
-rw-r--r--examples/ex07b_3d_shapes.c52
-rw-r--r--examples/ex07c_3d_models.c60
-rw-r--r--examples/ex07c_3d_models.exebin337750 -> 339740 bytes
-rw-r--r--examples/ex08_audio.c44
28 files changed, 374 insertions, 164 deletions
diff --git a/examples/ex01_basic_window.c b/examples/ex01_basic_window.c
index 9189b296..3bb94f3f 100644
--- a/examples/ex01_basic_window.c
+++ b/examples/ex01_basic_window.c
@@ -13,38 +13,38 @@
int main()
{
+ // Initialization
+ //--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
- // Initialization
- //---------------------------------------------------------
InitWindow(screenWidth, screenHeight, "raylib example 01a - basic window");
- //----------------------------------------------------------
+ //--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
// TODO: Update your variables here
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
// Draw
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
- DrawText("Congrats! You created your first window!", 190, 200, 20, 1, LIGHTGRAY);
+ DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
EndDrawing();
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
}
// De-Initialization
- //---------------------------------------------------------
+ //--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
- //----------------------------------------------------------
+ //--------------------------------------------------------------------------------------
return 0;
} \ No newline at end of file
diff --git a/examples/ex01_basic_window.exe b/examples/ex01_basic_window.exe
index 03686445..6e09e6e5 100644
--- a/examples/ex01_basic_window.exe
+++ b/examples/ex01_basic_window.exe
Binary files differ
diff --git a/examples/ex02a_logo_raylib.c b/examples/ex02a_logo_raylib.c
index fb2933f9..c43b682e 100644
--- a/examples/ex02a_logo_raylib.c
+++ b/examples/ex02a_logo_raylib.c
@@ -13,42 +13,42 @@
int main()
{
+ // Initialization
+ //--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
- // Initialization
- //---------------------------------------------------------
InitWindow(screenWidth, screenHeight, "raylib example 02a - raylib logo");
- //----------------------------------------------------------
+ //--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
// 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", 356, 273, 50, 1, BLACK);
+ DrawText("raylib", 356, 273, 50, BLACK);
- DrawText("this is NOT a texture!", 350, 370, 10, 1, GRAY);
+ DrawText("this is NOT a texture!", 350, 370, 10, GRAY);
EndDrawing();
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
}
// De-Initialization
- //---------------------------------------------------------
+ //--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
- //----------------------------------------------------------
+ //--------------------------------------------------------------------------------------
return 0;
} \ No newline at end of file
diff --git a/examples/ex02a_logo_raylib.exe b/examples/ex02a_logo_raylib.exe
index d40c04a4..c0b7871a 100644
--- a/examples/ex02a_logo_raylib.exe
+++ b/examples/ex02a_logo_raylib.exe
Binary files differ
diff --git a/examples/ex02b_basic_shapes.c b/examples/ex02b_basic_shapes.c
index add39df4..ce16d4c8 100644
--- a/examples/ex02b_basic_shapes.c
+++ b/examples/ex02b_basic_shapes.c
@@ -13,24 +13,24 @@
int main()
{
+ // Initialization
+ //--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
-
- // Initialization
- //---------------------------------------------------------
+
InitWindow(screenWidth, screenHeight, "raylib example 02b - basic shapes drawing");
- //----------------------------------------------------------
+ //--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
// TODO: Update your variables here
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
// Draw
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
@@ -61,13 +61,13 @@ void DrawPolyLine(Vector2 *points, int numPoints, Color color);
DrawText("_____", 320, 280, 50, 1, BLACK);
EndDrawing();
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
}
// De-Initialization
- //---------------------------------------------------------
+ //--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
- //----------------------------------------------------------
+ //--------------------------------------------------------------------------------------
return 0;
} \ No newline at end of file
diff --git a/examples/ex02c_color_palette.c b/examples/ex02c_color_palette.c
index 3e69abe3..bd5dd0c6 100644
--- a/examples/ex02c_color_palette.c
+++ b/examples/ex02c_color_palette.c
@@ -13,29 +13,29 @@
int main()
{
+ // Initialization
+ //--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
- // Initialization
- //---------------------------------------------------------
InitWindow(screenWidth, screenHeight, "raylib example 02c - raylib color palette");
- //----------------------------------------------------------
+ //--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
// TODO: Update your variables here
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
// Draw
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
- DrawText("raylib color palette", 28, 42, 20, 2, BLACK);
+ DrawText("raylib color palette", 28, 42, 20, BLACK);
DrawRectangle(26, 80, 100, 100, DARKGRAY);
DrawRectangle(26, 188, 100, 100, GRAY);
@@ -60,36 +60,36 @@ int main()
DrawRectangle(674, 296, 100, 100, BEIGE);
- DrawText("DARKGRAY", 57, 166, 10, 2, BLACK);
- DrawText("GRAY", 89, 274, 10, 2, BLACK);
- DrawText("LIGHTGRAY", 51, 382, 10, 2, BLACK);
- DrawText("MAROON", 180, 166, 10, 2, BLACK);
- DrawText("RED", 207, 274, 10, 2, BLACK);
- DrawText("PINK", 200, 382, 10, 2, BLACK);
- DrawText("ORANGE", 290, 166, 10, 2, BLACK);
- DrawText("GOLD", 306, 274, 10, 2, BLACK);
- DrawText("YELLOW", 290, 382, 10, 2, BLACK);
- DrawText("DARKGREEN", 374, 166, 10, 2, BLACK);
- DrawText("LIME", 417, 274, 10, 2, BLACK);
- DrawText("GREEN", 407, 382, 10, 2, BLACK);
- DrawText("DARKBLUE", 491, 166, 10, 2, BLACK);
- DrawText("BLUE", 523, 274, 10, 2, BLACK);
- DrawText("SKYBLUE", 499, 382, 10, 2, BLACK);
- DrawText("DARKPURPLE", 582, 166, 10, 2, BLACK);
- DrawText("VIOLET", 617, 274, 10, 2, BLACK);
- DrawText("PURPLE", 615, 382, 10, 2, BLACK);
- DrawText("DARKBROWN", 695, 166, 10, 2, BLACK);
- DrawText("BROWN", 728, 274, 10, 2, BLACK);
- DrawText("BEIGE", 733, 382, 10, 2, BLACK);
+ DrawText("DARKGRAY", 65, 166, 10, BLACK);
+ DrawText("GRAY", 93, 274, 10, BLACK);
+ DrawText("LIGHTGRAY", 61, 382, 10, BLACK);
+ DrawText("MAROON", 186, 166, 10, BLACK);
+ DrawText("RED", 208, 274, 10, BLACK);
+ DrawText("PINK", 204, 382, 10, BLACK);
+ DrawText("ORANGE", 295, 166, 10, BLACK);
+ DrawText("GOLD", 310, 274, 10, BLACK);
+ DrawText("YELLOW", 300, 382, 10, BLACK);
+ DrawText("DARKGREEN", 382, 166, 10, BLACK);
+ DrawText("LIME", 420, 274, 10, BLACK);
+ DrawText("GREEN", 410, 382, 10, BLACK);
+ DrawText("DARKBLUE", 498, 166, 10, BLACK);
+ DrawText("BLUE", 526, 274, 10, BLACK);
+ DrawText("SKYBLUE", 505, 382, 10, BLACK);
+ DrawText("DARKPURPLE", 592, 166, 10, BLACK);
+ DrawText("VIOLET", 621, 274, 10, BLACK);
+ DrawText("PURPLE", 620, 382, 10, BLACK);
+ DrawText("DARKBROWN", 705, 166, 10, BLACK);
+ DrawText("BROWN", 733, 274, 10, BLACK);
+ DrawText("BEIGE", 737, 382, 10, BLACK);
EndDrawing();
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
}
// De-Initialization
- //---------------------------------------------------------
+ //--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
- //----------------------------------------------------------
+ //--------------------------------------------------------------------------------------
return 0;
} \ No newline at end of file
diff --git a/examples/ex02c_color_palette.exe b/examples/ex02c_color_palette.exe
index 537d32d7..c7582ec7 100644
--- a/examples/ex02c_color_palette.exe
+++ b/examples/ex02c_color_palette.exe
Binary files differ
diff --git a/examples/ex02c_color_palette.png b/examples/ex02c_color_palette.png
index 04583e9a..dd3cf4a5 100644
--- a/examples/ex02c_color_palette.png
+++ b/examples/ex02c_color_palette.png
Binary files differ
diff --git a/examples/ex03a_input_keys.c b/examples/ex03a_input_keys.c
index da7d2123..0de39425 100644
--- a/examples/ex03a_input_keys.c
+++ b/examples/ex03a_input_keys.c
@@ -12,46 +12,48 @@
#include "raylib.h"
int main()
-{
+{
+ // Initialization
+ //--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
Vector2 ballPosition = { screenWidth/2, screenHeight/2 };
- // Initialization
- //---------------------------------------------------------
InitWindow(screenWidth, screenHeight, "raylib example 05 - keyboard input");
- //----------------------------------------------------------
+
+ SetTargetFPS(60); // Set target frames-per-second
+ //--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
if (IsKeyPressed(KEY_RIGHT)) ballPosition.x += 0.8;
if (IsKeyPressed(KEY_LEFT)) ballPosition.x -= 0.8;
if (IsKeyPressed(KEY_UP)) ballPosition.y -= 0.8;
if (IsKeyPressed(KEY_DOWN)) ballPosition.y += 0.8;
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
// Draw
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
- DrawText("move the ball with arrow keys", 10, 10, 20, 1, DARKGRAY);
+ DrawText("move the ball with arrow keys", 10, 10, 20, DARKGRAY);
DrawCircleV(ballPosition, 50, MAROON);
EndDrawing();
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
}
// De-Initialization
- //---------------------------------------------------------
+ //--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
- //----------------------------------------------------------
+ //--------------------------------------------------------------------------------------
return 0;
} \ No newline at end of file
diff --git a/examples/ex03a_input_keys.exe b/examples/ex03a_input_keys.exe
index f686dcd9..96c915fc 100644
--- a/examples/ex03a_input_keys.exe
+++ b/examples/ex03a_input_keys.exe
Binary files differ
diff --git a/examples/ex03b_input_mouse.c b/examples/ex03b_input_mouse.c
index db713fac..690c4c4b 100644
--- a/examples/ex03b_input_mouse.c
+++ b/examples/ex03b_input_mouse.c
@@ -13,6 +13,8 @@
int main()
{
+ // Initialization
+ //--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
@@ -20,16 +22,14 @@ int main()
int counter = 0;
int mouseX, mouseY;
- // Initialization
- //---------------------------------------------------------
InitWindow(screenWidth, screenHeight, "raylib example 06 - mouse input");
- //----------------------------------------------------------
+ //---------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
{
mouseX = GetMouseX();
@@ -38,26 +38,26 @@ int main()
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, 1, DARKGRAY);
+ DrawText("mouse click to draw the ball", 10, 10, 20, DARKGRAY);
EndDrawing();
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
}
// De-Initialization
- //---------------------------------------------------------
+ //--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
- //----------------------------------------------------------
+ //--------------------------------------------------------------------------------------
return 0;
} \ No newline at end of file
diff --git a/examples/ex03b_input_mouse.exe b/examples/ex03b_input_mouse.exe
index 6ec28c3a..2910fe9b 100644
--- a/examples/ex03b_input_mouse.exe
+++ b/examples/ex03b_input_mouse.exe
Binary files differ
diff --git a/examples/ex03c_input_gamepad.c b/examples/ex03c_input_gamepad.c
index b770b0ca..d948396b 100644
--- a/examples/ex03c_input_gamepad.c
+++ b/examples/ex03c_input_gamepad.c
@@ -13,22 +13,24 @@
int main()
{
+ // Initialization
+ //--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
Vector2 ballPosition = { screenWidth/2, screenHeight/2 };
Vector2 gamepadMove = { 0, 0 };
- // Initialization
- //---------------------------------------------------------
InitWindow(screenWidth, screenHeight, "raylib example 01 - gamepad input");
- //----------------------------------------------------------
+
+ SetTargetFPS(60); // Set target frames-per-second
+ //--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
if (IsGamepadAvailable(GAMEPAD_PLAYER1))
{
gamepadMove = GetGamepadMovement(GAMEPAD_PLAYER1);
@@ -42,26 +44,26 @@ int main()
ballPosition.y = screenHeight/2;
}
}
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
// Draw
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
- DrawText("move the ball with gamepad", 10, 10, 20, 1, DARKGRAY);
+ DrawText("move the ball with gamepad", 10, 10, 20, DARKGRAY);
DrawCircleV(ballPosition, 50, MAROON);
EndDrawing();
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
}
// De-Initialization
- //---------------------------------------------------------
+ //--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
- //----------------------------------------------------------
+ //--------------------------------------------------------------------------------------
return 0;
} \ No newline at end of file
diff --git a/examples/ex03c_input_gamepad.exe b/examples/ex03c_input_gamepad.exe
index 5f475ac2..440016a7 100644
--- a/examples/ex03c_input_gamepad.exe
+++ b/examples/ex03c_input_gamepad.exe
Binary files differ
diff --git a/examples/ex04a_textures.c b/examples/ex04a_textures.c
index 3a751322..4073f93e 100644
--- a/examples/ex04a_textures.c
+++ b/examples/ex04a_textures.c
@@ -12,28 +12,28 @@
#include "raylib.h"
int main()
-{
+{
+ // Initialization
+ //--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
-
- // Initialization
- //---------------------------------------------------------
+
InitWindow(screenWidth, screenHeight, "raylib example 04a - 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
{
// Update
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
// TODO: Update your variables here
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
// Draw
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
@@ -41,18 +41,18 @@ int main()
DrawTexture(texture, screenWidth/2 - texture.width/2,
screenHeight/2 - texture.height/2, WHITE);
- DrawText("this IS a texture!", 360, 370, 10, 1, GRAY);
+ DrawText("this IS a texture!", 360, 370, 10, GRAY);
EndDrawing();
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
}
// De-Initialization
- //---------------------------------------------------------
+ //--------------------------------------------------------------------------------------
UnloadTexture(texture); // Texture unloading
CloseWindow(); // Close window and OpenGL context
- //----------------------------------------------------------
+ //--------------------------------------------------------------------------------------
return 0;
} \ No newline at end of file
diff --git a/examples/ex04a_textures.exe b/examples/ex04a_textures.exe
index 5e0de2b2..51a65245 100644
--- a/examples/ex04a_textures.exe
+++ b/examples/ex04a_textures.exe
Binary files differ
diff --git a/examples/ex04b_texture_rectangle.c b/examples/ex04b_texture_rectangle.c
index cca1a7c2..b7011d2a 100644
--- a/examples/ex04b_texture_rectangle.c
+++ b/examples/ex04b_texture_rectangle.c
@@ -13,27 +13,27 @@
int main()
{
+ // Initialization
+ //--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
-
- // Initialization
- //---------------------------------------------------------
+
InitWindow(screenWidth, screenHeight, "raylib example 04b - texture rectangle");
// 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
{
// Update
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
// TODO: Update your variables here
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
// Draw
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
@@ -44,15 +44,15 @@ int main()
void DrawTextureRec(Texture2D texture, Rectangle sourceRec, Vector2 position, float scale, Color tint);
*/
EndDrawing();
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
}
// De-Initialization
- //---------------------------------------------------------
+ //--------------------------------------------------------------------------------------
UnloadTexture(texture); // Texture unloading
CloseWindow(); // Close window and OpenGL context
- //----------------------------------------------------------
+ //--------------------------------------------------------------------------------------
return 0;
} \ No newline at end of file
diff --git a/examples/ex05a_sprite_fonts.c b/examples/ex05a_sprite_fonts.c
index 53146fe3..03d46040 100644
--- a/examples/ex05a_sprite_fonts.c
+++ b/examples/ex05a_sprite_fonts.c
@@ -13,27 +13,27 @@
int main()
{
+ // Initialization
+ //--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
-
- // Initialization
- //---------------------------------------------------------
+
InitWindow(screenWidth, screenHeight, "raylib example 05a - sprite fonts");
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
SpriteFont font = LoadSpriteFont("resources/custom_font.png"); // SpriteFont loading
- //----------------------------------------------------------
+ //--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
// TODO: Update your variables here
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
// Draw
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
@@ -44,15 +44,15 @@ int main()
void DrawTextEx(SpriteFont spriteFont, const char* text, Vector2 position, int fontSize, int spacing, Color tint);
*/
EndDrawing();
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
}
// De-Initialization
- //---------------------------------------------------------
+ //--------------------------------------------------------------------------------------
UnloadSpriteFont(font); // SpriteFont unloading
CloseWindow(); // Close window and OpenGL context
- //----------------------------------------------------------
+ //--------------------------------------------------------------------------------------
return 0;
} \ No newline at end of file
diff --git a/examples/ex05b_rbmf_fonts.c b/examples/ex05b_rbmf_fonts.c
index 03bd6f1a..eeb5f61b 100644
--- a/examples/ex05b_rbmf_fonts.c
+++ b/examples/ex05b_rbmf_fonts.c
@@ -13,27 +13,27 @@
int main()
{
+ // Initialization
+ //--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
-
- // Initialization
- //---------------------------------------------------------
+
InitWindow(screenWidth, screenHeight, "raylib example 04b - texture rectangle");
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
SpriteFont font = LoadSpriteFont("resources/custom_font.rbmf"); // SpriteFont loading
- //----------------------------------------------------------
+ //--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
// TODO: Update your variables here
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
// Draw
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
@@ -44,15 +44,15 @@ int main()
void DrawTextEx(SpriteFont spriteFont, const char* text, Vector2 position, int fontSize, int spacing, Color tint);
*/
EndDrawing();
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
}
// De-Initialization
- //---------------------------------------------------------
+ //--------------------------------------------------------------------------------------
UnloadSpriteFont(font); // SpriteFont unloading
CloseWindow(); // Close window and OpenGL context
- //----------------------------------------------------------
+ //--------------------------------------------------------------------------------------
return 0;
} \ No newline at end of file
diff --git a/examples/ex06a_color_select.c b/examples/ex06a_color_select.c
index d0e2450e..3a243e8f 100644
--- a/examples/ex06a_color_select.c
+++ b/examples/ex06a_color_select.c
@@ -13,24 +13,24 @@
int main()
{
+ // Initialization
+ //--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
- // Initialization
- //---------------------------------------------------------
InitWindow(screenWidth, screenHeight, "raylib example 06a - color selection");
- //----------------------------------------------------------
+ //--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
// TODO: Update your variables here
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
// Draw
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
@@ -38,13 +38,13 @@ int main()
// TODO: Comming soon...
EndDrawing();
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
}
// De-Initialization
- //---------------------------------------------------------
+ //--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
- //----------------------------------------------------------
+ //--------------------------------------------------------------------------------------
return 0;
} \ No newline at end of file
diff --git a/examples/ex06b_shape_select.c b/examples/ex06b_shape_select.c
index 205e7efa..1d0a6b19 100644
--- a/examples/ex06b_shape_select.c
+++ b/examples/ex06b_shape_select.c
@@ -13,24 +13,24 @@
int main()
{
+ // Initialization
+ //--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
-
- // Initialization
- //---------------------------------------------------------
+
InitWindow(screenWidth, screenHeight, "raylib example 06b - shape selection");
- //----------------------------------------------------------
+ //--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
// TODO: Update your variables here
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
// Draw
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
@@ -38,13 +38,13 @@ int main()
// TODO: Comming soon...
EndDrawing();
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
}
// De-Initialization
- //---------------------------------------------------------
+ //--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
- //----------------------------------------------------------
+ //--------------------------------------------------------------------------------------
return 0;
} \ No newline at end of file
diff --git a/examples/ex06c_font_select.c b/examples/ex06c_font_select.c
index b69228ca..bf13b67b 100644
--- a/examples/ex06c_font_select.c
+++ b/examples/ex06c_font_select.c
@@ -13,24 +13,24 @@
int main()
{
+ // Initialization
+ //--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
-
- // Initialization
- //---------------------------------------------------------
+
InitWindow(screenWidth, screenHeight, "raylib example 06c - font selection");
- //----------------------------------------------------------
+ //--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
// TODO: Update your variables here
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
// Draw
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
@@ -38,13 +38,13 @@ int main()
// TODO: Comming soon...
EndDrawing();
- //-----------------------------------------------------
+ //----------------------------------------------------------------------------------
}
// De-Initialization
- //---------------------------------------------------------
+ //--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
- //----------------------------------------------------------
+ //--------------------------------------------------------------------------------------
return 0;
} \ No newline at end of file
diff --git a/examples/ex07a_3d_mode.c b/examples/ex07a_3d_mode.c
index eb79a8b5..8d3923d7 100644
--- a/examples/ex07a_3d_mode.c
+++ b/examples/ex07a_3d_mode.c
@@ -13,6 +13,7 @@
int main()
{
+<<<<<<< HEAD
int screenWidth = 800;
int screenHeight = 450;
@@ -25,9 +26,24 @@ int main()
InitWindow(screenWidth, screenHeight, "raylib example 07a - 3d mode");
//----------------------------------------------------------
+=======
+ // Initialization
+ //--------------------------------------------------------------------------------------
+ int screenWidth = 800;
+ int screenHeight = 450;
+
+ Vector3 position = { 0.0, 0.0, 0.0 };
+
+ Camera camera = {{ 0.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
+
+ InitWindow(screenWidth, screenHeight, "raylib example 07a - 3d mode");
+ //--------------------------------------------------------------------------------------
+
+>>>>>>> Added some functions and examples update
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
+<<<<<<< HEAD
// Update
//-----------------------------------------------------
// TODO: Update your variables here
@@ -60,5 +76,39 @@ int main()
CloseWindow(); // Close window and OpenGL context
//----------------------------------------------------------
+=======
+ // Update
+ //----------------------------------------------------------------------------------
+ // TODO: Update your variables here
+ //----------------------------------------------------------------------------------
+
+ // Draw
+ //----------------------------------------------------------------------------------
+ BeginDrawing();
+
+ ClearBackground(WHITE);
+
+ Begin3dMode(camera);
+
+ DrawCube(position, 2, 2, 2, RED);
+
+ DrawGrid(10.0, 1.0);
+
+ End3dMode();
+
+ DrawText("Welcome to the third dimension!", 10, 40, 20, DARKGRAY);
+
+ DrawFPS(10, 10);
+
+ EndDrawing();
+ //----------------------------------------------------------------------------------
+ }
+
+ // De-Initialization
+ //--------------------------------------------------------------------------------------
+ CloseWindow(); // Close window and OpenGL context
+ //--------------------------------------------------------------------------------------
+
+>>>>>>> Added some functions and examples update
return 0;
} \ No newline at end of file
diff --git a/examples/ex07a_3d_mode.exe b/examples/ex07a_3d_mode.exe
index d5c8ab98..504ccce6 100644
--- a/examples/ex07a_3d_mode.exe
+++ b/examples/ex07a_3d_mode.exe
Binary files differ
diff --git a/examples/ex07b_3d_shapes.c b/examples/ex07b_3d_shapes.c
index 6501659d..14d58354 100644
--- a/examples/ex07b_3d_shapes.c
+++ b/examples/ex07b_3d_shapes.c
@@ -13,12 +13,20 @@
int main()
{
+<<<<<<< HEAD
int screenWidth = 800;
int screenHeight = 450;
+=======
+ // Initialization
+ //--------------------------------------------------------------------------------------
+ int screenWidth = 800;
+ int screenHeight = 450;
+>>>>>>> Added some functions and examples update
Vector3 position = { 0.0, 0.0, 0.0 };
// Define the camera to look into our 3d world
+<<<<<<< HEAD
Camera camera = {{ 0.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
// Initialization
@@ -28,9 +36,19 @@ int main()
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//----------------------------------------------------------
+=======
+ Camera camera = {{ 0.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
+
+ InitWindow(screenWidth, screenHeight, "raylib example 07b - 3d shapes");
+
+ SetTargetFPS(60); // Set our game to run at 60 frames-per-second
+ //--------------------------------------------------------------------------------------
+
+>>>>>>> Added some functions and examples update
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
+<<<<<<< HEAD
// Update
//-----------------------------------------------------
// TODO: Update your variables here
@@ -45,6 +63,22 @@ int main()
Begin3dMode(camera);
DrawCube(position, 2, 2, 2, RED); // Draw a cube
+=======
+ // Update
+ //----------------------------------------------------------------------------------
+ // TODO: Update your variables here
+ //----------------------------------------------------------------------------------
+
+ // Draw
+ //----------------------------------------------------------------------------------
+ BeginDrawing();
+
+ ClearBackground(RAYWHITE);
+
+ Begin3dMode(camera);
+
+ DrawCube(position, 2, 2, 2, RED); // Draw a cube
+>>>>>>> Added some functions and examples update
DrawCubeWires(position, 2, 2, 2, MAROON); // Draw a wired-cube
// TODO: Draw some basic 3d shapes
@@ -58,6 +92,7 @@ void DrawSphereWires(Vector3 centerPos, float radius, Color color);
void DrawCylinder(Vector3 position, float radiusTop, float radiusBottom, float height, int slices, Color color);
void DrawCylinderWires(Vector3 position, float radiusTop, float radiusBottom, float height, int slices, Color color);
*/
+<<<<<<< HEAD
DrawGrid(10.0, 1.0); // Draw a grid
End3dMode();
@@ -73,5 +108,22 @@ void DrawCylinderWires(Vector3 position, float radiusTop, float radiusBottom, fl
CloseWindow(); // Close window and OpenGL context
//----------------------------------------------------------
+=======
+ DrawGrid(10.0, 1.0); // Draw a grid
+
+ End3dMode();
+
+ DrawFPS(10, 10);
+
+ EndDrawing();
+ //----------------------------------------------------------------------------------
+ }
+
+ // De-Initialization
+ //--------------------------------------------------------------------------------------
+ CloseWindow(); // Close window and OpenGL context
+ //--------------------------------------------------------------------------------------
+
+>>>>>>> Added some functions and examples update
return 0;
} \ No newline at end of file
diff --git a/examples/ex07c_3d_models.c b/examples/ex07c_3d_models.c
index 962b71de..158224d1 100644
--- a/examples/ex07c_3d_models.c
+++ b/examples/ex07c_3d_models.c
@@ -13,12 +13,20 @@
int main()
{
+<<<<<<< HEAD
int screenWidth = 800;
int screenHeight = 450;
+=======
+ // Initialization
+ //--------------------------------------------------------------------------------------
+ int screenWidth = 800;
+ int screenHeight = 450;
+>>>>>>> Added some functions and examples update
Vector3 position = { 0.0, 0.0, 0.0 };
// Define the camera to look into our 3d world
+<<<<<<< HEAD
Camera camera = {{ 10.0, 8.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
// Initialization
@@ -31,9 +39,22 @@ int main()
Model cat = LoadModel("resources/cat.obj");
//----------------------------------------------------------
+=======
+ Camera camera = {{ 10.0, 8.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
+
+ InitWindow(screenWidth, screenHeight, "raylib example 07c - 3d models");
+
+ SetTargetFPS(60); // Set our game to run at 60 frames-per-second
+
+ Texture2D texture = LoadTexture("resources/catwhite.png");
+ Model cat = LoadModel("resources/cat.obj");
+ //--------------------------------------------------------------------------------------
+
+>>>>>>> Added some functions and examples update
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
+<<<<<<< HEAD
// Update
//-----------------------------------------------------
if (IsKeyPressed(KEY_LEFT)) position.x -= 0.2;
@@ -51,10 +72,30 @@ int main()
Begin3dMode(camera);
DrawModelEx(cat, texture, position, 0.1f, WHITE); // Draw 3d model with texture
+=======
+ // Update
+ //----------------------------------------------------------------------------------
+ if (IsKeyPressed(KEY_LEFT)) position.x -= 0.2;
+ if (IsKeyPressed(KEY_RIGHT)) position.x += 0.2;
+ if (IsKeyPressed(KEY_UP)) position.z -= 0.2;
+ if (IsKeyPressed(KEY_DOWN)) position.z += 0.2;
+ //----------------------------------------------------------------------------------
+
+ // Draw
+ //----------------------------------------------------------------------------------
+ BeginDrawing();
+
+ ClearBackground(RAYWHITE);
+
+ Begin3dMode(camera);
+
+ DrawModelEx(cat, texture, position, 0.1f, WHITE); // Draw 3d model with texture
+>>>>>>> Added some functions and examples update
DrawGrid(10.0, 1.0); // Draw a grid
DrawGizmo(position, false);
+<<<<<<< HEAD
End3dMode();
@@ -66,11 +107,30 @@ int main()
// De-Initialization
//---------------------------------------------------------
+=======
+
+ End3dMode();
+
+ DrawFPS(10, 10);
+
+ EndDrawing();
+ //----------------------------------------------------------------------------------
+ }
+
+ // De-Initialization
+ //--------------------------------------------------------------------------------------
+>>>>>>> Added some functions and examples update
UnloadTexture(texture); // Unload texture
UnloadModel(cat); // Unload model
CloseWindow(); // Close window and OpenGL context
//----------------------------------------------------------
+<<<<<<< HEAD
+=======
+ CloseWindow(); // Close window and OpenGL context
+ //--------------------------------------------------------------------------------------
+
+>>>>>>> Added some functions and examples update
return 0;
} \ No newline at end of file
diff --git a/examples/ex07c_3d_models.exe b/examples/ex07c_3d_models.exe
index ff23976c..970e6399 100644
--- a/examples/ex07c_3d_models.exe
+++ b/examples/ex07c_3d_models.exe
Binary files differ
diff --git a/examples/ex08_audio.c b/examples/ex08_audio.c
index da39bf73..7f8df55c 100644
--- a/examples/ex08_audio.c
+++ b/examples/ex08_audio.c
@@ -13,6 +13,7 @@
int main()
{
+<<<<<<< HEAD
int screenWidth = 800;
int screenHeight = 450;
@@ -28,9 +29,24 @@ int main()
bool previousKeyState = currentKeyState;
//----------------------------------------------------------
+=======
+ // Initialization
+ //--------------------------------------------------------------------------------------
+ int screenWidth = 800;
+ int screenHeight = 450;
+
+ InitWindow(screenWidth, screenHeight, "raylib example 08 - audio loading and playing");
+
+ InitAudioDevice(); // Initialize audio device
+
+ Sound fx = LoadSound("resources/coin.wav"); // Load WAV audio file
+ //--------------------------------------------------------------------------------------
+
+>>>>>>> Added some functions and examples update
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
+<<<<<<< HEAD
// Update
//-----------------------------------------------------
currentKeyState = IsKeyPressed(KEY_SPACE); // Check if Space have been pressed
@@ -65,5 +81,33 @@ int main()
CloseWindow(); // Close window and OpenGL context
//----------------------------------------------------------
+=======
+ // Update
+ //----------------------------------------------------------------------------------
+ if (IsKeyPressed(KEY_SPACE)) PlaySound(fx); // Play the sound!
+ //----------------------------------------------------------------------------------
+
+ // Draw
+ //----------------------------------------------------------------------------------
+ BeginDrawing();
+
+ ClearBackground(RAYWHITE);
+
+ DrawText("Press SPACE to PLAY the SOUND!", 240, 200, 20, LIGHTGRAY);
+
+ EndDrawing();
+ //----------------------------------------------------------------------------------
+ }
+
+ // De-Initialization
+ //--------------------------------------------------------------------------------------
+ UnloadSound(fx); // Unload sound data
+
+ CloseAudioDevice(); // Close audio device
+
+ CloseWindow(); // Close window and OpenGL context
+ //--------------------------------------------------------------------------------------
+
+>>>>>>> Added some functions and examples update
return 0;
} \ No newline at end of file