aboutsummaryrefslogtreecommitdiff
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
parent818e79638b5ff14fdae9f6a162e596bf119f82c5 (diff)
downloadraylib-e9143b8a8d2eb439b01b94c00518db2b59ffb1e7.tar.gz
raylib-e9143b8a8d2eb439b01b94c00518db2b59ffb1e7.zip
Added some functions and Updated examples
View CHANGELOG for details
-rw-r--r--CHANGELOG19
-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
-rw-r--r--release/win32-mingw/include/raylib.h29
-rw-r--r--release/win32-mingw/lib/libraylib.abin129960 -> 133040 bytes
-rw-r--r--src/core.c117
-rw-r--r--src/raylib.h29
-rw-r--r--src/text.c15
-rw-r--r--src/textures.c42
35 files changed, 588 insertions, 201 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 5bbc90bd..21134fa8 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,8 +1,25 @@
changelog
---------
-Current: raylib 1.0 (November 2013)
+Current: raylib 1.0.1 (November 2013)
+-----------------------------------------------
+Update: raylib 1.0.1 (28 November 2013)
+-----------------------------------------------
+[text] DrawText() - Removed spacing parameter
+[text] MeasureText() - Removed spacing parameter
+[text] DrawFps() - Renamed to DrawFPS() for coherence with similar function
+[core] IsKeyPressed() - Change functionality, check if key pressed once
+[core] IsKeyDown() - Added, check if key is being pressed
+[core] IsKeyReleased() - Change functionality, chek if key released once
+[core] IsKeyUp() - Added, check if key is being NOT pressed
+[core] IsMouseButtonDown() - Added, check if mouse button is being pressed
+[core] IsMouseButtonPressed() - Change functionality, check if mouse button pressed once
+[core] IsMouseButtonUp() - Added, check if mouse button is NOT being pressed
+[core] IsMouseButtonReleased() - Change functionality, check if mouse button released once
+[textures] DrawTexturePro() - Added, texture drawing with 'pro' parameters
+
+[examples] Function changes applied to ALL examples
-----------------------------------------------
Release: raylib 1.0.0 (18 November 2013)
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
diff --git a/release/win32-mingw/include/raylib.h b/release/win32-mingw/include/raylib.h
index c23834a0..d6319373 100644
--- a/release/win32-mingw/include/raylib.h
+++ b/release/win32-mingw/include/raylib.h
@@ -260,19 +260,25 @@ int GetHexValue(Color color); // Returns hexadecimal v
//------------------------------------------------------------------------------------
// Input Handling Functions (Module: core)
//------------------------------------------------------------------------------------
-bool IsKeyPressed(int key); // Detect if a key is being pressed
-bool IsKeyReleased(int key); // Detect if a key is NOT being pressed
-
-bool IsMouseButtonPressed(int button); // Detect if a mouse button is being pressed
-bool IsMouseButtonReleased(int button); // Detect if a mouse button is NOT being pressed
+bool IsKeyPressed(int key); // Detect if a key has been pressed once
+bool IsKeyDown(int key); // Detect if a key is being pressed
+bool IsKeyReleased(int key); // Detect if a key has been released once
+bool IsKeyUp(int key); // Detect if a key is NOT being pressed
+
+bool IsMouseButtonPressed(int button); // Detect if a mouse button has been pressed once
+bool IsMouseButtonDown(int button); // Detect if a mouse button is being pressed
+bool IsMouseButtonReleased(int button); // Detect if a mouse button has been released once
+bool IsMouseButtonUp(int button); // Detect if a mouse button is NOT being pressed
int GetMouseX(); // Returns mouse position X
int GetMouseY(); // Returns mouse position Y
Vector2 GetMousePosition(); // Returns mouse position XY
bool IsGamepadAvailable(int gamepad); // Detect if a gamepad is available
Vector2 GetGamepadMovement(int gamepad); // Return axis movement vector for a gamepad
-bool IsGamepadButtonPressed(int gamepad, int button); // Detect if a gamepad button is being pressed
-bool IsGamepadButtonReleased(int gamepad, int button); // Detect if a gamepad button is NOT being pressed
+bool IsGamepadButtonPressed(int gamepad, int button); // Detect if a gamepad button has been pressed once
+bool IsGamepadButtonDown(int gamepad, int button); // Detect if a gamepad button is being pressed
+bool IsGamepadButtonReleased(int gamepad, int button); // Detect if a gamepad button has been released once
+bool IsGamepadButtonUp(int gamepad, int button); // Detect if a gamepad button is NOT being pressed
//------------------------------------------------------------------------------------
// Basic Shapes Drawing Functions (Module: shapes)
@@ -305,19 +311,20 @@ Texture2D LoadTexture(const char *fileName);
void UnloadTexture(Texture2D texture); // Unload texture from GPU memory
void DrawTexture(Texture2D texture, int posX, int posY, Color tint); // Draw a Texture2D
void DrawTextureEx(Texture2D texture, Vector2 position, float rotation, float scale, Color tint); // Draw a Texture2D with extended parameters
-void DrawTextureRec(Texture2D texture, Rectangle sourceRec, Vector2 position, float scale, Color tint); // Draw a part of a texture defined by a rectangle
+void DrawTextureRec(Texture2D texture, Rectangle sourceRec, Vector2 position, Color tint); // Draw a part of a texture defined by a rectangle
+void DrawTexturePro(Texture2D texture, Rectangle sourceRec, Rectangle destRec, Vector2 origin, float rotation, Color tint); // Draw a part of a texture defined by a rectangle with 'pro' parameters
//------------------------------------------------------------------------------------
// Font Loading and Text Drawing Functions (Module: text)
//------------------------------------------------------------------------------------
SpriteFont LoadSpriteFont(const char *fileName); // Load a SpriteFont image into GPU memory
void UnloadSpriteFont(SpriteFont spriteFont); // Unload SpriteFont from GPU memory
-void DrawText(const char *text, int posX, int posY, int fontSize, int spacing, Color color); // Draw text (using default font)
+void DrawText(const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font)
void DrawTextEx(SpriteFont spriteFont, const char* text, Vector2 position, int fontSize, int spacing, Color tint); // Draw text using SpriteFont
-int MeasureText(const char *text, int fontSize, int spacing); // Measure string width for default font
+int MeasureText(const char *text, int fontSize); // Measure string width for default font
Vector2 MeasureTextEx(SpriteFont spriteFont, const char *text, int fontSize, int spacing); // Measure string size for SpriteFont
int GetFontBaseSize(SpriteFont spriteFont); // Returns the base size for a SpriteFont (chars height)
-void DrawFps(int posX, int posY); // Shows current FPS on top-left corner
+void DrawFPS(int posX, int posY); // Shows current FPS on top-left corner
const char *FormatText(const char *text, ...); // Formatting of text with variables to 'embed'
//------------------------------------------------------------------------------------
diff --git a/release/win32-mingw/lib/libraylib.a b/release/win32-mingw/lib/libraylib.a
index 67917700..028e7870 100644
--- a/release/win32-mingw/lib/libraylib.a
+++ b/release/win32-mingw/lib/libraylib.a
Binary files differ
diff --git a/src/core.c b/src/core.c
index a784f4bb..76df254f 100644
--- a/src/core.c
+++ b/src/core.c
@@ -61,6 +61,15 @@ static double targetTime = 0; // Desired time for one frame, if 0
static int windowWidth, windowHeight; // Required to switch between windowed/fullscren mode (F11)
static char *windowTitle; // Required to switch between windowed/fullscren mode (F11)
+static char previousKeyState[512] = { 0 }; // Required to check if key pressed/released once
+static char currentKeyState[512] = { 0 }; // Required to check if key pressed/released once
+
+static char previousMouseState[3] = { 0 }; // Required to check if mouse btn pressed/released once
+static char currentMouseState[3] = { 0 }; // Required to check if mouse btn pressed/released once
+
+static char previousGamepadState[32] = {0}; // Required to check if gamepad btn pressed/released once
+static char currentGamepadState[32] = {0}; // Required to check if gamepad btn pressed/released once
+
//----------------------------------------------------------------------------------
// Other Modules Functions Declaration (required by core)
//----------------------------------------------------------------------------------
@@ -289,30 +298,98 @@ int GetHexValue(Color color)
// Module Functions Definition - Input (Keyboard, Mouse, Gamepad) Functions
//----------------------------------------------------------------------------------
-// Detect if a key is being pressed (key held down)
+// Detect if a key has been pressed once
bool IsKeyPressed(int key)
+{
+ bool ret = false;
+
+ currentKeyState[key] = IsKeyDown(key);
+
+ if (currentKeyState[key] != previousKeyState[key])
+ {
+ if (currentKeyState[key]) ret = true;
+ previousKeyState[key] = currentKeyState[key];
+ }
+ else ret = false;
+
+ return ret;
+}
+
+// Detect if a key is being pressed (key held down)
+bool IsKeyDown(int key)
{
if (glfwGetKey(window, key) == GLFW_PRESS) return true;
else return false;
}
-// Detect if a key is NOT being pressed (key not held down)
+// Detect if a key has been released once
bool IsKeyReleased(int key)
+{
+ bool ret = false;
+
+ currentKeyState[key] = IsKeyUp(key);
+
+ if (currentKeyState[key] != previousKeyState[key])
+ {
+ if (currentKeyState[key]) ret = true;
+ previousKeyState[key] = currentKeyState[key];
+ }
+ else ret = false;
+
+ return ret;
+}
+
+// Detect if a key is NOT being pressed (key not held down)
+bool IsKeyUp(int key)
{
if (glfwGetKey(window, key) == GLFW_RELEASE) return true;
else return false;
}
-// Detect if a mouse button is being pressed
+// Detect if a mouse button has been pressed once
bool IsMouseButtonPressed(int button)
{
+ bool ret = false;
+
+ currentMouseState[button] = IsMouseButtonDown(button);
+
+ if (currentMouseState[button] != previousMouseState[button])
+ {
+ if (currentMouseState[button]) ret = true;
+ previousMouseState[button] = currentMouseState[button];
+ }
+ else ret = false;
+
+ return ret;
+}
+
+// Detect if a mouse button is being pressed
+bool IsMouseButtonDown(int button)
+{
if (glfwGetMouseButton(window, button) == GLFW_PRESS) return true;
else return false;
}
-// Detect if a mouse button is NOT being pressed
+// Detect if a mouse button has been released once
bool IsMouseButtonReleased(int button)
{
+ bool ret = false;
+
+ currentMouseState[button] = IsMouseButtonUp(button);
+
+ if (currentMouseState[button] != previousMouseState[button])
+ {
+ if (currentMouseState[button]) ret = true;
+ previousMouseState[button] = currentMouseState[button];
+ }
+ else ret = false;
+
+ return ret;
+}
+
+// Detect if a mouse button is NOT being pressed
+bool IsMouseButtonUp(int button)
+{
if (glfwGetMouseButton(window, button) == GLFW_RELEASE) return true;
else return false;
}
@@ -386,6 +463,22 @@ Vector2 GetGamepadMovement(int gamepad)
// Detect if a gamepad button is being pressed
bool IsGamepadButtonPressed(int gamepad, int button)
{
+ bool ret = false;
+
+ currentGamepadState[button] = IsGamepadButtonDown(gamepad, button);
+
+ if (currentGamepadState[button] != previousGamepadState[button])
+ {
+ if (currentGamepadState[button]) ret = true;
+ previousGamepadState[button] = currentGamepadState[button];
+ }
+ else ret = false;
+
+ return ret;
+}
+
+bool IsGamepadButtonDown(int gamepad, int button)
+{
const unsigned char* buttons;
int buttonsCount;
@@ -401,6 +494,22 @@ bool IsGamepadButtonPressed(int gamepad, int button)
// Detect if a gamepad button is NOT being pressed
bool IsGamepadButtonReleased(int gamepad, int button)
{
+ bool ret = false;
+
+ currentGamepadState[button] = IsGamepadButtonUp(gamepad, button);
+
+ if (currentGamepadState[button] != previousGamepadState[button])
+ {
+ if (currentGamepadState[button]) ret = true;
+ previousGamepadState[button] = currentGamepadState[button];
+ }
+ else ret = false;
+
+ return ret;
+}
+
+bool IsGamepadButtonUp(int gamepad, int button)
+{
const unsigned char* buttons;
int buttonsCount;
diff --git a/src/raylib.h b/src/raylib.h
index c23834a0..d6319373 100644
--- a/src/raylib.h
+++ b/src/raylib.h
@@ -260,19 +260,25 @@ int GetHexValue(Color color); // Returns hexadecimal v
//------------------------------------------------------------------------------------
// Input Handling Functions (Module: core)
//------------------------------------------------------------------------------------
-bool IsKeyPressed(int key); // Detect if a key is being pressed
-bool IsKeyReleased(int key); // Detect if a key is NOT being pressed
-
-bool IsMouseButtonPressed(int button); // Detect if a mouse button is being pressed
-bool IsMouseButtonReleased(int button); // Detect if a mouse button is NOT being pressed
+bool IsKeyPressed(int key); // Detect if a key has been pressed once
+bool IsKeyDown(int key); // Detect if a key is being pressed
+bool IsKeyReleased(int key); // Detect if a key has been released once
+bool IsKeyUp(int key); // Detect if a key is NOT being pressed
+
+bool IsMouseButtonPressed(int button); // Detect if a mouse button has been pressed once
+bool IsMouseButtonDown(int button); // Detect if a mouse button is being pressed
+bool IsMouseButtonReleased(int button); // Detect if a mouse button has been released once
+bool IsMouseButtonUp(int button); // Detect if a mouse button is NOT being pressed
int GetMouseX(); // Returns mouse position X
int GetMouseY(); // Returns mouse position Y
Vector2 GetMousePosition(); // Returns mouse position XY
bool IsGamepadAvailable(int gamepad); // Detect if a gamepad is available
Vector2 GetGamepadMovement(int gamepad); // Return axis movement vector for a gamepad
-bool IsGamepadButtonPressed(int gamepad, int button); // Detect if a gamepad button is being pressed
-bool IsGamepadButtonReleased(int gamepad, int button); // Detect if a gamepad button is NOT being pressed
+bool IsGamepadButtonPressed(int gamepad, int button); // Detect if a gamepad button has been pressed once
+bool IsGamepadButtonDown(int gamepad, int button); // Detect if a gamepad button is being pressed
+bool IsGamepadButtonReleased(int gamepad, int button); // Detect if a gamepad button has been released once
+bool IsGamepadButtonUp(int gamepad, int button); // Detect if a gamepad button is NOT being pressed
//------------------------------------------------------------------------------------
// Basic Shapes Drawing Functions (Module: shapes)
@@ -305,19 +311,20 @@ Texture2D LoadTexture(const char *fileName);
void UnloadTexture(Texture2D texture); // Unload texture from GPU memory
void DrawTexture(Texture2D texture, int posX, int posY, Color tint); // Draw a Texture2D
void DrawTextureEx(Texture2D texture, Vector2 position, float rotation, float scale, Color tint); // Draw a Texture2D with extended parameters
-void DrawTextureRec(Texture2D texture, Rectangle sourceRec, Vector2 position, float scale, Color tint); // Draw a part of a texture defined by a rectangle
+void DrawTextureRec(Texture2D texture, Rectangle sourceRec, Vector2 position, Color tint); // Draw a part of a texture defined by a rectangle
+void DrawTexturePro(Texture2D texture, Rectangle sourceRec, Rectangle destRec, Vector2 origin, float rotation, Color tint); // Draw a part of a texture defined by a rectangle with 'pro' parameters
//------------------------------------------------------------------------------------
// Font Loading and Text Drawing Functions (Module: text)
//------------------------------------------------------------------------------------
SpriteFont LoadSpriteFont(const char *fileName); // Load a SpriteFont image into GPU memory
void UnloadSpriteFont(SpriteFont spriteFont); // Unload SpriteFont from GPU memory
-void DrawText(const char *text, int posX, int posY, int fontSize, int spacing, Color color); // Draw text (using default font)
+void DrawText(const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font)
void DrawTextEx(SpriteFont spriteFont, const char* text, Vector2 position, int fontSize, int spacing, Color tint); // Draw text using SpriteFont
-int MeasureText(const char *text, int fontSize, int spacing); // Measure string width for default font
+int MeasureText(const char *text, int fontSize); // Measure string width for default font
Vector2 MeasureTextEx(SpriteFont spriteFont, const char *text, int fontSize, int spacing); // Measure string size for SpriteFont
int GetFontBaseSize(SpriteFont spriteFont); // Returns the base size for a SpriteFont (chars height)
-void DrawFps(int posX, int posY); // Shows current FPS on top-left corner
+void DrawFPS(int posX, int posY); // Shows current FPS on top-left corner
const char *FormatText(const char *text, ...); // Formatting of text with variables to 'embed'
//------------------------------------------------------------------------------------
diff --git a/src/text.c b/src/text.c
index ac0dacfd..74db16cd 100644
--- a/src/text.c
+++ b/src/text.c
@@ -283,11 +283,11 @@ void UnloadSpriteFont(SpriteFont spriteFont)
// Draw text (using default font)
// NOTE: fontSize work like in any drawing program but if fontSize is lower than font-base-size, then font-base-size is used
-void DrawText(const char* text, int posX, int posY, int fontSize, int spacing, Color color)
+void DrawText(const char* text, int posX, int posY, int fontSize, Color color)
{
Vector2 position = { (float)posX, (float)posY };
- DrawTextEx(defaultFont, text, position, fontSize, spacing, color);
+ DrawTextEx(defaultFont, text, position, fontSize, 1, color);
}
// Formatting of text with variables to 'embed'
@@ -349,16 +349,15 @@ void DrawTextEx(SpriteFont spriteFont, const char* text, Vector2 position, int f
}
// Measure string width for default font
-int MeasureText(const char *text, int fontSize, int spacing)
+int MeasureText(const char *text, int fontSize)
{
Vector2 vec;
- vec = MeasureTextEx(defaultFont, text, fontSize, spacing);
+ vec = MeasureTextEx(defaultFont, text, fontSize, 1);
return (int)vec.x;
}
-
// Measure string size for SpriteFont
Vector2 MeasureTextEx(SpriteFont spriteFont, const char *text, int fontSize, int spacing)
{
@@ -391,7 +390,7 @@ int GetFontBaseSize(SpriteFont spriteFont)
// Shows current FPS on top-left corner
// NOTE: Uses default font
-void DrawFps(int posX, int posY)
+void DrawFPS(int posX, int posY)
{
// NOTE: We are rendering fps every second for better viewing on high framerates
static float fps;
@@ -403,7 +402,7 @@ void DrawFps(int posX, int posY)
if (counter < refreshRate)
{
sprintf(buffer, "%2.0f FPS", fps);
- DrawText(buffer, posX, posY, 20, 1, LIME);
+ DrawText(buffer, posX, posY, 20, LIME);
counter++;
}
@@ -412,7 +411,7 @@ void DrawFps(int posX, int posY)
fps = GetFPS();
refreshRate = fps;
sprintf(buffer, "%2.0f FPS", fps);
- DrawText(buffer, posX, posY, 20, 1, LIME);
+ DrawText(buffer, posX, posY, 20, LIME);
counter = 0;
}
diff --git a/src/textures.c b/src/textures.c
index fc342a80..3ccb5358 100644
--- a/src/textures.c
+++ b/src/textures.c
@@ -197,7 +197,7 @@ void DrawTextureEx(Texture2D texture, Vector2 position, float rotation, float sc
}
// Draw a part of a texture (defined by a rectangle)
-void DrawTextureRec(Texture2D texture, Rectangle sourceRec, Vector2 position, float scale, Color tint)
+void DrawTextureRec(Texture2D texture, Rectangle sourceRec, Vector2 position, Color tint)
{
glEnable(GL_TEXTURE_2D); // Enable textures usage
@@ -205,7 +205,7 @@ void DrawTextureRec(Texture2D texture, Rectangle sourceRec, Vector2 position, fl
glPushMatrix();
glTranslatef(position.x, position.y, 0);
- glScalef(scale, scale, 1.0f);
+ //glScalef(1.0f, 1.0f, 1.0f);
//glRotatef(rotation, 0, 0, 1);
glBegin(GL_QUADS);
@@ -233,6 +233,44 @@ void DrawTextureRec(Texture2D texture, Rectangle sourceRec, Vector2 position, fl
glDisable(GL_TEXTURE_2D); // Disable textures usage
}
+// Draw a part of a texture (defined by a rectangle) with 'pro' parameters
+// TODO: Test this function...
+void DrawTexturePro(Texture2D texture, Rectangle sourceRec, Rectangle destRec, Vector2 origin, float rotation, Color tint)
+{
+ glEnable(GL_TEXTURE_2D); // Enable textures usage
+
+ glBindTexture(GL_TEXTURE_2D, texture.glId);
+
+ glPushMatrix();
+ glTranslatef(-origin.x, -origin.y, 0);
+ glRotatef(rotation, 0, 0, 1);
+ glTranslatef(destRec.x + origin.x, destRec.y + origin.y, 0);
+
+ glBegin(GL_QUADS);
+ glColor4ub(tint.r, tint.g, tint.b, tint.a);
+ glNormal3f(0.0f, 0.0f, 1.0f); // Normal vector pointing towards viewer
+
+ // Bottom-left corner for texture and quad
+ glTexCoord2f((float)sourceRec.x / texture.width, (float)sourceRec.y / texture.height);
+ glVertex2f(0.0f, 0.0f);
+
+ // Bottom-right corner for texture and quad
+ glTexCoord2f((float)(sourceRec.x + sourceRec.width) / texture.width, (float)sourceRec.y / texture.height);
+ glVertex2f(destRec.width, 0.0f);
+
+ // Top-right corner for texture and quad
+ glTexCoord2f((float)(sourceRec.x + sourceRec.width) / texture.width, (float)(sourceRec.y + sourceRec.height) / texture.height);
+ glVertex2f(destRec.width, destRec.height);
+
+ // Top-left corner for texture and quad
+ glTexCoord2f((float)sourceRec.x / texture.width, (float)(sourceRec.y + sourceRec.height) / texture.height);
+ glVertex2f(0.0f, destRec.height);
+ glEnd();
+ glPopMatrix();
+
+ glDisable(GL_TEXTURE_2D); // Disable textures usage
+}
+
// Creates a bitmap (BMP) file from an array of pixel data
// NOTE: This function is only used by module [core], not explicitly available to raylib users
extern void WriteBitmap(const char *fileName, const Color *imgDataPixel, int width, int height)