mirror of
				https://github.com/raysan5/raylib.git
				synced 2025-10-26 12:27:01 +00:00 
			
		
		
		
	Review literals type
This commit is contained in:
		| @@ -27,7 +27,7 @@ int main() | |||||||
|     PlayMusicStream("resources/audio/guitar_noodling.ogg");         // Play music stream |     PlayMusicStream("resources/audio/guitar_noodling.ogg");         // Play music stream | ||||||
|  |  | ||||||
|     int framesCounter = 0; |     int framesCounter = 0; | ||||||
|     float timePlayed = 0; |     float timePlayed = 0.0f; | ||||||
|     //float volume = 1.0; |     //float volume = 1.0; | ||||||
|  |  | ||||||
|     SetTargetFPS(60);               // Set our game to run at 60 frames-per-second |     SetTargetFPS(60);               // Set our game to run at 60 frames-per-second | ||||||
|   | |||||||
| @@ -26,6 +26,8 @@ int main() | |||||||
|  |  | ||||||
|     Sound fxWav = LoadSound("resources/audio/weird.wav");         // Load WAV audio file |     Sound fxWav = LoadSound("resources/audio/weird.wav");         // Load WAV audio file | ||||||
|     Sound fxOgg = LoadSound("resources/audio/tanatana.ogg");      // Load OGG audio file |     Sound fxOgg = LoadSound("resources/audio/tanatana.ogg");      // Load OGG audio file | ||||||
|  |      | ||||||
|  |     SetTargetFPS(60); | ||||||
|     //-------------------------------------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|  |  | ||||||
|     // Main game loop |     // Main game loop | ||||||
|   | |||||||
| @@ -23,7 +23,7 @@ int main() | |||||||
|     InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera first person"); |     InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera first person"); | ||||||
|      |      | ||||||
|     // Define the camera to look into our 3d world |     // Define the camera to look into our 3d world | ||||||
|     Camera camera = {{ 0.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }}; |     Camera camera = {{ 0.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }}; | ||||||
|  |  | ||||||
|     // Generates some random columns |     // Generates some random columns | ||||||
|     float heights[MAX_COLUMNS]; |     float heights[MAX_COLUMNS]; | ||||||
| @@ -37,7 +37,7 @@ int main() | |||||||
|         colors[i] = (Color){ GetRandomValue(20, 255), GetRandomValue(10, 55), 30, 255 }; |         colors[i] = (Color){ GetRandomValue(20, 255), GetRandomValue(10, 55), 30, 255 }; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     Vector3 playerPosition = { 4, 2, 4 };       // Define player position |     Vector3 playerPosition = { 4.0f, 2.0f, 4.0f };       // Define player position | ||||||
|      |      | ||||||
|     SetCameraMode(CAMERA_FIRST_PERSON);         // Set a first person camera mode |     SetCameraMode(CAMERA_FIRST_PERSON);         // Set a first person camera mode | ||||||
|  |  | ||||||
| @@ -60,16 +60,16 @@ int main() | |||||||
|  |  | ||||||
|             Begin3dMode(camera); |             Begin3dMode(camera); | ||||||
|  |  | ||||||
|                 DrawPlane((Vector3){ 0, 0, 0 }, (Vector2){ 32, 32 }, LIGHTGRAY); // Draw ground |                 DrawPlane((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector2){ 32.0f, 32.0f }, LIGHTGRAY); // Draw ground | ||||||
|                 DrawCube((Vector3){ -16, 2.5, 0 }, 1, 5, 32, BLUE);     // Draw a blue wall |                 DrawCube((Vector3){ -16.0f, 2.5f, 0.0f }, 1.0f, 5.0f, 32.0f, BLUE);     // Draw a blue wall | ||||||
|                 DrawCube((Vector3){ 16, 2.5, 0 }, 1, 5, 32, LIME);      // Draw a green wall |                 DrawCube((Vector3){ 16.0f, 2.5f, 0.0f }, 1.0f, 5.0f, 32.0f, LIME);      // Draw a green wall | ||||||
|                 DrawCube((Vector3){ 0, 2.5, 16 }, 32, 5, 1, GOLD);      // Draw a yellow wall |                 DrawCube((Vector3){ 0.0f, 2.5f, 16.0f }, 32.0f, 5.0f, 1.0f, GOLD);      // Draw a yellow wall | ||||||
|              |              | ||||||
|                 // Draw some cubes around |                 // Draw some cubes around | ||||||
|                 for (int i = 0; i < MAX_COLUMNS; i++) |                 for (int i = 0; i < MAX_COLUMNS; i++) | ||||||
|                 { |                 { | ||||||
|                     DrawCube(positions[i], 2, heights[i], 2, colors[i]); |                     DrawCube(positions[i], 2.0f, heights[i], 2.0f, colors[i]); | ||||||
|                     DrawCubeWires(positions[i], 2, heights[i], 2, MAROON); |                     DrawCubeWires(positions[i], 2.0f, heights[i], 2.0f, MAROON); | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|             End3dMode(); |             End3dMode(); | ||||||
|   | |||||||
| @@ -21,9 +21,12 @@ int main() | |||||||
|     InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free"); |     InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free"); | ||||||
|  |  | ||||||
|     // Define the camera to look into our 3d world |     // Define the camera to look into our 3d world | ||||||
|     Camera camera = {{ 0.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }}; |     Camera camera; | ||||||
|  |     camera.position = (Vector3){ 0.0f, 10.0f, 10.0f }; | ||||||
|  |     camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; | ||||||
|  |     camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; | ||||||
|  |  | ||||||
|     Vector3 cubePosition = { 0.0, 0.0, 0.0 }; |     Vector3 cubePosition = { 0.0f, 0.0f, 0.0f }; | ||||||
|      |      | ||||||
|     SetCameraMode(CAMERA_FREE);         // Set a free camera mode |     SetCameraMode(CAMERA_FREE);         // Set a free camera mode | ||||||
|     SetCameraPosition(camera.position); // Set internal camera position to match our camera position |     SetCameraPosition(camera.position); // Set internal camera position to match our camera position | ||||||
| @@ -48,10 +51,10 @@ int main() | |||||||
|  |  | ||||||
|             Begin3dMode(camera); |             Begin3dMode(camera); | ||||||
|  |  | ||||||
|                 DrawCube(cubePosition, 2, 2, 2, RED); |                 DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED); | ||||||
|                 DrawCubeWires(cubePosition, 2, 2, 2, MAROON); |                 DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON); | ||||||
|  |  | ||||||
|                 DrawGrid(10.0, 1.0); |                 DrawGrid(10, 1.0f); | ||||||
|  |  | ||||||
|             End3dMode(); |             End3dMode(); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -22,11 +22,11 @@ int main() | |||||||
|  |  | ||||||
|     // Define the camera to look into our 3d world |     // Define the camera to look into our 3d world | ||||||
|     Camera camera; |     Camera camera; | ||||||
|     camera.position = (Vector3){ 0.0, 10.0, 10.0 }; |     camera.position = (Vector3){ 0.0f, 10.0f, 10.0f }; | ||||||
|     camera.target = (Vector3){ 0.0, 0.0, 0.0 }; |     camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; | ||||||
|     camera.up = (Vector3){ 0.0, 1.0, 0.0 }; |     camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; | ||||||
|  |  | ||||||
|     Vector3 cubePosition = { 0.0, 0.0, 0.0 }; |     Vector3 cubePosition = { 0.0f, 0.0f, 0.0f }; | ||||||
|  |  | ||||||
|     SetTargetFPS(60);   // Set our game to run at 60 frames-per-second |     SetTargetFPS(60);   // Set our game to run at 60 frames-per-second | ||||||
|     //-------------------------------------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
| @@ -47,10 +47,10 @@ int main() | |||||||
|  |  | ||||||
|             Begin3dMode(camera); |             Begin3dMode(camera); | ||||||
|  |  | ||||||
|                 DrawCube(cubePosition, 2.0, 2.0, 2.0, RED); |                 DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED); | ||||||
|                 DrawCubeWires(cubePosition, 2.0, 2.0, 2.0, MAROON); |                 DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON); | ||||||
|  |  | ||||||
|                 DrawGrid(10.0, 1.0); |                 DrawGrid(10, 1.0f); | ||||||
|  |  | ||||||
|             End3dMode(); |             End3dMode(); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -21,10 +21,10 @@ int main() | |||||||
|     InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d picking"); |     InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d picking"); | ||||||
|  |  | ||||||
|     // Define the camera to look into our 3d world |     // Define the camera to look into our 3d world | ||||||
|     Camera camera = {{ 0.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }}; |     Camera camera = {{ 0.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }}; | ||||||
|  |  | ||||||
|     Vector3 cubePosition = { 0.0, 1.0, 0.0 }; |     Vector3 cubePosition = { 0.0f, 1.0f, 0.0f }; | ||||||
|     Vector3 cubeSize = { 2.0, 2.0, 2.0 }; |     Vector3 cubeSize = { 2.0f, 2.0f, 2.0f }; | ||||||
|      |      | ||||||
|     Ray ray;        // Picking line ray |     Ray ray;        // Picking line ray | ||||||
|      |      | ||||||
| @@ -66,10 +66,10 @@ int main() | |||||||
|                 DrawCube(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, GRAY); |                 DrawCube(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, GRAY); | ||||||
|                 DrawCubeWires(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, DARKGRAY); |                 DrawCubeWires(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, DARKGRAY); | ||||||
|                  |                  | ||||||
|                 DrawGrid(10.0, 1.0); |  | ||||||
|                  |  | ||||||
|                 DrawRay(ray, MAROON); |                 DrawRay(ray, MAROON); | ||||||
|                  |                  | ||||||
|  |                 DrawGrid(10, 1.0f); | ||||||
|  |  | ||||||
|             End3dMode(); |             End3dMode(); | ||||||
|              |              | ||||||
|             DrawText("Try selecting the box with mouse!", 240, 10, 20, GRAY); |             DrawText("Try selecting the box with mouse!", 240, 10, 20, GRAY); | ||||||
|   | |||||||
| @@ -29,6 +29,8 @@ int main() | |||||||
|     int screenHeight = 450; |     int screenHeight = 450; | ||||||
|  |  | ||||||
|     InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window"); |     InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window"); | ||||||
|  |      | ||||||
|  |     SetTargetFPS(60); | ||||||
|     //-------------------------------------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|  |  | ||||||
|     // Main game loop |     // Main game loop | ||||||
|   | |||||||
| @@ -23,8 +23,8 @@ int main() | |||||||
|  |  | ||||||
|     InitWindow(screenWidth, screenHeight, "raylib [core] example - gamepad input"); |     InitWindow(screenWidth, screenHeight, "raylib [core] example - gamepad input"); | ||||||
|  |  | ||||||
|     Vector2 ballPosition = { screenWidth/2, screenHeight/2 }; |     Vector2 ballPosition = { (float)screenWidth/2, (float)screenHeight/2 }; | ||||||
|     Vector2 gamepadMovement = { 0, 0 }; |     Vector2 gamepadMovement = { 0.0f, 0.0f }; | ||||||
|  |  | ||||||
|     SetTargetFPS(60);               // Set target frames-per-second |     SetTargetFPS(60);               // Set target frames-per-second | ||||||
|     //-------------------------------------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
| @@ -43,8 +43,8 @@ int main() | |||||||
|  |  | ||||||
|             if (IsGamepadButtonPressed(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_A)) |             if (IsGamepadButtonPressed(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_A)) | ||||||
|             { |             { | ||||||
|                 ballPosition.x = screenWidth/2; |                 ballPosition.x = (float)screenWidth/2; | ||||||
|                 ballPosition.y = screenHeight/2; |                 ballPosition.y = (float)screenHeight/2; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         //---------------------------------------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|   | |||||||
| @@ -20,7 +20,7 @@ int main() | |||||||
|  |  | ||||||
|     InitWindow(screenWidth, screenHeight, "raylib [core] example - keyboard input"); |     InitWindow(screenWidth, screenHeight, "raylib [core] example - keyboard input"); | ||||||
|  |  | ||||||
|     Vector2 ballPosition = { screenWidth/2, screenHeight/2 }; |     Vector2 ballPosition = { (float)screenWidth/2, (float)screenHeight/2 }; | ||||||
|  |  | ||||||
|     SetTargetFPS(60);       // Set target frames-per-second |     SetTargetFPS(60);       // Set target frames-per-second | ||||||
|     //-------------------------------------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
| @@ -30,10 +30,10 @@ int main() | |||||||
|     { |     { | ||||||
|         // Update |         // Update | ||||||
|         //---------------------------------------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|         if (IsKeyDown(KEY_RIGHT)) ballPosition.x += 0.8; |         if (IsKeyDown(KEY_RIGHT)) ballPosition.x += 0.8f; | ||||||
|         if (IsKeyDown(KEY_LEFT)) ballPosition.x -= 0.8; |         if (IsKeyDown(KEY_LEFT)) ballPosition.x -= 0.8f; | ||||||
|         if (IsKeyDown(KEY_UP)) ballPosition.y -= 0.8; |         if (IsKeyDown(KEY_UP)) ballPosition.y -= 0.8f; | ||||||
|         if (IsKeyDown(KEY_DOWN)) ballPosition.y += 0.8; |         if (IsKeyDown(KEY_DOWN)) ballPosition.y += 0.8f; | ||||||
|         //---------------------------------------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|  |  | ||||||
|         // Draw |         // Draw | ||||||
|   | |||||||
| @@ -20,8 +20,9 @@ int main() | |||||||
|  |  | ||||||
|     InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse input"); |     InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse input"); | ||||||
|  |  | ||||||
|     int mouseX, mouseY; |     Vector2 ballPosition = { -100.0f, -100.0f }; | ||||||
|     Vector2 ballPosition = { -100.0, -100.0 }; |      | ||||||
|  |     SetTargetFPS(60); | ||||||
|     //--------------------------------------------------------------------------------------- |     //--------------------------------------------------------------------------------------- | ||||||
|  |  | ||||||
|     // Main game loop |     // Main game loop | ||||||
| @@ -31,11 +32,7 @@ int main() | |||||||
|         //---------------------------------------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|         if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) |         if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) | ||||||
|         { |         { | ||||||
|             mouseX = GetMouseX(); |             ballPosition = GetMousePosition(); | ||||||
|             mouseY = GetMouseY(); |  | ||||||
|  |  | ||||||
|             ballPosition.x = (float)mouseX; |  | ||||||
|             ballPosition.y = (float)mouseY; |  | ||||||
|         } |         } | ||||||
|         //---------------------------------------------------------------------------------- |         //---------------------------------------------------------------------------------- | ||||||
|  |  | ||||||
|   | |||||||
| @@ -21,9 +21,9 @@ int main() | |||||||
|     InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free"); |     InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free"); | ||||||
|  |  | ||||||
|     // Define the camera to look into our 3d world |     // Define the camera to look into our 3d world | ||||||
|     Camera camera = {{ 0.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }}; |     Camera camera = {{ 0.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }}; | ||||||
|  |  | ||||||
|     Vector3 cubePosition = { 0.0, 0.0, 0.0 }; |     Vector3 cubePosition = { 0.0f, 0.0f, 0.0f }; | ||||||
|      |      | ||||||
|     Vector2 cubeScreenPosition; |     Vector2 cubeScreenPosition; | ||||||
|      |      | ||||||
| @@ -53,10 +53,10 @@ int main() | |||||||
|  |  | ||||||
|             Begin3dMode(camera); |             Begin3dMode(camera); | ||||||
|  |  | ||||||
|                 DrawCube(cubePosition, 2, 2, 2, RED); |                 DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED); | ||||||
|                 DrawCubeWires(cubePosition, 2, 2, 2, MAROON); |                 DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON); | ||||||
|  |  | ||||||
|                 DrawGrid(10.0, 1.0); |                 DrawGrid(10, 1.0f); | ||||||
|  |  | ||||||
|             End3dMode(); |             End3dMode(); | ||||||
|              |              | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| /******************************************************************************************* | /******************************************************************************************* | ||||||
| * | * | ||||||
| *   raylib [lighting] example - Basic Phong lighting | *   raylib [shaders] example - Blinn-Phong lighting | ||||||
| * | * | ||||||
| *   This example has been created using raylib 1.3 (www.raylib.com) | *   This example has been created using raylib 1.3 (www.raylib.com) | ||||||
| *   raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) | *   raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) | ||||||
| @@ -22,14 +22,14 @@ int main() | |||||||
|     const int screenHeight = 450; |     const int screenHeight = 450; | ||||||
|      |      | ||||||
|     SetConfigFlags(FLAG_MSAA_4X_HINT); |     SetConfigFlags(FLAG_MSAA_4X_HINT); | ||||||
|     InitWindow(screenWidth, screenHeight, "raylib [lighting] example - blinn phong lighting"); |     InitWindow(screenWidth, screenHeight, "raylib [shaders] example - blinn-phong lighting"); | ||||||
|     SetTargetFPS(60); |     SetTargetFPS(60); | ||||||
|      |      | ||||||
|     // Camera initialization |     // Camera initialization | ||||||
|     Camera camera = {{ 10.0, 8.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }}; |     Camera camera = {{ 8.0f, 8.0f, 8.0f }, { 0.0f, 3.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }}; | ||||||
|      |      | ||||||
|     // Model initialization |     // Model initialization | ||||||
|     Vector3 position = { 0.0, 0.0, 0.0 }; |     Vector3 position = { 0.0f, 0.0f, 0.0f }; | ||||||
|     Model model = LoadModel("resources/model/dwarf.obj"); |     Model model = LoadModel("resources/model/dwarf.obj"); | ||||||
|     Shader shader = LoadShader("resources/shaders/phong.vs", "resources/shaders/phong.fs"); |     Shader shader = LoadShader("resources/shaders/phong.vs", "resources/shaders/phong.fs"); | ||||||
|     SetModelShader(&model, shader); |     SetModelShader(&model, shader); | ||||||
| @@ -54,7 +54,7 @@ int main() | |||||||
|     Material matBlinn; |     Material matBlinn; | ||||||
|      |      | ||||||
|     // Light initialization |     // Light initialization | ||||||
|     light.position = (Vector3){ 5.0f, 1.0f, 1.0f }; |     light.position = (Vector3){ 4.0f, 2.0f, 0.0f }; | ||||||
|     light.direction = (Vector3){ 5.0f, 1.0f, 1.0f }; |     light.direction = (Vector3){ 5.0f, 1.0f, 1.0f }; | ||||||
|     light.intensity = 1.0f; |     light.intensity = 1.0f; | ||||||
|     light.diffuse = WHITE; |     light.diffuse = WHITE; | ||||||
| @@ -129,7 +129,9 @@ int main() | |||||||
|             Begin3dMode(camera); |             Begin3dMode(camera); | ||||||
|                  |                  | ||||||
|                 DrawModel(model, position, 4.0f, matBlinn.diffuse); |                 DrawModel(model, position, 4.0f, matBlinn.diffuse); | ||||||
|                 DrawSphere(light.position, 1.0f, YELLOW); |                 DrawSphere(light.position, 0.5f, GOLD); | ||||||
|  |                  | ||||||
|  |                 DrawGrid(20, 1.0f); | ||||||
|                  |                  | ||||||
|             End3dMode(); |             End3dMode(); | ||||||
|              |              | ||||||
|   | |||||||
| @@ -21,10 +21,10 @@ int main() | |||||||
|     InitWindow(screenWidth, screenHeight, "raylib [models] example - drawing billboards"); |     InitWindow(screenWidth, screenHeight, "raylib [models] example - drawing billboards"); | ||||||
|  |  | ||||||
|     // Define the camera to look into our 3d world |     // Define the camera to look into our 3d world | ||||||
|     Camera camera = {{ 5.0, 4.0, 5.0 }, { 0.0, 2.0, 0.0 }, { 0.0, 1.0, 0.0 }}; |     Camera camera = {{ 5.0f, 4.0f, 5.0f }, { 0.0f, 2.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }}; | ||||||
|  |  | ||||||
|     Texture2D bill = LoadTexture("resources/billboard.png");     // Our texture billboard |     Texture2D bill = LoadTexture("resources/billboard.png");     // Our texture billboard | ||||||
|     Vector3 billPosition = { 0.0, 2.0, 0.0 };                   // Position where draw billboard |     Vector3 billPosition = { 0.0f, 2.0f, 0.0f };                 // Position where draw billboard | ||||||
|      |      | ||||||
|     SetCameraMode(CAMERA_ORBITAL);      // Set an orbital camera mode |     SetCameraMode(CAMERA_ORBITAL);      // Set an orbital camera mode | ||||||
|     SetCameraPosition(camera.position); // Set internal camera position to match our camera position |     SetCameraPosition(camera.position); // Set internal camera position to match our camera position | ||||||
| @@ -49,10 +49,10 @@ int main() | |||||||
|  |  | ||||||
|             Begin3dMode(camera); |             Begin3dMode(camera); | ||||||
|              |              | ||||||
|                 DrawGrid(10.0, 1.0);        // Draw a grid |  | ||||||
|  |  | ||||||
|                 DrawBillboard(camera, bill, billPosition, 2.0f, WHITE); |                 DrawBillboard(camera, bill, billPosition, 2.0f, WHITE); | ||||||
|                  |                  | ||||||
|  |                 DrawGrid(10, 1.0f);        // Draw a grid | ||||||
|  |  | ||||||
|             End3dMode(); |             End3dMode(); | ||||||
|  |  | ||||||
|             DrawFPS(10, 10); |             DrawFPS(10, 10); | ||||||
|   | |||||||
| @@ -21,16 +21,16 @@ int main() | |||||||
|     InitWindow(screenWidth, screenHeight, "raylib [models] example - box collisions"); |     InitWindow(screenWidth, screenHeight, "raylib [models] example - box collisions"); | ||||||
|  |  | ||||||
|     // Define the camera to look into our 3d world |     // Define the camera to look into our 3d world | ||||||
|     Camera camera = {{ 0.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }}; |     Camera camera = {{ 0.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }}; | ||||||
|      |      | ||||||
|     Vector3 playerPosition = { 0, 1, 2 }; |     Vector3 playerPosition = { 0.0f, 1.0f, 2.0f }; | ||||||
|     Vector3 playerSize = { 1, 2, 1 }; |     Vector3 playerSize = { 1.0f, 2.0f, 1.0f }; | ||||||
|     Color playerColor = GREEN; |     Color playerColor = GREEN; | ||||||
|      |      | ||||||
|     Vector3 enemyBoxPos = { -4, 1, 0 }; |     Vector3 enemyBoxPos = { -4.0f, 1.0f, 0.0f }; | ||||||
|     Vector3 enemyBoxSize = { 2, 2, 2 }; |     Vector3 enemyBoxSize = { 2.0f, 2.0f, 2.0f }; | ||||||
|      |      | ||||||
|     Vector3 enemySpherePos = { 4, 0, 0 }; |     Vector3 enemySpherePos = { 4.0f, 0.0f, 0.0f }; | ||||||
|     float enemySphereSize = 1.5f; |     float enemySphereSize = 1.5f; | ||||||
|      |      | ||||||
|     bool collision = false; |     bool collision = false; | ||||||
| @@ -98,7 +98,7 @@ int main() | |||||||
|                 // Draw player |                 // Draw player | ||||||
|                 DrawCubeV(playerPosition, playerSize, playerColor); |                 DrawCubeV(playerPosition, playerSize, playerColor); | ||||||
|  |  | ||||||
|                 DrawGrid(10.0, 1.0);        // Draw a grid |                 DrawGrid(10, 1.0f);        // Draw a grid | ||||||
|  |  | ||||||
|             End3dMode(); |             End3dMode(); | ||||||
|              |              | ||||||
|   | |||||||
| @@ -21,7 +21,7 @@ int main() | |||||||
|     InitWindow(screenWidth, screenHeight, "raylib [models] example - cubesmap loading and drawing"); |     InitWindow(screenWidth, screenHeight, "raylib [models] example - cubesmap loading and drawing"); | ||||||
|  |  | ||||||
|     // Define the camera to look into our 3d world |     // Define the camera to look into our 3d world | ||||||
|     Camera camera = {{ 16.0, 14.0, 16.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }}; |     Camera camera = {{ 16.0f, 14.0f, 16.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }}; | ||||||
|  |  | ||||||
|     Image image = LoadImage("resources/cubicmap.png");      // Load cubicmap image (RAM) |     Image image = LoadImage("resources/cubicmap.png");      // Load cubicmap image (RAM) | ||||||
|     Texture2D cubicmap = LoadTextureFromImage(image);       // Convert image to texture to display (VRAM) |     Texture2D cubicmap = LoadTextureFromImage(image);       // Convert image to texture to display (VRAM) | ||||||
| @@ -31,7 +31,7 @@ int main() | |||||||
|     Texture2D texture = LoadTexture("resources/cubicmap_atlas.png");    // Load map texture |     Texture2D texture = LoadTexture("resources/cubicmap_atlas.png");    // Load map texture | ||||||
|     SetModelTexture(&map, texture);                         // Bind texture to map model |     SetModelTexture(&map, texture);                         // Bind texture to map model | ||||||
|      |      | ||||||
|     Vector3 mapPosition = { -16, 0.0, -8 };                 // Set model position |     Vector3 mapPosition = { -16.0f, 0.0f, -8.0f };          // Set model position | ||||||
|  |  | ||||||
|     UnloadImage(image);     // Unload cubesmap image from RAM, already uploaded to VRAM |     UnloadImage(image);     // Unload cubesmap image from RAM, already uploaded to VRAM | ||||||
|      |      | ||||||
|   | |||||||
| @@ -21,7 +21,7 @@ int main() | |||||||
|     InitWindow(screenWidth, screenHeight, "raylib [models] example - geometric shapes"); |     InitWindow(screenWidth, screenHeight, "raylib [models] example - geometric shapes"); | ||||||
|  |  | ||||||
|     // Define the camera to look into our 3d world |     // Define the camera to look into our 3d world | ||||||
|     Camera camera = {{ 0.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }}; |     Camera camera = {{ 0.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }}; | ||||||
|  |  | ||||||
|     SetTargetFPS(60);   // Set our game to run at 60 frames-per-second |     SetTargetFPS(60);   // Set our game to run at 60 frames-per-second | ||||||
|     //-------------------------------------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
| @@ -42,21 +42,21 @@ int main() | |||||||
|  |  | ||||||
|             Begin3dMode(camera); |             Begin3dMode(camera); | ||||||
|  |  | ||||||
|                 DrawCube((Vector3){-4, 0, 2}, 2, 5, 2, RED); |                 DrawCube((Vector3){-4.0f, 0.0f, 2.0f}, 2.0f, 5.0f, 2.0f, RED); | ||||||
|                 DrawCubeWires((Vector3){-4, 0, 2}, 2, 5, 2, GOLD); |                 DrawCubeWires((Vector3){-4.0f, 0.0f, 2.0f}, 2.0f, 5.0f, 2.0f, GOLD); | ||||||
|                 DrawCubeWires((Vector3){-4, 0, -2}, 3, 6, 2, MAROON); |                 DrawCubeWires((Vector3){-4.0f, 0.0f, -2.0f}, 3.0f, 6.0f, 2.0f, MAROON); | ||||||
|  |  | ||||||
|                 DrawSphere((Vector3){-1, 0, -2}, 1, GREEN); |                 DrawSphere((Vector3){-1.0f, 0.0f, -2.0f}, 1.0f, GREEN); | ||||||
|                 DrawSphereWires((Vector3){1, 0, 2}, 2, 16, 16, LIME); |                 DrawSphereWires((Vector3){1.0f, 0.0f, 2.0f}, 2.0f, 16, 16, LIME); | ||||||
|  |  | ||||||
|                 DrawCylinder((Vector3){4, 0, -2}, 1, 2, 3, 4, SKYBLUE); |                 DrawCylinder((Vector3){4.0f, 0.0f, -2.0f}, 1.0f, 2.0f, 3.0f, 4, SKYBLUE); | ||||||
|                 DrawCylinderWires((Vector3){4, 0, -2}, 1, 2, 3, 4, DARKBLUE); |                 DrawCylinderWires((Vector3){4.0f, 0.0f, -2.0f}, 1.0f, 2.0f, 3.0f, 4, DARKBLUE); | ||||||
|                 DrawCylinderWires((Vector3){4.5, -1, 2}, 1, 1, 2, 6, BROWN); |                 DrawCylinderWires((Vector3){4.5f, -1.0f, 2.0f}, 1.0f, 1.0f, 2.0f, 6, BROWN); | ||||||
|  |  | ||||||
|                 DrawCylinder((Vector3){1, 0, -4}, 0, 1.5, 3, 8, GOLD); |                 DrawCylinder((Vector3){1.0f, 0.0f, -4.0f}, 0.0f, 1.5f, 3.0f, 8, GOLD); | ||||||
|                 DrawCylinderWires((Vector3){1, 0, -4}, 0, 1.5, 3, 8, PINK); |                 DrawCylinderWires((Vector3){1.0f, 0.0f, -4.0f}, 0.0f, 1.5f, 3.0f, 8, PINK); | ||||||
|  |  | ||||||
|                 DrawGrid(10.0, 1.0);        // Draw a grid |                 DrawGrid(10, 1.0f);        // Draw a grid | ||||||
|  |  | ||||||
|             End3dMode(); |             End3dMode(); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -21,13 +21,13 @@ int main() | |||||||
|     InitWindow(screenWidth, screenHeight, "raylib [models] example - heightmap loading and drawing"); |     InitWindow(screenWidth, screenHeight, "raylib [models] example - heightmap loading and drawing"); | ||||||
|  |  | ||||||
|     // Define our custom camera to look into our 3d world |     // Define our custom camera to look into our 3d world | ||||||
|     Camera camera = {{ 24.0, 18.0, 24.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }}; |     Camera camera = {{ 24.0f, 18.0f, 24.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }}; | ||||||
|  |  | ||||||
|     Image image = LoadImage("resources/heightmap.png");     // Load heightmap image (RAM) |     Image image = LoadImage("resources/heightmap.png");     // Load heightmap image (RAM) | ||||||
|     Texture2D texture = LoadTextureFromImage(image);        // Convert image to texture (VRAM) |     Texture2D texture = LoadTextureFromImage(image);        // Convert image to texture (VRAM) | ||||||
|     Model map = LoadHeightmap(image, 32);                   // Load heightmap model |     Model map = LoadHeightmap(image, 32);                   // Load heightmap model | ||||||
|     SetModelTexture(&map, texture);                         // Bind texture to model |     SetModelTexture(&map, texture);                         // Bind texture to model | ||||||
|     Vector3 mapPosition = { -16, 0.0, -16 };                // Set model position (depends on model scaling!) |     Vector3 mapPosition = { -16.0f, 0.0f, -16.0f };         // Set model position (depends on model scaling!) | ||||||
|  |  | ||||||
|     UnloadImage(image);                 // Unload heightmap image from RAM, already uploaded to VRAM |     UnloadImage(image);                 // Unload heightmap image from RAM, already uploaded to VRAM | ||||||
|      |      | ||||||
|   | |||||||
| @@ -21,12 +21,12 @@ int main() | |||||||
|     InitWindow(screenWidth, screenHeight, "raylib [models] example - obj model loading"); |     InitWindow(screenWidth, screenHeight, "raylib [models] example - obj model loading"); | ||||||
|  |  | ||||||
|     // Define the camera to look into our 3d world |     // Define the camera to look into our 3d world | ||||||
|     Camera camera = {{ 3.0, 3.0, 3.0 }, { 0.0, 1.5, 0.0 }, { 0.0, 1.0, 0.0 }}; |     Camera camera = {{ 3.0f, 3.0f, 3.0f }, { 0.0f, 1.5f, 0.0f }, { 0.0f, 1.0f, 0.0f }}; | ||||||
|  |  | ||||||
|     Model dwarf = LoadModel("resources/model/dwarf.obj");                   // Load OBJ model |     Model dwarf = LoadModel("resources/model/dwarf.obj");                   // Load OBJ model | ||||||
|     Texture2D texture = LoadTexture("resources/model/dwarf_diffuse.png");   // Load model texture |     Texture2D texture = LoadTexture("resources/model/dwarf_diffuse.png");   // Load model texture | ||||||
|     SetModelTexture(&dwarf, texture);                                       // Bind texture to model |     SetModelTexture(&dwarf, texture);                                       // Bind texture to model | ||||||
|     Vector3 position = { 0.0, 0.0, 0.0 };                         // Set model position |     Vector3 position = { 0.0f, 0.0f, 0.0f };                                // Set model position | ||||||
|  |  | ||||||
|     SetTargetFPS(60);   // Set our game to run at 60 frames-per-second |     SetTargetFPS(60);   // Set our game to run at 60 frames-per-second | ||||||
|     //-------------------------------------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
| @@ -49,7 +49,7 @@ int main() | |||||||
|  |  | ||||||
|                 DrawModel(dwarf, position, 2.0f, WHITE);   // Draw 3d model with texture |                 DrawModel(dwarf, position, 2.0f, WHITE);   // Draw 3d model with texture | ||||||
|  |  | ||||||
|                 DrawGrid(10.0, 1.0);        // Draw a grid |                 DrawGrid(10, 1.0f);        // Draw a grid | ||||||
|  |  | ||||||
|                 DrawGizmo(position);        // Draw gizmo |                 DrawGizmo(position);        // Draw gizmo | ||||||
|  |  | ||||||
|   | |||||||
| @@ -9,16 +9,16 @@ uniform sampler2D texture0; | |||||||
| uniform vec4 fragTintColor; | uniform vec4 fragTintColor; | ||||||
|  |  | ||||||
| // Light attributes | // Light attributes | ||||||
| uniform vec3 light_ambientColor = vec3(0.6, 0.3, 0); | uniform vec3 light_ambientColor = vec3(0.6, 0.3, 0.0); | ||||||
| uniform vec3 light_diffuseColor = vec3(1, 0.5, 0); | uniform vec3 light_diffuseColor = vec3(1.0, 0.5, 0.0); | ||||||
| uniform vec3 light_specularColor = vec3(0, 1, 0); | uniform vec3 light_specularColor = vec3(0.0, 1.0, 0.0); | ||||||
| uniform float light_intensity = 1; | uniform float light_intensity = 1.0; | ||||||
| uniform float light_specIntensity = 1; | uniform float light_specIntensity = 1.0; | ||||||
|  |  | ||||||
| // Material attributes | // Material attributes | ||||||
| uniform vec3 mat_ambientColor = vec3(1, 1, 1); | uniform vec3 mat_ambientColor = vec3(1.0, 1.0, 1.0); | ||||||
| uniform vec3 mat_specularColor = vec3(1, 1, 1); | uniform vec3 mat_specularColor = vec3(1.0, 1.0, 1.0); | ||||||
| uniform float mat_glossiness = 50; | uniform float mat_glossiness = 50.0; | ||||||
|  |  | ||||||
| // World attributes | // World attributes | ||||||
| uniform vec3 lightPos; | uniform vec3 lightPos; | ||||||
| @@ -29,7 +29,7 @@ out vec4 fragColor; | |||||||
|  |  | ||||||
| vec3 AmbientLighting() | vec3 AmbientLighting() | ||||||
| { | { | ||||||
|    return mat_ambientColor * light_ambientColor; |    return (mat_ambientColor*light_ambientColor); | ||||||
| } | } | ||||||
|  |  | ||||||
| vec3 DiffuseLighting(in vec3 N, in vec3 L) | vec3 DiffuseLighting(in vec3 N, in vec3 L) | ||||||
| @@ -37,12 +37,12 @@ vec3 DiffuseLighting(in vec3 N, in vec3 L) | |||||||
|    // Lambertian reflection calculation |    // Lambertian reflection calculation | ||||||
|    float diffuse = clamp(dot(N, L), 0, 1); |    float diffuse = clamp(dot(N, L), 0, 1); | ||||||
|     |     | ||||||
|    return tintColor.xyz * light_diffuseColor * light_intensity * diffuse; |    return (fragTintColor.xyz*light_diffuseColor*light_intensity*diffuse); | ||||||
| } | } | ||||||
|  |  | ||||||
| vec3 SpecularLighting(in vec3 N, in vec3 L, in vec3 V) | vec3 SpecularLighting(in vec3 N, in vec3 L, in vec3 V) | ||||||
| { | { | ||||||
|    float specular = 0; |    float specular = 0.0; | ||||||
|  |  | ||||||
|    // Calculate specular reflection only if the surface is oriented to the light source |    // Calculate specular reflection only if the surface is oriented to the light source | ||||||
|    if (dot(N, L) > 0) |    if (dot(N, L) > 0) | ||||||
| @@ -54,7 +54,7 @@ vec3 SpecularLighting(in vec3 N, in vec3 L, in vec3 V) | |||||||
|       specular = pow(dot(N, H), 3 + mat_glossiness); |       specular = pow(dot(N, H), 3 + mat_glossiness); | ||||||
|    } |    } | ||||||
|     |     | ||||||
|    return mat_specularColor * light_specularColor * light_specIntensity * specular; |    return (mat_specularColor*light_specularColor*light_specIntensity*specular); | ||||||
| } | } | ||||||
|  |  | ||||||
| void main() | void main() | ||||||
|   | |||||||
| @@ -7,7 +7,6 @@ in vec3 vertexNormal; | |||||||
|  |  | ||||||
| // Projection and model data | // Projection and model data | ||||||
| uniform mat4 mvpMatrix; | uniform mat4 mvpMatrix; | ||||||
|  |  | ||||||
| uniform mat4 modelMatrix; | uniform mat4 modelMatrix; | ||||||
|  |  | ||||||
| // Attributes to fragment shader | // Attributes to fragment shader | ||||||
| @@ -24,5 +23,5 @@ void main() | |||||||
|     fragNormal = normalize(normalMatrix*vertexNormal); |     fragNormal = normalize(normalMatrix*vertexNormal); | ||||||
|      |      | ||||||
|     // Calculate final vertex position |     // Calculate final vertex position | ||||||
|     gl_Position = projectionMatrix * modelviewMatrix * vec4(vertexPosition, 1.0); |     gl_Position = mvpMatrix*vec4(vertexPosition, 1.0); | ||||||
| } | } | ||||||
| @@ -9,13 +9,13 @@ uniform vec4 fragTintColor; | |||||||
|  |  | ||||||
| // NOTE: Add here your custom variables | // NOTE: Add here your custom variables | ||||||
|  |  | ||||||
| const float renderWidth = 800;      // HARDCODED for example! | const float renderWidth = 800.0;      // HARDCODED for example! | ||||||
| const float renderHeight = 480;     // Use uniforms instead... | const float renderHeight = 480.0;     // Use uniforms instead... | ||||||
|  |  | ||||||
| float radius = 250.0; | float radius = 250.0; | ||||||
| float angle = 0.8; | float angle = 0.8; | ||||||
|  |  | ||||||
| uniform vec2 center = vec2(200, 200); | uniform vec2 center = vec2(200.0, 200.0); | ||||||
|  |  | ||||||
| void main (void) | void main (void) | ||||||
| { | { | ||||||
|   | |||||||
| @@ -30,13 +30,13 @@ int main() | |||||||
|     InitWindow(screenWidth, screenHeight, "raylib [shaders] example - custom uniform variable"); |     InitWindow(screenWidth, screenHeight, "raylib [shaders] example - custom uniform variable"); | ||||||
|  |  | ||||||
|     // Define the camera to look into our 3d world |     // Define the camera to look into our 3d world | ||||||
|     Camera camera = {{ 3.0, 3.0, 3.0 }, { 0.0, 1.5, 0.0 }, { 0.0, 1.0, 0.0 }}; |     Camera camera = {{ 3.0f, 3.0f, 3.0f }, { 0.0f, 1.5f, 0.0f }, { 0.0f, 1.0f, 0.0f }}; | ||||||
|  |  | ||||||
|     Model dwarf = LoadModel("resources/model/dwarf.obj");                   // Load OBJ model |     Model dwarf = LoadModel("resources/model/dwarf.obj");                   // Load OBJ model | ||||||
|     Texture2D texture = LoadTexture("resources/model/dwarf_diffuse.png");   // Load model texture |     Texture2D texture = LoadTexture("resources/model/dwarf_diffuse.png");   // Load model texture | ||||||
|     SetModelTexture(&dwarf, texture);                                       // Bind texture to model |     SetModelTexture(&dwarf, texture);                                       // Bind texture to model | ||||||
|  |  | ||||||
|     Vector3 position = { 0.0, 0.0, 0.0 };                                   // Set model position |     Vector3 position = { 0.0f, 0.0f, 0.0f };                                   // Set model position | ||||||
|      |      | ||||||
|     Shader shader = LoadShader("resources/shaders/base.vs",  |     Shader shader = LoadShader("resources/shaders/base.vs",  | ||||||
|                                "resources/shaders/swirl.fs");               // Load postpro shader |                                "resources/shaders/swirl.fs");               // Load postpro shader | ||||||
| @@ -45,7 +45,7 @@ int main() | |||||||
|     // NOTE: If uniform variable could not be found in the shader, function returns -1 |     // NOTE: If uniform variable could not be found in the shader, function returns -1 | ||||||
|     int swirlCenterLoc = GetShaderLocation(shader, "center"); |     int swirlCenterLoc = GetShaderLocation(shader, "center"); | ||||||
|      |      | ||||||
|     float swirlCenter[2] = { screenWidth/2, screenHeight/2 }; |     float swirlCenter[2] = { (float)screenWidth/2, (float)screenHeight/2 }; | ||||||
|      |      | ||||||
|     SetPostproShader(shader);               // Set fullscreen postprocessing shader |     SetPostproShader(shader);               // Set fullscreen postprocessing shader | ||||||
|      |      | ||||||
| @@ -83,7 +83,7 @@ int main() | |||||||
|  |  | ||||||
|                 DrawModel(dwarf, position, 2.0f, WHITE);   // Draw 3d model with texture |                 DrawModel(dwarf, position, 2.0f, WHITE);   // Draw 3d model with texture | ||||||
|  |  | ||||||
|                 DrawGrid(10.0, 1.0);     // Draw a grid |                 DrawGrid(10, 1.0f);     // Draw a grid | ||||||
|  |  | ||||||
|             End3dMode(); |             End3dMode(); | ||||||
|              |              | ||||||
|   | |||||||
| @@ -30,7 +30,7 @@ int main() | |||||||
|     InitWindow(screenWidth, screenHeight, "raylib [shaders] example - model shader"); |     InitWindow(screenWidth, screenHeight, "raylib [shaders] example - model shader"); | ||||||
|  |  | ||||||
|     // Define the camera to look into our 3d world |     // Define the camera to look into our 3d world | ||||||
|     Camera camera = {{ 3.0, 3.0, 3.0 }, { 0.0, 1.5, 0.0 }, { 0.0, 1.0, 0.0 }}; |     Camera camera = {{ 3.0f, 3.0f, 3.0f }, { 0.0f, 1.5f, 0.0f }, { 0.0f, 1.0f, 0.0f }}; | ||||||
|  |  | ||||||
|     Model dwarf = LoadModel("resources/model/dwarf.obj");                   // Load OBJ model |     Model dwarf = LoadModel("resources/model/dwarf.obj");                   // Load OBJ model | ||||||
|     Texture2D texture = LoadTexture("resources/model/dwarf_diffuse.png");   // Load model texture |     Texture2D texture = LoadTexture("resources/model/dwarf_diffuse.png");   // Load model texture | ||||||
| @@ -40,7 +40,7 @@ int main() | |||||||
|     SetModelShader(&dwarf, shader);         // Set shader effect to 3d model |     SetModelShader(&dwarf, shader);         // Set shader effect to 3d model | ||||||
|     SetModelTexture(&dwarf, texture);       // Bind texture to model |     SetModelTexture(&dwarf, texture);       // Bind texture to model | ||||||
|      |      | ||||||
|     Vector3 position = { 0.0, 0.0, 0.0 };   // Set model position |     Vector3 position = { 0.0f, 0.0f, 0.0f };   // Set model position | ||||||
|      |      | ||||||
|     // Setup orbital camera |     // Setup orbital camera | ||||||
|     SetCameraMode(CAMERA_ORBITAL);          // Set an orbital camera mode |     SetCameraMode(CAMERA_ORBITAL);          // Set an orbital camera mode | ||||||
| @@ -68,7 +68,7 @@ int main() | |||||||
|  |  | ||||||
|                 DrawModel(dwarf, position, 2.0f, WHITE);   // Draw 3d model with texture |                 DrawModel(dwarf, position, 2.0f, WHITE);   // Draw 3d model with texture | ||||||
|  |  | ||||||
|                 DrawGrid(10.0, 1.0);     // Draw a grid |                 DrawGrid(10, 1.0f);     // Draw a grid | ||||||
|  |  | ||||||
|             End3dMode(); |             End3dMode(); | ||||||
|              |              | ||||||
|   | |||||||
| @@ -30,13 +30,13 @@ int main() | |||||||
|     InitWindow(screenWidth, screenHeight, "raylib [shaders] example - postprocessing shader"); |     InitWindow(screenWidth, screenHeight, "raylib [shaders] example - postprocessing shader"); | ||||||
|  |  | ||||||
|     // Define the camera to look into our 3d world |     // Define the camera to look into our 3d world | ||||||
|     Camera camera = {{ 3.0, 3.0, 3.0 }, { 0.0, 1.5, 0.0 }, { 0.0, 1.0, 0.0 }}; |     Camera camera = {{ 3.0f, 3.0f, 3.0f }, { 0.0f, 1.5f, 0.0f }, { 0.0f, 1.0f, 0.0f }}; | ||||||
|      |      | ||||||
|     Model dwarf = LoadModel("resources/model/dwarf.obj");                   // Load OBJ model |     Model dwarf = LoadModel("resources/model/dwarf.obj");                   // Load OBJ model | ||||||
|     Texture2D texture = LoadTexture("resources/model/dwarf_diffuse.png");   // Load model texture |     Texture2D texture = LoadTexture("resources/model/dwarf_diffuse.png");   // Load model texture | ||||||
|     SetModelTexture(&dwarf, texture);                                       // Bind texture to model |     SetModelTexture(&dwarf, texture);                                       // Bind texture to model | ||||||
|  |  | ||||||
|     Vector3 position = { 0.0, 0.0, 0.0 };                                   // Set model position |     Vector3 position = { 0.0f, 0.0f, 0.0f };                                // Set model position | ||||||
|      |      | ||||||
|     Shader shader = LoadShader("resources/shaders/base.vs",  |     Shader shader = LoadShader("resources/shaders/base.vs",  | ||||||
|                                "resources/shaders/bloom.fs");               // Load postpro shader |                                "resources/shaders/bloom.fs");               // Load postpro shader | ||||||
| @@ -69,7 +69,7 @@ int main() | |||||||
|  |  | ||||||
|                 DrawModel(dwarf, position, 2.0f, WHITE);   // Draw 3d model with texture |                 DrawModel(dwarf, position, 2.0f, WHITE);   // Draw 3d model with texture | ||||||
|  |  | ||||||
|                 DrawGrid(10.0, 1.0);     // Draw a grid |                 DrawGrid(10, 1.0f);     // Draw a grid | ||||||
|  |  | ||||||
|             End3dMode(); |             End3dMode(); | ||||||
|              |              | ||||||
|   | |||||||
| @@ -19,6 +19,8 @@ int main() | |||||||
|     int screenHeight = 450; |     int screenHeight = 450; | ||||||
|  |  | ||||||
|     InitWindow(screenWidth, screenHeight, "raylib [shapes] example - basic shapes drawing"); |     InitWindow(screenWidth, screenHeight, "raylib [shapes] example - basic shapes drawing"); | ||||||
|  |      | ||||||
|  |     SetTargetFPS(60); | ||||||
|     //-------------------------------------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|  |  | ||||||
|     // Main game loop |     // Main game loop | ||||||
|   | |||||||
| @@ -19,6 +19,8 @@ int main() | |||||||
|     int screenHeight = 450; |     int screenHeight = 450; | ||||||
|  |  | ||||||
|     InitWindow(screenWidth, screenHeight, "raylib [shapes] example - raylib color palette"); |     InitWindow(screenWidth, screenHeight, "raylib [shapes] example - raylib color palette"); | ||||||
|  |      | ||||||
|  |     SetTargetFPS(60); | ||||||
|     //-------------------------------------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|  |  | ||||||
|     // Main game loop |     // Main game loop | ||||||
|   | |||||||
| @@ -19,6 +19,8 @@ int main() | |||||||
|     int screenHeight = 450; |     int screenHeight = 450; | ||||||
|  |  | ||||||
|     InitWindow(screenWidth, screenHeight, "raylib [shapes] example - raylib logo using shapes"); |     InitWindow(screenWidth, screenHeight, "raylib [shapes] example - raylib logo using shapes"); | ||||||
|  |      | ||||||
|  |     SetTargetFPS(60); | ||||||
|     //-------------------------------------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|  |  | ||||||
|     // Main game loop |     // Main game loop | ||||||
|   | |||||||
| @@ -35,9 +35,7 @@ int main() | |||||||
|     char raylib[8] = "       \0";   // raylib text array, max 8 letters |     char raylib[8] = "       \0";   // raylib text array, max 8 letters | ||||||
|  |  | ||||||
|     int state = 0;                  // Tracking animation states (State Machine) |     int state = 0;                  // Tracking animation states (State Machine) | ||||||
|  |     float alpha = 1.0f;             // Useful for fading | ||||||
|     float alpha = 1.0;              // Useful for fading |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     SetTargetFPS(60); |     SetTargetFPS(60); | ||||||
|     //-------------------------------------------------------------------------------------- |     //-------------------------------------------------------------------------------------- | ||||||
|   | |||||||
| @@ -38,8 +38,7 @@ int main() | |||||||
|  |  | ||||||
|             ClearBackground(RAYWHITE); |             ClearBackground(RAYWHITE); | ||||||
|  |  | ||||||
|             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, GRAY); |             DrawText("this IS a texture!", 360, 370, 10, GRAY); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -41,12 +41,12 @@ int main() | |||||||
|         mouseTail[i].position = (Vector2){ 0, 0 }; |         mouseTail[i].position = (Vector2){ 0, 0 }; | ||||||
|         mouseTail[i].color = (Color){ GetRandomValue(0, 255), GetRandomValue(0, 255), GetRandomValue(0, 255), 255 }; |         mouseTail[i].color = (Color){ GetRandomValue(0, 255), GetRandomValue(0, 255), GetRandomValue(0, 255), 255 }; | ||||||
|         mouseTail[i].alpha = 1.0f; |         mouseTail[i].alpha = 1.0f; | ||||||
|         mouseTail[i].size = (float)GetRandomValue(1, 30)/20; |         mouseTail[i].size = (float)GetRandomValue(1, 30)/20.0f; | ||||||
|         mouseTail[i].rotation = GetRandomValue(0, 360); |         mouseTail[i].rotation = GetRandomValue(0, 360); | ||||||
|         mouseTail[i].active = false; |         mouseTail[i].active = false; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     float gravity = 3; |     float gravity = 3.0f; | ||||||
|  |  | ||||||
|     Texture2D smoke = LoadTexture("resources/smoke.png"); |     Texture2D smoke = LoadTexture("resources/smoke.png"); | ||||||
|      |      | ||||||
| @@ -85,7 +85,7 @@ int main() | |||||||
|                  |                  | ||||||
|                 if (mouseTail[i].alpha <= 0.0f) mouseTail[i].active = false; |                 if (mouseTail[i].alpha <= 0.0f) mouseTail[i].active = false; | ||||||
|                  |                  | ||||||
|                 mouseTail[i].rotation += 5; |                 mouseTail[i].rotation += 5.0f; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|          |          | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 raysan5
					raysan5