mirror of
				https://github.com/raysan5/raylib.git
				synced 2025-10-26 12:27:01 +00:00 
			
		
		
		
	Added some functions and Updated examples
View CHANGELOG for details
This commit is contained in:
		
							
								
								
									
										19
									
								
								CHANGELOG
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								CHANGELOG
									
									
									
									
									
								
							| @@ -1,8 +1,25 @@ | |||||||
| changelog | 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) | Release: 	raylib 1.0.0 (18 November 2013) | ||||||
|   | |||||||
| @@ -13,38 +13,38 @@ | |||||||
|  |  | ||||||
| int main() | int main() | ||||||
| { | { | ||||||
|  |     // Initialization | ||||||
|  |     //-------------------------------------------------------------------------------------- | ||||||
|     int screenWidth = 800; |     int screenWidth = 800; | ||||||
|     int screenHeight = 450; |     int screenHeight = 450; | ||||||
|      |      | ||||||
|     // Initialization |  | ||||||
|     //--------------------------------------------------------- |  | ||||||
|     InitWindow(screenWidth, screenHeight, "raylib example 01a - basic window"); |     InitWindow(screenWidth, screenHeight, "raylib example 01a - basic window"); | ||||||
|     //---------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|      |      | ||||||
|     // Main game loop |     // Main game loop | ||||||
|     while (!WindowShouldClose())    // Detect window close button or ESC key |     while (!WindowShouldClose())    // Detect window close button or ESC key | ||||||
|     { |     { | ||||||
|         // Update |         // Update | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|         // TODO: Update your variables here |         // TODO: Update your variables here | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|          |          | ||||||
|         // Draw |         // Draw | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|         BeginDrawing(); |         BeginDrawing(); | ||||||
|          |          | ||||||
|             ClearBackground(RAYWHITE); |             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(); |         EndDrawing(); | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     // De-Initialization |     // De-Initialization | ||||||
|     //--------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|     CloseWindow();        // Close window and OpenGL context |     CloseWindow();        // Close window and OpenGL context | ||||||
|     //---------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|      |      | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
										
											Binary file not shown.
										
									
								
							| @@ -13,42 +13,42 @@ | |||||||
|  |  | ||||||
| int main() | int main() | ||||||
| { | { | ||||||
|  |     // Initialization | ||||||
|  |     //-------------------------------------------------------------------------------------- | ||||||
|     int screenWidth = 800; |     int screenWidth = 800; | ||||||
|     int screenHeight = 450; |     int screenHeight = 450; | ||||||
|      |      | ||||||
|     // Initialization |  | ||||||
|     //--------------------------------------------------------- |  | ||||||
|     InitWindow(screenWidth, screenHeight, "raylib example 02a - raylib logo"); |     InitWindow(screenWidth, screenHeight, "raylib example 02a - raylib logo"); | ||||||
|     //---------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|      |      | ||||||
|     // Main game loop |     // Main game loop | ||||||
|     while (!WindowShouldClose())    // Detect window close button or ESC key |     while (!WindowShouldClose())    // Detect window close button or ESC key | ||||||
|     { |     { | ||||||
|         // Update |         // Update | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|         // TODO: Update your variables here |         // TODO: Update your variables here | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|          |          | ||||||
|         // Draw |         // Draw | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|         BeginDrawing(); |         BeginDrawing(); | ||||||
|          |          | ||||||
|             ClearBackground(RAYWHITE); |             ClearBackground(RAYWHITE); | ||||||
|              |              | ||||||
|             DrawRectangle(screenWidth/2 - 128, screenHeight/2 - 128, 256, 256, BLACK); |             DrawRectangle(screenWidth/2 - 128, screenHeight/2 - 128, 256, 256, BLACK); | ||||||
|             DrawRectangle(screenWidth/2 - 112, screenHeight/2 - 112, 224, 224, RAYWHITE); |             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(); |         EndDrawing(); | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     // De-Initialization |     // De-Initialization | ||||||
|     //--------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|     CloseWindow();        // Close window and OpenGL context |     CloseWindow();        // Close window and OpenGL context | ||||||
|     //---------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|      |      | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
										
											Binary file not shown.
										
									
								
							| @@ -13,24 +13,24 @@ | |||||||
|  |  | ||||||
| int main() | int main() | ||||||
| { | { | ||||||
|  |     // Initialization | ||||||
|  |     //-------------------------------------------------------------------------------------- | ||||||
|     int screenWidth = 800; |     int screenWidth = 800; | ||||||
|     int screenHeight = 450; |     int screenHeight = 450; | ||||||
|      |  | ||||||
|     // Initialization |  | ||||||
|     //--------------------------------------------------------- |  | ||||||
|     InitWindow(screenWidth, screenHeight, "raylib example 02b - basic shapes drawing"); |     InitWindow(screenWidth, screenHeight, "raylib example 02b - basic shapes drawing"); | ||||||
|     //---------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|      |      | ||||||
|     // Main game loop |     // Main game loop | ||||||
|     while (!WindowShouldClose())    // Detect window close button or ESC key |     while (!WindowShouldClose())    // Detect window close button or ESC key | ||||||
|     { |     { | ||||||
|         // Update |         // Update | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|         // TODO: Update your variables here |         // TODO: Update your variables here | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|          |          | ||||||
|         // Draw |         // Draw | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|         BeginDrawing(); |         BeginDrawing(); | ||||||
|          |          | ||||||
|             ClearBackground(RAYWHITE); |             ClearBackground(RAYWHITE); | ||||||
| @@ -61,13 +61,13 @@ void DrawPolyLine(Vector2 *points, int numPoints, Color color); | |||||||
|             DrawText("_____", 320, 280, 50, 1, BLACK); |             DrawText("_____", 320, 280, 50, 1, BLACK); | ||||||
|          |          | ||||||
|         EndDrawing(); |         EndDrawing(); | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     // De-Initialization |     // De-Initialization | ||||||
|     //--------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|     CloseWindow();        // Close window and OpenGL context |     CloseWindow();        // Close window and OpenGL context | ||||||
|     //---------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|      |      | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
| @@ -13,29 +13,29 @@ | |||||||
|  |  | ||||||
| int main() | int main() | ||||||
| { | { | ||||||
|  |     // Initialization | ||||||
|  |     //-------------------------------------------------------------------------------------- | ||||||
|     int screenWidth = 800; |     int screenWidth = 800; | ||||||
|     int screenHeight = 450; |     int screenHeight = 450; | ||||||
|      |      | ||||||
|     // Initialization |  | ||||||
|     //--------------------------------------------------------- |  | ||||||
|     InitWindow(screenWidth, screenHeight, "raylib example 02c - raylib color palette"); |     InitWindow(screenWidth, screenHeight, "raylib example 02c - raylib color palette"); | ||||||
|     //---------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|      |      | ||||||
|     // Main game loop |     // Main game loop | ||||||
|     while (!WindowShouldClose())    // Detect window close button or ESC key |     while (!WindowShouldClose())    // Detect window close button or ESC key | ||||||
|     { |     { | ||||||
|         // Update |         // Update | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|         // TODO: Update your variables here |         // TODO: Update your variables here | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|          |          | ||||||
|         // Draw |         // Draw | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|         BeginDrawing(); |         BeginDrawing(); | ||||||
|          |          | ||||||
|             ClearBackground(RAYWHITE); |             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, 80, 100, 100, DARKGRAY); | ||||||
|             DrawRectangle(26, 188, 100, 100, GRAY); |             DrawRectangle(26, 188, 100, 100, GRAY); | ||||||
| @@ -60,36 +60,36 @@ int main() | |||||||
|             DrawRectangle(674, 296, 100, 100, BEIGE); |             DrawRectangle(674, 296, 100, 100, BEIGE); | ||||||
|  |  | ||||||
|              |              | ||||||
|             DrawText("DARKGRAY", 57, 166, 10, 2, BLACK); |             DrawText("DARKGRAY", 65, 166, 10, BLACK); | ||||||
|             DrawText("GRAY", 89, 274, 10, 2, BLACK); |             DrawText("GRAY", 93, 274, 10, BLACK); | ||||||
|             DrawText("LIGHTGRAY", 51, 382, 10, 2, BLACK); |             DrawText("LIGHTGRAY", 61, 382, 10, BLACK); | ||||||
|             DrawText("MAROON", 180, 166, 10, 2, BLACK); |             DrawText("MAROON", 186, 166, 10, BLACK); | ||||||
|             DrawText("RED", 207, 274, 10, 2, BLACK); |             DrawText("RED", 208, 274, 10, BLACK); | ||||||
|             DrawText("PINK", 200, 382, 10, 2, BLACK); |             DrawText("PINK", 204, 382, 10, BLACK); | ||||||
|             DrawText("ORANGE", 290, 166, 10, 2, BLACK); |             DrawText("ORANGE", 295, 166, 10, BLACK); | ||||||
|             DrawText("GOLD", 306, 274, 10, 2, BLACK); |             DrawText("GOLD", 310, 274, 10, BLACK); | ||||||
|             DrawText("YELLOW", 290, 382, 10, 2, BLACK); |             DrawText("YELLOW", 300, 382, 10, BLACK); | ||||||
|             DrawText("DARKGREEN", 374, 166, 10, 2, BLACK); |             DrawText("DARKGREEN", 382, 166, 10, BLACK); | ||||||
|             DrawText("LIME", 417, 274, 10, 2, BLACK); |             DrawText("LIME", 420, 274, 10, BLACK); | ||||||
|             DrawText("GREEN", 407, 382, 10, 2, BLACK); |             DrawText("GREEN", 410, 382, 10, BLACK); | ||||||
|             DrawText("DARKBLUE", 491, 166, 10, 2, BLACK); |             DrawText("DARKBLUE", 498, 166, 10, BLACK); | ||||||
|             DrawText("BLUE", 523, 274, 10, 2, BLACK); |             DrawText("BLUE", 526, 274, 10, BLACK); | ||||||
|             DrawText("SKYBLUE", 499, 382, 10, 2, BLACK); |             DrawText("SKYBLUE", 505, 382, 10, BLACK); | ||||||
|             DrawText("DARKPURPLE", 582, 166, 10, 2, BLACK); |             DrawText("DARKPURPLE", 592, 166, 10, BLACK); | ||||||
|             DrawText("VIOLET", 617, 274, 10, 2, BLACK); |             DrawText("VIOLET", 621, 274, 10, BLACK); | ||||||
|             DrawText("PURPLE", 615, 382, 10, 2, BLACK); |             DrawText("PURPLE", 620, 382, 10, BLACK); | ||||||
|             DrawText("DARKBROWN", 695, 166, 10, 2, BLACK); |             DrawText("DARKBROWN", 705, 166, 10, BLACK); | ||||||
|             DrawText("BROWN", 728, 274, 10, 2, BLACK); |             DrawText("BROWN", 733, 274, 10, BLACK); | ||||||
|             DrawText("BEIGE", 733, 382, 10, 2, BLACK); |             DrawText("BEIGE", 737, 382, 10, BLACK); | ||||||
|          |          | ||||||
|         EndDrawing(); |         EndDrawing(); | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     // De-Initialization |     // De-Initialization | ||||||
|     //--------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|     CloseWindow();        // Close window and OpenGL context |     CloseWindow();        // Close window and OpenGL context | ||||||
|     //---------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|      |      | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 5.1 KiB | 
| @@ -12,46 +12,48 @@ | |||||||
| #include "raylib.h" | #include "raylib.h" | ||||||
|  |  | ||||||
| int main() | int main() | ||||||
| { | {     | ||||||
|  |     // Initialization | ||||||
|  |     //-------------------------------------------------------------------------------------- | ||||||
|     int screenWidth = 800; |     int screenWidth = 800; | ||||||
|     int screenHeight = 450; |     int screenHeight = 450; | ||||||
|      |      | ||||||
|     Vector2 ballPosition = { screenWidth/2, screenHeight/2 }; |     Vector2 ballPosition = { screenWidth/2, screenHeight/2 }; | ||||||
|      |      | ||||||
|     // Initialization |  | ||||||
|     //--------------------------------------------------------- |  | ||||||
|     InitWindow(screenWidth, screenHeight, "raylib example 05 - keyboard input"); |     InitWindow(screenWidth, screenHeight, "raylib example 05 - keyboard input"); | ||||||
|     //---------------------------------------------------------- |      | ||||||
|  |     SetTargetFPS(60);       // Set target frames-per-second | ||||||
|  |     //-------------------------------------------------------------------------------------- | ||||||
|      |      | ||||||
|     // Main game loop |     // Main game loop | ||||||
|     while (!WindowShouldClose())    // Detect window close button or ESC key |     while (!WindowShouldClose())    // Detect window close button or ESC key | ||||||
|     { |     { | ||||||
|         // Update |         // Update | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|         if (IsKeyPressed(KEY_RIGHT)) ballPosition.x += 0.8; |         if (IsKeyPressed(KEY_RIGHT)) ballPosition.x += 0.8; | ||||||
|         if (IsKeyPressed(KEY_LEFT)) ballPosition.x -= 0.8; |         if (IsKeyPressed(KEY_LEFT)) ballPosition.x -= 0.8; | ||||||
|         if (IsKeyPressed(KEY_UP)) ballPosition.y -= 0.8; |         if (IsKeyPressed(KEY_UP)) ballPosition.y -= 0.8; | ||||||
|         if (IsKeyPressed(KEY_DOWN)) ballPosition.y += 0.8; |         if (IsKeyPressed(KEY_DOWN)) ballPosition.y += 0.8; | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|          |          | ||||||
|         // Draw |         // Draw | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|         BeginDrawing(); |         BeginDrawing(); | ||||||
|          |          | ||||||
|             ClearBackground(RAYWHITE); |             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); |             DrawCircleV(ballPosition, 50, MAROON); | ||||||
|          |          | ||||||
|         EndDrawing(); |         EndDrawing(); | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     // De-Initialization |     // De-Initialization | ||||||
|     //--------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|     CloseWindow();        // Close window and OpenGL context |     CloseWindow();        // Close window and OpenGL context | ||||||
|     //---------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|      |      | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
										
											Binary file not shown.
										
									
								
							| @@ -13,6 +13,8 @@ | |||||||
|  |  | ||||||
| int main() | int main() | ||||||
| { | { | ||||||
|  |     // Initialization | ||||||
|  |     //-------------------------------------------------------------------------------------- | ||||||
|     int screenWidth = 800; |     int screenWidth = 800; | ||||||
|     int screenHeight = 450; |     int screenHeight = 450; | ||||||
|      |      | ||||||
| @@ -20,16 +22,14 @@ int main() | |||||||
|     int counter = 0; |     int counter = 0; | ||||||
|     int mouseX, mouseY; |     int mouseX, mouseY; | ||||||
|      |      | ||||||
|     // Initialization |  | ||||||
|     //--------------------------------------------------------- |  | ||||||
|     InitWindow(screenWidth, screenHeight, "raylib example 06 - mouse input"); |     InitWindow(screenWidth, screenHeight, "raylib example 06 - mouse input"); | ||||||
|     //---------------------------------------------------------- |     //--------------------------------------------------------------------------------------- | ||||||
|      |      | ||||||
|     // Main game loop |     // Main game loop | ||||||
|     while (!WindowShouldClose())    // Detect window close button or ESC key |     while (!WindowShouldClose())    // Detect window close button or ESC key | ||||||
|     { |     { | ||||||
|         // Update |         // Update | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|         if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) |         if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) | ||||||
|         { |         { | ||||||
|             mouseX = GetMouseX(); |             mouseX = GetMouseX(); | ||||||
| @@ -38,26 +38,26 @@ int main() | |||||||
|             ballPosition.x = (float)mouseX; |             ballPosition.x = (float)mouseX; | ||||||
|             ballPosition.y = (float)mouseY; |             ballPosition.y = (float)mouseY; | ||||||
|         } |         } | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|          |          | ||||||
|         // Draw |         // Draw | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|         BeginDrawing(); |         BeginDrawing(); | ||||||
|          |          | ||||||
|             ClearBackground(RAYWHITE); |             ClearBackground(RAYWHITE); | ||||||
|              |              | ||||||
|             DrawCircleV(ballPosition, 40, GOLD); |             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(); |         EndDrawing(); | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     // De-Initialization |     // De-Initialization | ||||||
|     //--------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|     CloseWindow();        // Close window and OpenGL context |     CloseWindow();        // Close window and OpenGL context | ||||||
|     //---------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|      |      | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
										
											Binary file not shown.
										
									
								
							| @@ -13,22 +13,24 @@ | |||||||
|  |  | ||||||
| int main() | int main() | ||||||
| { | { | ||||||
|  |     // Initialization | ||||||
|  |     //-------------------------------------------------------------------------------------- | ||||||
|     int screenWidth = 800; |     int screenWidth = 800; | ||||||
|     int screenHeight = 450; |     int screenHeight = 450; | ||||||
|      |      | ||||||
|     Vector2 ballPosition = { screenWidth/2, screenHeight/2 }; |     Vector2 ballPosition = { screenWidth/2, screenHeight/2 }; | ||||||
|     Vector2 gamepadMove = { 0, 0 }; |     Vector2 gamepadMove = { 0, 0 }; | ||||||
|      |      | ||||||
|     // Initialization |  | ||||||
|     //--------------------------------------------------------- |  | ||||||
|     InitWindow(screenWidth, screenHeight, "raylib example 01 - gamepad input"); |     InitWindow(screenWidth, screenHeight, "raylib example 01 - gamepad input"); | ||||||
|     //---------------------------------------------------------- |      | ||||||
|  |     SetTargetFPS(60);       // Set target frames-per-second | ||||||
|  |     //-------------------------------------------------------------------------------------- | ||||||
|      |      | ||||||
|     // Main game loop |     // Main game loop | ||||||
|     while (!WindowShouldClose())    // Detect window close button or ESC key |     while (!WindowShouldClose())    // Detect window close button or ESC key | ||||||
|     { |     { | ||||||
|         // Update |         // Update | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|         if (IsGamepadAvailable(GAMEPAD_PLAYER1)) |         if (IsGamepadAvailable(GAMEPAD_PLAYER1)) | ||||||
|         { |         { | ||||||
|             gamepadMove = GetGamepadMovement(GAMEPAD_PLAYER1); |             gamepadMove = GetGamepadMovement(GAMEPAD_PLAYER1); | ||||||
| @@ -42,26 +44,26 @@ int main() | |||||||
|                 ballPosition.y = screenHeight/2; |                 ballPosition.y = screenHeight/2; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|          |          | ||||||
|         // Draw |         // Draw | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|         BeginDrawing(); |         BeginDrawing(); | ||||||
|          |          | ||||||
|             ClearBackground(RAYWHITE); |             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); |             DrawCircleV(ballPosition, 50, MAROON); | ||||||
|          |          | ||||||
|         EndDrawing(); |         EndDrawing(); | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     // De-Initialization |     // De-Initialization | ||||||
|     //--------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|     CloseWindow();        // Close window and OpenGL context |     CloseWindow();        // Close window and OpenGL context | ||||||
|     //---------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|      |      | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
										
											Binary file not shown.
										
									
								
							| @@ -12,28 +12,28 @@ | |||||||
| #include "raylib.h" | #include "raylib.h" | ||||||
|  |  | ||||||
| int main() | int main() | ||||||
| { | {     | ||||||
|  |     // Initialization | ||||||
|  |     //-------------------------------------------------------------------------------------- | ||||||
|     int screenWidth = 800; |     int screenWidth = 800; | ||||||
|     int screenHeight = 450; |     int screenHeight = 450; | ||||||
|      |  | ||||||
|     // Initialization |  | ||||||
|     //--------------------------------------------------------- |  | ||||||
|     InitWindow(screenWidth, screenHeight, "raylib example 04a - texture loading and drawing"); |     InitWindow(screenWidth, screenHeight, "raylib example 04a - texture loading and drawing"); | ||||||
|      |      | ||||||
|     // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required) |     // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required) | ||||||
|     Texture2D texture = LoadTexture("resources/raylib_logo.png");        // Texture loading |     Texture2D texture = LoadTexture("resources/raylib_logo.png");        // Texture loading | ||||||
|     //---------------------------------------------------------- |     //--------------------------------------------------------------------------------------- | ||||||
|      |      | ||||||
|     // Main game loop |     // Main game loop | ||||||
|     while (!WindowShouldClose())    // Detect window close button or ESC key |     while (!WindowShouldClose())    // Detect window close button or ESC key | ||||||
|     { |     { | ||||||
|         // Update |         // Update | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|         // TODO: Update your variables here |         // TODO: Update your variables here | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|          |          | ||||||
|         // Draw |         // Draw | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|         BeginDrawing(); |         BeginDrawing(); | ||||||
|          |          | ||||||
|             ClearBackground(RAYWHITE); |             ClearBackground(RAYWHITE); | ||||||
| @@ -41,18 +41,18 @@ int main() | |||||||
|             DrawTexture(texture, screenWidth/2 - texture.width/2,  |             DrawTexture(texture, screenWidth/2 - texture.width/2,  | ||||||
|                         screenHeight/2 - texture.height/2, WHITE); |                         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(); |         EndDrawing(); | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     // De-Initialization |     // De-Initialization | ||||||
|     //--------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|     UnloadTexture(texture);       // Texture unloading |     UnloadTexture(texture);       // Texture unloading | ||||||
|      |      | ||||||
|     CloseWindow();                // Close window and OpenGL context |     CloseWindow();                // Close window and OpenGL context | ||||||
|     //---------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|      |      | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
										
											Binary file not shown.
										
									
								
							| @@ -13,27 +13,27 @@ | |||||||
|  |  | ||||||
| int main() | int main() | ||||||
| { | { | ||||||
|  |     // Initialization | ||||||
|  |     //-------------------------------------------------------------------------------------- | ||||||
|     int screenWidth = 800; |     int screenWidth = 800; | ||||||
|     int screenHeight = 450; |     int screenHeight = 450; | ||||||
|      |  | ||||||
|     // Initialization |  | ||||||
|     //--------------------------------------------------------- |  | ||||||
|     InitWindow(screenWidth, screenHeight, "raylib example 04b - texture rectangle"); |     InitWindow(screenWidth, screenHeight, "raylib example 04b - texture rectangle"); | ||||||
|      |      | ||||||
|     // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required) |     // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required) | ||||||
|     Texture2D texture = LoadTexture("resources/raylib_logo.png");        // Texture loading |     Texture2D texture = LoadTexture("resources/raylib_logo.png");        // Texture loading | ||||||
|     //---------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|      |      | ||||||
|     // Main game loop |     // Main game loop | ||||||
|     while (!WindowShouldClose())    // Detect window close button or ESC key |     while (!WindowShouldClose())    // Detect window close button or ESC key | ||||||
|     { |     { | ||||||
|         // Update |         // Update | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|         // TODO: Update your variables here |         // TODO: Update your variables here | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|          |          | ||||||
|         // Draw |         // Draw | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|         BeginDrawing(); |         BeginDrawing(); | ||||||
|          |          | ||||||
|             ClearBackground(RAYWHITE); |             ClearBackground(RAYWHITE); | ||||||
| @@ -44,15 +44,15 @@ int main() | |||||||
| void DrawTextureRec(Texture2D texture, Rectangle sourceRec, Vector2 position, float scale, Color tint);         | void DrawTextureRec(Texture2D texture, Rectangle sourceRec, Vector2 position, float scale, Color tint);         | ||||||
| */         | */         | ||||||
|         EndDrawing(); |         EndDrawing(); | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     // De-Initialization |     // De-Initialization | ||||||
|     //--------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|     UnloadTexture(texture);       // Texture unloading |     UnloadTexture(texture);       // Texture unloading | ||||||
|      |      | ||||||
|     CloseWindow();                // Close window and OpenGL context |     CloseWindow();                // Close window and OpenGL context | ||||||
|     //---------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|      |      | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
| @@ -13,27 +13,27 @@ | |||||||
|  |  | ||||||
| int main() | int main() | ||||||
| { | { | ||||||
|  |     // Initialization | ||||||
|  |     //-------------------------------------------------------------------------------------- | ||||||
|     int screenWidth = 800; |     int screenWidth = 800; | ||||||
|     int screenHeight = 450; |     int screenHeight = 450; | ||||||
|      |  | ||||||
|     // Initialization |  | ||||||
|     //--------------------------------------------------------- |  | ||||||
|     InitWindow(screenWidth, screenHeight, "raylib example 05a - sprite fonts"); |     InitWindow(screenWidth, screenHeight, "raylib example 05a - sprite fonts"); | ||||||
|      |      | ||||||
|     // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required) |     // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required) | ||||||
|     SpriteFont font = LoadSpriteFont("resources/custom_font.png");        // SpriteFont loading |     SpriteFont font = LoadSpriteFont("resources/custom_font.png");        // SpriteFont loading | ||||||
|     //---------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|      |      | ||||||
|     // Main game loop |     // Main game loop | ||||||
|     while (!WindowShouldClose())    // Detect window close button or ESC key |     while (!WindowShouldClose())    // Detect window close button or ESC key | ||||||
|     { |     { | ||||||
|         // Update |         // Update | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|         // TODO: Update your variables here |         // TODO: Update your variables here | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|          |          | ||||||
|         // Draw |         // Draw | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|         BeginDrawing(); |         BeginDrawing(); | ||||||
|          |          | ||||||
|             ClearBackground(RAYWHITE); |             ClearBackground(RAYWHITE); | ||||||
| @@ -44,15 +44,15 @@ int main() | |||||||
| void DrawTextEx(SpriteFont spriteFont, const char* text, Vector2 position, int fontSize, int spacing, Color tint);         | void DrawTextEx(SpriteFont spriteFont, const char* text, Vector2 position, int fontSize, int spacing, Color tint);         | ||||||
| */         | */         | ||||||
|         EndDrawing(); |         EndDrawing(); | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     // De-Initialization |     // De-Initialization | ||||||
|     //--------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|     UnloadSpriteFont(font);       // SpriteFont unloading |     UnloadSpriteFont(font);       // SpriteFont unloading | ||||||
|      |      | ||||||
|     CloseWindow();                // Close window and OpenGL context |     CloseWindow();                // Close window and OpenGL context | ||||||
|     //---------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|      |      | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
| @@ -13,27 +13,27 @@ | |||||||
|  |  | ||||||
| int main() | int main() | ||||||
| { | { | ||||||
|  |     // Initialization | ||||||
|  |     //-------------------------------------------------------------------------------------- | ||||||
|     int screenWidth = 800; |     int screenWidth = 800; | ||||||
|     int screenHeight = 450; |     int screenHeight = 450; | ||||||
|      |  | ||||||
|     // Initialization |  | ||||||
|     //--------------------------------------------------------- |  | ||||||
|     InitWindow(screenWidth, screenHeight, "raylib example 04b - texture rectangle"); |     InitWindow(screenWidth, screenHeight, "raylib example 04b - texture rectangle"); | ||||||
|      |      | ||||||
|     // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required) |     // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required) | ||||||
|     SpriteFont font = LoadSpriteFont("resources/custom_font.rbmf");        // SpriteFont loading |     SpriteFont font = LoadSpriteFont("resources/custom_font.rbmf");        // SpriteFont loading | ||||||
|     //---------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|      |      | ||||||
|     // Main game loop |     // Main game loop | ||||||
|     while (!WindowShouldClose())    // Detect window close button or ESC key |     while (!WindowShouldClose())    // Detect window close button or ESC key | ||||||
|     { |     { | ||||||
|         // Update |         // Update | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|         // TODO: Update your variables here |         // TODO: Update your variables here | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|          |          | ||||||
|         // Draw |         // Draw | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|         BeginDrawing(); |         BeginDrawing(); | ||||||
|          |          | ||||||
|             ClearBackground(RAYWHITE); |             ClearBackground(RAYWHITE); | ||||||
| @@ -44,15 +44,15 @@ int main() | |||||||
| void DrawTextEx(SpriteFont spriteFont, const char* text, Vector2 position, int fontSize, int spacing, Color tint);         | void DrawTextEx(SpriteFont spriteFont, const char* text, Vector2 position, int fontSize, int spacing, Color tint);         | ||||||
| */          | */          | ||||||
|         EndDrawing(); |         EndDrawing(); | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     // De-Initialization |     // De-Initialization | ||||||
|     //--------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|     UnloadSpriteFont(font);       // SpriteFont unloading |     UnloadSpriteFont(font);       // SpriteFont unloading | ||||||
|      |      | ||||||
|     CloseWindow();                // Close window and OpenGL context |     CloseWindow();                // Close window and OpenGL context | ||||||
|     //---------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|      |      | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
| @@ -13,24 +13,24 @@ | |||||||
|  |  | ||||||
| int main() | int main() | ||||||
| { | { | ||||||
|  |     // Initialization | ||||||
|  |     //-------------------------------------------------------------------------------------- | ||||||
|     int screenWidth = 800; |     int screenWidth = 800; | ||||||
|     int screenHeight = 450; |     int screenHeight = 450; | ||||||
|      |      | ||||||
|     // Initialization |  | ||||||
|     //--------------------------------------------------------- |  | ||||||
|     InitWindow(screenWidth, screenHeight, "raylib example 06a - color selection"); |     InitWindow(screenWidth, screenHeight, "raylib example 06a - color selection"); | ||||||
|     //---------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|      |      | ||||||
|     // Main game loop |     // Main game loop | ||||||
|     while (!WindowShouldClose())    // Detect window close button or ESC key |     while (!WindowShouldClose())    // Detect window close button or ESC key | ||||||
|     { |     { | ||||||
|         // Update |         // Update | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|         // TODO: Update your variables here |         // TODO: Update your variables here | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|          |          | ||||||
|         // Draw |         // Draw | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|         BeginDrawing(); |         BeginDrawing(); | ||||||
|          |          | ||||||
|             ClearBackground(RAYWHITE); |             ClearBackground(RAYWHITE); | ||||||
| @@ -38,13 +38,13 @@ int main() | |||||||
|             // TODO: Comming soon... |             // TODO: Comming soon... | ||||||
|         |         | ||||||
|         EndDrawing(); |         EndDrawing(); | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     // De-Initialization |     // De-Initialization | ||||||
|     //---------------------------------------------------------     |     //--------------------------------------------------------------------------------------   | ||||||
|     CloseWindow();                // Close window and OpenGL context |     CloseWindow();                // Close window and OpenGL context | ||||||
|     //---------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|      |      | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
| @@ -13,24 +13,24 @@ | |||||||
|  |  | ||||||
| int main() | int main() | ||||||
| { | { | ||||||
|  |     // Initialization | ||||||
|  |     //-------------------------------------------------------------------------------------- | ||||||
|     int screenWidth = 800; |     int screenWidth = 800; | ||||||
|     int screenHeight = 450; |     int screenHeight = 450; | ||||||
|      |  | ||||||
|     // Initialization |  | ||||||
|     //--------------------------------------------------------- |  | ||||||
|     InitWindow(screenWidth, screenHeight, "raylib example 06b - shape selection"); |     InitWindow(screenWidth, screenHeight, "raylib example 06b - shape selection"); | ||||||
|     //---------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|      |      | ||||||
|     // Main game loop |     // Main game loop | ||||||
|     while (!WindowShouldClose())    // Detect window close button or ESC key |     while (!WindowShouldClose())    // Detect window close button or ESC key | ||||||
|     { |     { | ||||||
|         // Update |         // Update | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|         // TODO: Update your variables here |         // TODO: Update your variables here | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|          |          | ||||||
|         // Draw |         // Draw | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|         BeginDrawing(); |         BeginDrawing(); | ||||||
|          |          | ||||||
|             ClearBackground(RAYWHITE); |             ClearBackground(RAYWHITE); | ||||||
| @@ -38,13 +38,13 @@ int main() | |||||||
|             // TODO: Comming soon... |             // TODO: Comming soon... | ||||||
|         |         | ||||||
|         EndDrawing(); |         EndDrawing(); | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     // De-Initialization |     // De-Initialization | ||||||
|     //--------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|     CloseWindow();                // Close window and OpenGL context |     CloseWindow();                // Close window and OpenGL context | ||||||
|     //---------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|      |      | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
| @@ -13,24 +13,24 @@ | |||||||
|  |  | ||||||
| int main() | int main() | ||||||
| { | { | ||||||
|  |     // Initialization | ||||||
|  |     //-------------------------------------------------------------------------------------- | ||||||
|     int screenWidth = 800; |     int screenWidth = 800; | ||||||
|     int screenHeight = 450; |     int screenHeight = 450; | ||||||
|      |  | ||||||
|     // Initialization |  | ||||||
|     //--------------------------------------------------------- |  | ||||||
|     InitWindow(screenWidth, screenHeight, "raylib example 06c - font selection"); |     InitWindow(screenWidth, screenHeight, "raylib example 06c - font selection"); | ||||||
|     //---------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|      |      | ||||||
|     // Main game loop |     // Main game loop | ||||||
|     while (!WindowShouldClose())    // Detect window close button or ESC key |     while (!WindowShouldClose())    // Detect window close button or ESC key | ||||||
|     { |     { | ||||||
|         // Update |         // Update | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|         // TODO: Update your variables here |         // TODO: Update your variables here | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|          |          | ||||||
|         // Draw |         // Draw | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|         BeginDrawing(); |         BeginDrawing(); | ||||||
|          |          | ||||||
|             ClearBackground(RAYWHITE); |             ClearBackground(RAYWHITE); | ||||||
| @@ -38,13 +38,13 @@ int main() | |||||||
|             // TODO: Comming soon... |             // TODO: Comming soon... | ||||||
|   |   | ||||||
|         EndDrawing(); |         EndDrawing(); | ||||||
|         //----------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     // De-Initialization |     // De-Initialization | ||||||
|     //--------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|     CloseWindow();                // Close window and OpenGL context |     CloseWindow();                // Close window and OpenGL context | ||||||
|     //---------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|      |      | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
| @@ -13,6 +13,7 @@ | |||||||
|  |  | ||||||
| int main() | int main() | ||||||
| { | { | ||||||
|  | <<<<<<< HEAD | ||||||
|     int screenWidth = 800; |     int screenWidth = 800; | ||||||
|     int screenHeight = 450; |     int screenHeight = 450; | ||||||
|  |  | ||||||
| @@ -25,9 +26,24 @@ int main() | |||||||
|     InitWindow(screenWidth, screenHeight, "raylib example 07a - 3d mode"); |     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 |     // Main game loop | ||||||
|     while (!WindowShouldClose())    // Detect window close button or ESC key |     while (!WindowShouldClose())    // Detect window close button or ESC key | ||||||
|     { |     { | ||||||
|  | <<<<<<< HEAD | ||||||
|         // Update |         // Update | ||||||
|         //----------------------------------------------------- |         //----------------------------------------------------- | ||||||
|         // TODO: Update your variables here |         // TODO: Update your variables here | ||||||
| @@ -60,5 +76,39 @@ int main() | |||||||
|     CloseWindow();        // Close window and OpenGL context |     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; |     return 0; | ||||||
| } | } | ||||||
										
											Binary file not shown.
										
									
								
							| @@ -13,12 +13,20 @@ | |||||||
|  |  | ||||||
| int main() | int main() | ||||||
| { | { | ||||||
|  | <<<<<<< HEAD | ||||||
|     int screenWidth = 800; |     int screenWidth = 800; | ||||||
|     int screenHeight = 450; |     int screenHeight = 450; | ||||||
|  | ======= | ||||||
|  | 	// Initialization | ||||||
|  | 	//-------------------------------------------------------------------------------------- | ||||||
|  | 	int screenWidth = 800; | ||||||
|  | 	int screenHeight = 450; | ||||||
|  | >>>>>>> Added some functions and examples update | ||||||
|  |  | ||||||
|     Vector3 position = { 0.0, 0.0, 0.0 }; |     Vector3 position = { 0.0, 0.0, 0.0 }; | ||||||
|      |      | ||||||
|     // Define the camera to look into our 3d world |     // 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 }}; |     Camera camera = {{ 0.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }}; | ||||||
|      |      | ||||||
|     // Initialization |     // Initialization | ||||||
| @@ -28,9 +36,19 @@ int main() | |||||||
|     SetTargetFPS(60);   // Set our game to run at 60 frames-per-second |     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 |     // Main game loop | ||||||
|     while (!WindowShouldClose())    // Detect window close button or ESC key |     while (!WindowShouldClose())    // Detect window close button or ESC key | ||||||
|     { |     { | ||||||
|  | <<<<<<< HEAD | ||||||
|         // Update |         // Update | ||||||
|         //----------------------------------------------------- |         //----------------------------------------------------- | ||||||
|         // TODO: Update your variables here |         // TODO: Update your variables here | ||||||
| @@ -45,6 +63,22 @@ int main() | |||||||
|             Begin3dMode(camera); |             Begin3dMode(camera); | ||||||
|              |              | ||||||
|                 DrawCube(position, 2, 2, 2, RED);           // Draw a cube |                 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 |                 DrawCubeWires(position, 2, 2, 2, MAROON);   // Draw a wired-cube | ||||||
|                  |                  | ||||||
|                 // TODO: Draw some basic 3d shapes |                 // 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 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); | void DrawCylinderWires(Vector3 position, float radiusTop, float radiusBottom, float height, int slices, Color color); | ||||||
| */ | */ | ||||||
|  | <<<<<<< HEAD | ||||||
|                 DrawGrid(10.0, 1.0);        // Draw a grid |                 DrawGrid(10.0, 1.0);        // Draw a grid | ||||||
|                  |                  | ||||||
|             End3dMode(); |             End3dMode(); | ||||||
| @@ -73,5 +108,22 @@ void DrawCylinderWires(Vector3 position, float radiusTop, float radiusBottom, fl | |||||||
|     CloseWindow();        // Close window and OpenGL context |     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; |     return 0; | ||||||
| } | } | ||||||
| @@ -13,12 +13,20 @@ | |||||||
|  |  | ||||||
| int main() | int main() | ||||||
| { | { | ||||||
|  | <<<<<<< HEAD | ||||||
|     int screenWidth = 800; |     int screenWidth = 800; | ||||||
|     int screenHeight = 450; |     int screenHeight = 450; | ||||||
|  | ======= | ||||||
|  | 	// Initialization | ||||||
|  | 	//-------------------------------------------------------------------------------------- | ||||||
|  | 	int screenWidth = 800; | ||||||
|  | 	int screenHeight = 450; | ||||||
|  | >>>>>>> Added some functions and examples update | ||||||
|  |  | ||||||
|     Vector3 position = { 0.0, 0.0, 0.0 }; |     Vector3 position = { 0.0, 0.0, 0.0 }; | ||||||
|      |      | ||||||
|     // Define the camera to look into our 3d world |     // 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 }}; |     Camera camera = {{ 10.0, 8.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }}; | ||||||
|      |      | ||||||
|     // Initialization |     // Initialization | ||||||
| @@ -31,9 +39,22 @@ int main() | |||||||
|     Model cat = LoadModel("resources/cat.obj"); |     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 |     // Main game loop | ||||||
|     while (!WindowShouldClose())    // Detect window close button or ESC key |     while (!WindowShouldClose())    // Detect window close button or ESC key | ||||||
|     { |     { | ||||||
|  | <<<<<<< HEAD | ||||||
|         // Update |         // Update | ||||||
|         //----------------------------------------------------- |         //----------------------------------------------------- | ||||||
|         if (IsKeyPressed(KEY_LEFT)) position.x -= 0.2; |         if (IsKeyPressed(KEY_LEFT)) position.x -= 0.2; | ||||||
| @@ -51,10 +72,30 @@ int main() | |||||||
|             Begin3dMode(camera); |             Begin3dMode(camera); | ||||||
|              |              | ||||||
|                 DrawModelEx(cat, texture, position, 0.1f, WHITE);   // Draw 3d model with texture |                 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 |                 DrawGrid(10.0, 1.0);        // Draw a grid | ||||||
|                  |                  | ||||||
|                 DrawGizmo(position, false);  |                 DrawGizmo(position, false);  | ||||||
|  | <<<<<<< HEAD | ||||||
|                  |                  | ||||||
|             End3dMode(); |             End3dMode(); | ||||||
|              |              | ||||||
| @@ -66,11 +107,30 @@ int main() | |||||||
|  |  | ||||||
|     // De-Initialization |     // De-Initialization | ||||||
|     //--------------------------------------------------------- |     //--------------------------------------------------------- | ||||||
|  | ======= | ||||||
|  | 				 | ||||||
|  | 			End3dMode(); | ||||||
|  | 			 | ||||||
|  | 			DrawFPS(10, 10); | ||||||
|  | 		 | ||||||
|  |         EndDrawing(); | ||||||
|  | 		//---------------------------------------------------------------------------------- | ||||||
|  |     } | ||||||
|  |  | ||||||
|  | 	// De-Initialization | ||||||
|  | 	//-------------------------------------------------------------------------------------- | ||||||
|  | >>>>>>> Added some functions and examples update | ||||||
|     UnloadTexture(texture);     // Unload texture |     UnloadTexture(texture);     // Unload texture | ||||||
|     UnloadModel(cat);           // Unload model |     UnloadModel(cat);           // Unload model | ||||||
|      |      | ||||||
|     CloseWindow();        // Close window and OpenGL context |     CloseWindow();        // Close window and OpenGL context | ||||||
|     //---------------------------------------------------------- |     //---------------------------------------------------------- | ||||||
|      |      | ||||||
|  | <<<<<<< HEAD | ||||||
|  | ======= | ||||||
|  |     CloseWindow();		        // Close window and OpenGL context | ||||||
|  | 	//-------------------------------------------------------------------------------------- | ||||||
|  | 	 | ||||||
|  | >>>>>>> Added some functions and examples update | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
										
											Binary file not shown.
										
									
								
							| @@ -13,6 +13,7 @@ | |||||||
|  |  | ||||||
| int main() | int main() | ||||||
| { | { | ||||||
|  | <<<<<<< HEAD | ||||||
|     int screenWidth = 800; |     int screenWidth = 800; | ||||||
|     int screenHeight = 450; |     int screenHeight = 450; | ||||||
|      |      | ||||||
| @@ -28,9 +29,24 @@ int main() | |||||||
|     bool previousKeyState = currentKeyState; |     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 |     // Main game loop | ||||||
|     while (!WindowShouldClose())    // Detect window close button or ESC key |     while (!WindowShouldClose())    // Detect window close button or ESC key | ||||||
|     { |     { | ||||||
|  | <<<<<<< HEAD | ||||||
|         // Update |         // Update | ||||||
|         //----------------------------------------------------- |         //----------------------------------------------------- | ||||||
|         currentKeyState = IsKeyPressed(KEY_SPACE);      // Check if Space have been pressed |         currentKeyState = IsKeyPressed(KEY_SPACE);      // Check if Space have been pressed | ||||||
| @@ -65,5 +81,33 @@ int main() | |||||||
|     CloseWindow();            // Close window and OpenGL context |     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; |     return 0; | ||||||
| } | } | ||||||
| @@ -260,19 +260,25 @@ int GetHexValue(Color color);                           // Returns hexadecimal v | |||||||
| //------------------------------------------------------------------------------------ | //------------------------------------------------------------------------------------ | ||||||
| // Input Handling Functions (Module: core) | // Input Handling Functions (Module: core) | ||||||
| //------------------------------------------------------------------------------------ | //------------------------------------------------------------------------------------ | ||||||
| bool IsKeyPressed(int key);                             // Detect if a key is being pressed | bool IsKeyPressed(int key);                             // Detect if a key has been pressed once | ||||||
| bool IsKeyReleased(int key);                            // Detect if a key is NOT being pressed | 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 is being pressed | bool IsMouseButtonPressed(int button);                  // Detect if a mouse button has been pressed once | ||||||
| bool IsMouseButtonReleased(int button);                 // Detect if a mouse button is NOT being pressed | 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 GetMouseX();                                        // Returns mouse position X | ||||||
| int GetMouseY();                                        // Returns mouse position Y | int GetMouseY();                                        // Returns mouse position Y | ||||||
| Vector2 GetMousePosition();                             // Returns mouse position XY | Vector2 GetMousePosition();                             // Returns mouse position XY | ||||||
|  |  | ||||||
| bool IsGamepadAvailable(int gamepad);                   // Detect if a gamepad is available | bool IsGamepadAvailable(int gamepad);                   // Detect if a gamepad is available | ||||||
| Vector2 GetGamepadMovement(int gamepad);                // Return axis movement vector for a gamepad | 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 IsGamepadButtonPressed(int gamepad, int button);   // Detect if a gamepad button has been pressed once | ||||||
| bool IsGamepadButtonReleased(int gamepad, int button);  // Detect if a gamepad button is NOT being pressed | 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) | // 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 UnloadTexture(Texture2D texture);                                                             // Unload texture from GPU memory | ||||||
| void DrawTexture(Texture2D texture, int posX, int posY, Color tint);                               // Draw a Texture2D | 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 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) | // Font Loading and Text Drawing Functions (Module: text) | ||||||
| //------------------------------------------------------------------------------------ | //------------------------------------------------------------------------------------ | ||||||
| SpriteFont LoadSpriteFont(const char *fileName);                                                   // Load a SpriteFont image into GPU memory | SpriteFont LoadSpriteFont(const char *fileName);                                                   // Load a SpriteFont image into GPU memory | ||||||
| void UnloadSpriteFont(SpriteFont spriteFont);                                                      // Unload SpriteFont from 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 | 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 | 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) | 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' | const char *FormatText(const char *text, ...);                                                     // Formatting of text with variables to 'embed' | ||||||
|  |  | ||||||
| //------------------------------------------------------------------------------------ | //------------------------------------------------------------------------------------ | ||||||
|   | |||||||
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										117
									
								
								src/core.c
									
									
									
									
									
								
							
							
						
						
									
										117
									
								
								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 int windowWidth, windowHeight;       // Required to switch between windowed/fullscren mode (F11) | ||||||
| static char *windowTitle;                   // 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) | // Other Modules Functions Declaration (required by core) | ||||||
| //---------------------------------------------------------------------------------- | //---------------------------------------------------------------------------------- | ||||||
| @@ -289,29 +298,97 @@ int GetHexValue(Color color) | |||||||
| // Module Functions Definition - Input (Keyboard, Mouse, Gamepad) Functions | // 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 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; |     if (glfwGetKey(window, key) == GLFW_PRESS) return true; | ||||||
|     else return false; |     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 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; |     if (glfwGetKey(window, key) == GLFW_RELEASE) return true; | ||||||
|     else return false; |     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 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; |     if (glfwGetMouseButton(window, button) == GLFW_PRESS) return true; | ||||||
|     else return false; |     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 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; |     if (glfwGetMouseButton(window, button) == GLFW_RELEASE) return true; | ||||||
|     else return false; |     else return false; | ||||||
| @@ -385,6 +462,22 @@ Vector2 GetGamepadMovement(int gamepad) | |||||||
|  |  | ||||||
| // Detect if a gamepad button is being pressed | // Detect if a gamepad button is being pressed | ||||||
| bool IsGamepadButtonPressed(int gamepad, int button) | 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; |     const unsigned char* buttons; | ||||||
|     int buttonsCount; |     int buttonsCount; | ||||||
| @@ -400,6 +493,22 @@ bool IsGamepadButtonPressed(int gamepad, int button) | |||||||
|  |  | ||||||
| // Detect if a gamepad button is NOT being pressed | // Detect if a gamepad button is NOT being pressed | ||||||
| bool IsGamepadButtonReleased(int gamepad, int button) | 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; |     const unsigned char* buttons; | ||||||
|     int buttonsCount; |     int buttonsCount; | ||||||
|   | |||||||
							
								
								
									
										27
									
								
								src/raylib.h
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								src/raylib.h
									
									
									
									
									
								
							| @@ -260,19 +260,25 @@ int GetHexValue(Color color);                           // Returns hexadecimal v | |||||||
| //------------------------------------------------------------------------------------ | //------------------------------------------------------------------------------------ | ||||||
| // Input Handling Functions (Module: core) | // Input Handling Functions (Module: core) | ||||||
| //------------------------------------------------------------------------------------ | //------------------------------------------------------------------------------------ | ||||||
| bool IsKeyPressed(int key);                             // Detect if a key is being pressed | bool IsKeyPressed(int key);                             // Detect if a key has been pressed once | ||||||
| bool IsKeyReleased(int key);                            // Detect if a key is NOT being pressed | 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 is being pressed | bool IsMouseButtonPressed(int button);                  // Detect if a mouse button has been pressed once | ||||||
| bool IsMouseButtonReleased(int button);                 // Detect if a mouse button is NOT being pressed | 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 GetMouseX();                                        // Returns mouse position X | ||||||
| int GetMouseY();                                        // Returns mouse position Y | int GetMouseY();                                        // Returns mouse position Y | ||||||
| Vector2 GetMousePosition();                             // Returns mouse position XY | Vector2 GetMousePosition();                             // Returns mouse position XY | ||||||
|  |  | ||||||
| bool IsGamepadAvailable(int gamepad);                   // Detect if a gamepad is available | bool IsGamepadAvailable(int gamepad);                   // Detect if a gamepad is available | ||||||
| Vector2 GetGamepadMovement(int gamepad);                // Return axis movement vector for a gamepad | 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 IsGamepadButtonPressed(int gamepad, int button);   // Detect if a gamepad button has been pressed once | ||||||
| bool IsGamepadButtonReleased(int gamepad, int button);  // Detect if a gamepad button is NOT being pressed | 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) | // 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 UnloadTexture(Texture2D texture);                                                             // Unload texture from GPU memory | ||||||
| void DrawTexture(Texture2D texture, int posX, int posY, Color tint);                               // Draw a Texture2D | 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 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) | // Font Loading and Text Drawing Functions (Module: text) | ||||||
| //------------------------------------------------------------------------------------ | //------------------------------------------------------------------------------------ | ||||||
| SpriteFont LoadSpriteFont(const char *fileName);                                                   // Load a SpriteFont image into GPU memory | SpriteFont LoadSpriteFont(const char *fileName);                                                   // Load a SpriteFont image into GPU memory | ||||||
| void UnloadSpriteFont(SpriteFont spriteFont);                                                      // Unload SpriteFont from 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 | 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 | 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) | 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' | const char *FormatText(const char *text, ...);                                                     // Formatting of text with variables to 'embed' | ||||||
|  |  | ||||||
| //------------------------------------------------------------------------------------ | //------------------------------------------------------------------------------------ | ||||||
|   | |||||||
							
								
								
									
										15
									
								
								src/text.c
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								src/text.c
									
									
									
									
									
								
							| @@ -283,11 +283,11 @@ void UnloadSpriteFont(SpriteFont spriteFont) | |||||||
|  |  | ||||||
| // Draw text (using default font) | // 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 | // 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 }; |     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' | // 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 | // Measure string width for default font | ||||||
| int MeasureText(const char *text, int fontSize, int spacing) | int MeasureText(const char *text, int fontSize) | ||||||
| { | { | ||||||
|     Vector2 vec; |     Vector2 vec; | ||||||
|  |  | ||||||
|     vec = MeasureTextEx(defaultFont, text, fontSize, spacing); |     vec = MeasureTextEx(defaultFont, text, fontSize, 1); | ||||||
|  |  | ||||||
|     return (int)vec.x; |     return (int)vec.x; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| // Measure string size for SpriteFont | // Measure string size for SpriteFont | ||||||
| Vector2 MeasureTextEx(SpriteFont spriteFont, const char *text, int fontSize, int spacing) | 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 | // Shows current FPS on top-left corner | ||||||
| // NOTE: Uses default font | // 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 |     // NOTE: We are rendering fps every second for better viewing on high framerates | ||||||
|     static float fps; |     static float fps; | ||||||
| @@ -403,7 +402,7 @@ void DrawFps(int posX, int posY) | |||||||
|     if (counter < refreshRate) |     if (counter < refreshRate) | ||||||
|     { |     { | ||||||
|         sprintf(buffer, "%2.0f FPS", fps); |         sprintf(buffer, "%2.0f FPS", fps); | ||||||
|         DrawText(buffer, posX, posY, 20, 1, LIME); |         DrawText(buffer, posX, posY, 20, LIME); | ||||||
|          |          | ||||||
|         counter++; |         counter++; | ||||||
|     } |     } | ||||||
| @@ -412,7 +411,7 @@ void DrawFps(int posX, int posY) | |||||||
|         fps = GetFPS(); |         fps = GetFPS(); | ||||||
|         refreshRate = fps; |         refreshRate = fps; | ||||||
|         sprintf(buffer, "%2.0f FPS", fps); |         sprintf(buffer, "%2.0f FPS", fps); | ||||||
|         DrawText(buffer, posX, posY, 20, 1, LIME); |         DrawText(buffer, posX, posY, 20, LIME); | ||||||
|          |          | ||||||
|         counter = 0; |         counter = 0; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -197,7 +197,7 @@ void DrawTextureEx(Texture2D texture, Vector2 position, float rotation, float sc | |||||||
| } | } | ||||||
|  |  | ||||||
| // Draw a part of a texture (defined by a rectangle) | // 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 |     glEnable(GL_TEXTURE_2D);    // Enable textures usage | ||||||
|      |      | ||||||
| @@ -205,7 +205,7 @@ void DrawTextureRec(Texture2D texture, Rectangle sourceRec, Vector2 position, fl | |||||||
|      |      | ||||||
|     glPushMatrix(); |     glPushMatrix(); | ||||||
|         glTranslatef(position.x, position.y, 0); |         glTranslatef(position.x, position.y, 0); | ||||||
|         glScalef(scale, scale, 1.0f); |         //glScalef(1.0f, 1.0f, 1.0f); | ||||||
|         //glRotatef(rotation, 0, 0, 1); |         //glRotatef(rotation, 0, 0, 1); | ||||||
|          |          | ||||||
|         glBegin(GL_QUADS); |         glBegin(GL_QUADS); | ||||||
| @@ -233,6 +233,44 @@ void DrawTextureRec(Texture2D texture, Rectangle sourceRec, Vector2 position, fl | |||||||
|     glDisable(GL_TEXTURE_2D);    // Disable textures usage |     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 | // 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 | // 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) | extern void WriteBitmap(const char *fileName, const Color *imgDataPixel, int width, int height) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 raysan5
					raysan5