diff --git a/examples/core/core_input_gamepad.c b/examples/core/core_input_gamepad.c index 9eb96efbe..f00f781f1 100644 --- a/examples/core/core_input_gamepad.c +++ b/examples/core/core_input_gamepad.c @@ -92,20 +92,20 @@ int main(void) // Draw axis: left joystick DrawCircle(259, 152, 39, BLACK); DrawCircle(259, 152, 34, LIGHTGRAY); - DrawCircle(259 + (GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_X)*20), - 152 + (GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_Y)*20), 25, BLACK); + DrawCircle(259 + ((int)GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_X)*20), + 152 + ((int)GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_Y)*20), 25, BLACK); // Draw axis: right joystick DrawCircle(461, 237, 38, BLACK); DrawCircle(461, 237, 33, LIGHTGRAY); - DrawCircle(461 + (GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_X)*20), - 237 + (GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_Y)*20), 25, BLACK); + DrawCircle(461 + ((int)GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_X)*20), + 237 + ((int)GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_Y)*20), 25, BLACK); // Draw axis: left-right triggers DrawRectangle(170, 30, 15, 70, GRAY); DrawRectangle(604, 30, 15, 70, GRAY); - DrawRectangle(170, 30, 15, (((1.0f + GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_TRIGGER))/2.0f)*70), RED); - DrawRectangle(604, 30, 15, (((1.0f + GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_TRIGGER))/2.0f)*70), RED); + DrawRectangle(170, 30, 15, (((1 + (int)GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_TRIGGER))/2)*70), RED); + DrawRectangle(604, 30, 15, (((1 + (int)GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_TRIGGER))/2)*70), RED); //DrawText(TextFormat("Xbox axis LT: %02.02f", GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_TRIGGER)), 10, 40, 10, BLACK); //DrawText(TextFormat("Xbox axis RT: %02.02f", GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_TRIGGER)), 10, 60, 10, BLACK); @@ -140,20 +140,20 @@ int main(void) // Draw axis: left joystick DrawCircle(319, 255, 35, BLACK); DrawCircle(319, 255, 31, LIGHTGRAY); - DrawCircle(319 + (GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_X)*20), - 255 + (GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_Y)*20), 25, BLACK); + DrawCircle(319 + ((int)GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_X) * 20), + 255 + ((int)GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_Y) * 20), 25, BLACK); // Draw axis: right joystick DrawCircle(475, 255, 35, BLACK); DrawCircle(475, 255, 31, LIGHTGRAY); - DrawCircle(475 + (GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_X)*20), - 255 + (GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_Y)*20), 25, BLACK); + DrawCircle(475 + ((int)GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_X)*20), + 255 + ((int)GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_Y)*20), 25, BLACK); // Draw axis: left-right triggers DrawRectangle(169, 48, 15, 70, GRAY); DrawRectangle(611, 48, 15, 70, GRAY); - DrawRectangle(169, 48, 15, (((1.0f - GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_TRIGGER))/2.0f)*70), RED); - DrawRectangle(611, 48, 15, (((1.0f - GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_TRIGGER))/2.0f)*70), RED); + DrawRectangle(169, 48, 15, (((1 - (int)GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_TRIGGER)) / 2) * 70), RED); + DrawRectangle(611, 48, 15, (((1 - (int)GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_TRIGGER)) / 2) * 70), RED); } else { diff --git a/examples/core/core_input_gestures.c b/examples/core/core_input_gestures.c index affab3ebb..50bbff7ef 100644 --- a/examples/core/core_input_gestures.c +++ b/examples/core/core_input_gestures.c @@ -24,7 +24,7 @@ int main(void) InitWindow(screenWidth, screenHeight, "raylib [core] example - input gestures"); Vector2 touchPosition = { 0, 0 }; - Rectangle touchArea = { 220, 10, screenWidth - 230, screenHeight - 20 }; + Rectangle touchArea = { 220, 10, screenWidth - 230.0f, screenHeight - 20.0f }; int gesturesCount = 0; char gestureStrings[MAX_GESTURE_STRINGS][32]; diff --git a/examples/core/core_input_multitouch.c b/examples/core/core_input_multitouch.c index 584e029ab..cd074c152 100644 --- a/examples/core/core_input_multitouch.c +++ b/examples/core/core_input_multitouch.c @@ -68,12 +68,12 @@ int main(void) { // Draw circle and touch index number DrawCircleV(touchPosition, 34, ORANGE); - DrawText(TextFormat("%d", i), touchPosition.x - 10, touchPosition.y - 70, 40, BLACK); + DrawText(TextFormat("%d", i), (int)touchPosition.x - 10, (int)touchPosition.y - 70, 40, BLACK); } } // Draw the normal mouse location - DrawCircleV(ballPosition, 30 + (touchCounter*3), ballColor); + DrawCircleV(ballPosition, 30 + (touchCounter*3.0f), ballColor); DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, DARKGRAY); DrawText("touch the screen at multiple locations to get multiple balls", 10, 30, 20, DARKGRAY); diff --git a/examples/core/core_scissor_test.c b/examples/core/core_scissor_test.c index 55221330e..56eb84f80 100644 --- a/examples/core/core_scissor_test.c +++ b/examples/core/core_scissor_test.c @@ -46,7 +46,7 @@ int main(void) ClearBackground(RAYWHITE); - if (scissorMode) BeginScissorMode(scissorArea.x, scissorArea.y, scissorArea.width, scissorArea.height); + if (scissorMode) BeginScissorMode((int)scissorArea.x, (int)scissorArea.y, (int)scissorArea.width, (int)scissorArea.height); // Draw full screen rectangle and some text // NOTE: Only part defined by scissor area will be rendered diff --git a/examples/core/core_vr_simulator.c b/examples/core/core_vr_simulator.c index 33e2ed6a4..b311b8c08 100644 --- a/examples/core/core_vr_simulator.c +++ b/examples/core/core_vr_simulator.c @@ -116,7 +116,7 @@ int main(void) EndVrDrawing(); BeginShaderMode(distortion); - DrawTextureRec(target.texture, (Rectangle){ 0, 0, target.texture.width, -target.texture.height }, (Vector2){ 0.0f, 0.0f }, WHITE); + DrawTextureRec(target.texture, (Rectangle){ 0, 0, (float)target.texture.width, (float)-target.texture.height }, (Vector2){ 0.0f, 0.0f }, WHITE); EndShaderMode(); DrawFPS(10, 10); diff --git a/examples/core/core_window_flags.c b/examples/core/core_window_flags.c index 1ecd451c7..4b20066f0 100644 --- a/examples/core/core_window_flags.c +++ b/examples/core/core_window_flags.c @@ -39,9 +39,9 @@ int main(void) //SetConfigFlags(FLAG_VSYNC_HINT | FLAG_MSAA_4X_HINT | FLAG_WINDOW_HIGHDPI); InitWindow(screenWidth, screenHeight, "raylib [core] example - window flags"); - Vector2 ballPosition = { GetScreenWidth() / 2, GetScreenHeight() / 2 }; + Vector2 ballPosition = { GetScreenWidth() / 2.0f, GetScreenHeight() / 2.0f }; Vector2 ballSpeed = { 5.0f, 4.0f }; - int ballRadius = 20; + float ballRadius = 20; int framesCounter = 0; @@ -139,7 +139,7 @@ int main(void) else ClearBackground(RAYWHITE); DrawCircleV(ballPosition, ballRadius, MAROON); - DrawRectangleLinesEx((Rectangle) { 0, 0, GetScreenWidth(), GetScreenHeight() }, 4, RAYWHITE); + DrawRectangleLinesEx((Rectangle) { 0, 0, (float)GetScreenWidth(), (float)GetScreenHeight() }, 4, RAYWHITE); DrawCircleV(GetMousePosition(), 10, DARKBLUE); diff --git a/examples/core/core_window_letterbox.c b/examples/core/core_window_letterbox.c index 1712b9ba5..c37e75609 100644 --- a/examples/core/core_window_letterbox.c +++ b/examples/core/core_window_letterbox.c @@ -98,7 +98,7 @@ int main(void) // Draw RenderTexture2D to window, properly scaled DrawTexturePro(target.texture, (Rectangle){ 0.0f, 0.0f, (float)target.texture.width, (float)-target.texture.height }, - (Rectangle){ (GetScreenWidth() - ((float)gameScreenWidth*scale))*0.5, (GetScreenHeight() - ((float)gameScreenHeight*scale))*0.5, + (Rectangle){ (GetScreenWidth() - ((float)gameScreenWidth*scale))*0.5f, (GetScreenHeight() - ((float)gameScreenHeight*scale))*0.5f, (float)gameScreenWidth*scale, (float)gameScreenHeight*scale }, (Vector2){ 0, 0 }, 0.0f, WHITE); EndDrawing(); diff --git a/examples/core/core_world_screen.c b/examples/core/core_world_screen.c index d951c9220..fe13b1b4c 100644 --- a/examples/core/core_world_screen.c +++ b/examples/core/core_world_screen.c @@ -62,7 +62,7 @@ int main(void) EndMode3D(); - DrawText("Enemy: 100 / 100", cubeScreenPosition.x - MeasureText("Enemy: 100/100", 20)/2, cubeScreenPosition.y, 20, BLACK); + DrawText("Enemy: 100 / 100", (int)cubeScreenPosition.x - MeasureText("Enemy: 100/100", 20)/2, (int)cubeScreenPosition.y, 20, BLACK); DrawText("Text is always on top of the cube", (screenWidth - MeasureText("Text is always on top of the cube", 20))/2, 25, 20, GRAY); EndDrawing(); diff --git a/examples/models/models_cubicmap.c b/examples/models/models_cubicmap.c index 08060787a..0a566581e 100644 --- a/examples/models/models_cubicmap.c +++ b/examples/models/models_cubicmap.c @@ -62,7 +62,7 @@ int main(void) EndMode3D(); - DrawTextureEx(cubicmap, (Vector2){ screenWidth - cubicmap.width*4 - 20, 20 }, 0.0f, 4.0f, WHITE); + DrawTextureEx(cubicmap, (Vector2){ screenWidth - cubicmap.width*4.0f - 20, 20.0f }, 0.0f, 4.0f, WHITE); DrawRectangleLines(screenWidth - cubicmap.width*4 - 20, 20, cubicmap.width*4, cubicmap.height*4, GREEN); DrawText("cubicmap image used to", 658, 90, 10, GRAY); diff --git a/examples/models/models_first_person_maze.c b/examples/models/models_first_person_maze.c index 94ebf943a..08a9b5cf3 100644 --- a/examples/models/models_first_person_maze.c +++ b/examples/models/models_first_person_maze.c @@ -95,7 +95,7 @@ int main(void) DrawModel(model, mapPosition, 1.0f, WHITE); // Draw maze map EndMode3D(); - DrawTextureEx(cubicmap, (Vector2){ GetScreenWidth() - cubicmap.width*4 - 20, 20 }, 0.0f, 4.0f, WHITE); + DrawTextureEx(cubicmap, (Vector2){ GetScreenWidth() - cubicmap.width*4.0f - 20, 20.0f }, 0.0f, 4.0f, WHITE); DrawRectangleLines(GetScreenWidth() - cubicmap.width*4 - 20, 20, cubicmap.width*4, cubicmap.height*4, GREEN); // Draw player position radar diff --git a/examples/models/models_material_pbr.c b/examples/models/models_material_pbr.c index fb3f95698..36f036361 100644 --- a/examples/models/models_material_pbr.c +++ b/examples/models/models_material_pbr.c @@ -14,6 +14,7 @@ #include "raylib.h" #include "raymath.h" +#include "rlgl.h" #include @@ -187,7 +188,7 @@ static Material LoadMaterialPBR(Color albedo, float metalness, float roughness) Shader shdrCubemap = LoadShader("resources/shaders/glsl100/cubemap.vs", "resources/shaders/glsl100/cubemap.fs"); #endif SetShaderValue(shdrCubemap, GetShaderLocation(shdrCubemap, "equirectangularMap"), (int[1]){ 0 }, SHADER_UNIFORM_INT); - TextureCubemap cubemap = GenTextureCubemap(shdrCubemap, panorama, CUBEMAP_SIZE, PIXELFORMAT_UNCOMPRESSED_R32G32B32); + TextureCubemap cubemap = rlGenTextureCubemap(shdrCubemap, panorama, CUBEMAP_SIZE, PIXELFORMAT_UNCOMPRESSED_R32G32B32); UnloadTexture(panorama); UnloadShader(shdrCubemap); //-------------------------------------------------------------------------------------------------------- @@ -201,7 +202,7 @@ static Material LoadMaterialPBR(Color albedo, float metalness, float roughness) Shader shdrIrradiance = LoadShader("resources/shaders/glsl100/skybox.vs", "resources/shaders/glsl100/irradiance.fs"); #endif SetShaderValue(shdrIrradiance, GetShaderLocation(shdrIrradiance, "environmentMap"), (int[1]){ 0 }, SHADER_UNIFORM_INT); - mat.maps[MATERIAL_MAP_IRRADIANCE].texture = GenTextureIrradiance(shdrIrradiance, cubemap, IRRADIANCE_SIZE); + mat.maps[MATERIAL_MAP_IRRADIANCE].texture = rlGenTextureIrradiance(shdrIrradiance, cubemap, IRRADIANCE_SIZE); UnloadShader(shdrIrradiance); //-------------------------------------------------------------------------------------------------------- @@ -214,7 +215,7 @@ static Material LoadMaterialPBR(Color albedo, float metalness, float roughness) Shader shdrPrefilter = LoadShader("resources/shaders/glsl100/skybox.vs", "resources/shaders/glsl100/prefilter.fs"); #endif SetShaderValue(shdrPrefilter, GetShaderLocation(shdrPrefilter, "environmentMap"), (int[1]){ 0 }, SHADER_UNIFORM_INT); - mat.maps[MATERIAL_MAP_PREFILTER].texture = GenTexturePrefilter(shdrPrefilter, cubemap, PREFILTERED_SIZE); + mat.maps[MATERIAL_MAP_PREFILTER].texture = rlGenTexturePrefilter(shdrPrefilter, cubemap, PREFILTERED_SIZE); UnloadTexture(cubemap); UnloadShader(shdrPrefilter); //-------------------------------------------------------------------------------------------------------- @@ -226,7 +227,7 @@ static Material LoadMaterialPBR(Color albedo, float metalness, float roughness) #else Shader shdrBRDF = LoadShader("resources/shaders/glsl100/brdf.vs", "resources/shaders/glsl100/brdf.fs"); #endif - mat.maps[MATERIAL_MAP_BRDG].texture = GenTextureBRDF(shdrBRDF, BRDF_SIZE); + mat.maps[MATERIAL_MAP_BRDG].texture = rlGenTextureBRDF(shdrBRDF, BRDF_SIZE); UnloadShader(shdrBRDF); //-------------------------------------------------------------------------------------------------------- diff --git a/examples/models/models_mesh_picking.c b/examples/models/models_mesh_picking.c index 8ade0b060..78c7c45c6 100644 --- a/examples/models/models_mesh_picking.c +++ b/examples/models/models_mesh_picking.c @@ -142,8 +142,8 @@ int main(void) // If we hit something, draw the cursor at the hit point if (nearestHit.hit) { - DrawCube(nearestHit.position, 0.3, 0.3, 0.3, cursorColor); - DrawCubeWires(nearestHit.position, 0.3, 0.3, 0.3, RED); + DrawCube(nearestHit.position, 0.3f, 0.3f, 0.3f, cursorColor); + DrawCubeWires(nearestHit.position, 0.3f, 0.3f, 0.3f, RED); Vector3 normalEnd; normalEnd.x = nearestHit.position.x + nearestHit.normal.x; diff --git a/examples/models/models_skybox.c b/examples/models/models_skybox.c index d44b11b60..e03aaab0f 100644 --- a/examples/models/models_skybox.c +++ b/examples/models/models_skybox.c @@ -62,7 +62,7 @@ int main(void) // NOTE 1: New texture is generated rendering to texture, shader calculates the sphere->cube coordinates mapping // NOTE 2: It seems on some Android devices WebGL, fbo does not properly support a FLOAT-based attachment, // despite texture can be successfully created.. so using PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 instead of PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 - skybox.materials[0].maps[MATERIAL_MAP_CUBEMAP].texture = GenTextureCubemap(shdrCubemap, panorama, 1024, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8); + skybox.materials[0].maps[MATERIAL_MAP_CUBEMAP].texture = rlGenTextureCubemap(shdrCubemap, panorama, 1024, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8); UnloadTexture(panorama); // Texture not required anymore, cubemap already generated } @@ -102,7 +102,7 @@ int main(void) Texture2D panorama = LoadTexture(droppedFiles[0]); // Generate cubemap from panorama texture - skybox.materials[0].maps[MATERIAL_MAP_CUBEMAP].texture = GenTextureCubemap(shdrCubemap, panorama, 1024, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8); + skybox.materials[0].maps[MATERIAL_MAP_CUBEMAP].texture = rlGenTextureCubemap(shdrCubemap, panorama, 1024, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8); UnloadTexture(panorama); } else diff --git a/examples/shaders/shaders_postprocessing.c b/examples/shaders/shaders_postprocessing.c index 044e4fb3f..ef815391b 100644 --- a/examples/shaders/shaders_postprocessing.c +++ b/examples/shaders/shaders_postprocessing.c @@ -146,7 +146,7 @@ int main(void) BeginShaderMode(shaders[currentShader]); // NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom) - DrawTextureRec(target.texture, (Rectangle){ 0, 0, target.texture.width, -target.texture.height }, (Vector2){ 0, 0 }, WHITE); + DrawTextureRec(target.texture, (Rectangle){ 0, 0, (float)target.texture.width, (float)-target.texture.height }, (Vector2){ 0, 0 }, WHITE); EndShaderMode(); diff --git a/examples/shaders/shaders_rlgl_mesh_instanced.c b/examples/shaders/shaders_rlgl_mesh_instanced.c index 7b72ba963..4ad647c01 100644 --- a/examples/shaders/shaders_rlgl_mesh_instanced.c +++ b/examples/shaders/shaders_rlgl_mesh_instanced.c @@ -56,14 +56,14 @@ int main(void) // Scatter random cubes around for (int i = 0; i < count; i++) { - float x = GetRandomValue(-50, 50); - float y = GetRandomValue(-50, 50); - float z = GetRandomValue(-50, 50); + float x = (float)GetRandomValue(-50, 50); + float y = (float)GetRandomValue(-50, 50); + float z = (float)GetRandomValue(-50, 50); translations[i] = MatrixTranslate(x, y, z); - x = GetRandomValue(0, 360); - y = GetRandomValue(0, 360); - z = GetRandomValue(0, 360); + x = (float)GetRandomValue(0, 360); + y = (float)GetRandomValue(0, 360); + z = (float)GetRandomValue(0, 360); Vector3 axis = Vector3Normalize((Vector3){x, y, z}); float angle = (float)GetRandomValue(0, 10) * DEG2RAD; diff --git a/examples/shaders/shaders_simple_mask.c b/examples/shaders/shaders_simple_mask.c index 055afad74..b46b65c74 100644 --- a/examples/shaders/shaders_simple_mask.c +++ b/examples/shaders/shaders_simple_mask.c @@ -45,10 +45,10 @@ int main(void) camera.projection = CAMERA_PERSPECTIVE; // Define our three models to show the shader on - Mesh torus = GenMeshTorus(.3, 1, 16, 32); + Mesh torus = GenMeshTorus(0.3f, 1, 16, 32); Model model1 = LoadModelFromMesh(torus); - Mesh cube = GenMeshCube(.8,.8,.8); + Mesh cube = GenMeshCube(0.8f,0.8f,0.8f); Model model2 = LoadModelFromMesh(cube); // Generate model to be shaded just to see the gaps in the other two diff --git a/examples/shaders/shaders_texture_drawing.c b/examples/shaders/shaders_texture_drawing.c index 9a88e41a1..a8cd5abfb 100644 --- a/examples/shaders/shaders_texture_drawing.c +++ b/examples/shaders/shaders_texture_drawing.c @@ -49,7 +49,7 @@ int main(void) { // Update //---------------------------------------------------------------------------------- - time = GetTime(); + time = (float)GetTime(); SetShaderValue(shader, timeLoc, &time, SHADER_UNIFORM_FLOAT); //---------------------------------------------------------------------------------- diff --git a/examples/text/text_font_loading.c b/examples/text/text_font_loading.c index 7eaaed8fe..e0515167f 100644 --- a/examples/text/text_font_loading.c +++ b/examples/text/text_font_loading.c @@ -66,12 +66,12 @@ int main(void) if (!useTtf) { - DrawTextEx(fontBm, msg, (Vector2){ 20.0f, 100.0f }, fontBm.baseSize, 2, MAROON); + DrawTextEx(fontBm, msg, (Vector2){ 20.0f, 100.0f }, (float)fontBm.baseSize, 2, MAROON); DrawText("Using BMFont (Angelcode) imported", 20, GetScreenHeight() - 30, 20, GRAY); } else { - DrawTextEx(fontTtf, msg, (Vector2){ 20.0f, 100.0f }, fontTtf.baseSize, 2, LIME); + DrawTextEx(fontTtf, msg, (Vector2){ 20.0f, 100.0f }, (float)fontTtf.baseSize, 2, LIME); DrawText("Using TTF font generated", 20, GetScreenHeight() - 30, 20, GRAY); } diff --git a/examples/text/text_font_sdf.c b/examples/text/text_font_sdf.c index b83b3d675..36c0ae564 100644 --- a/examples/text/text_font_sdf.c +++ b/examples/text/text_font_sdf.c @@ -66,7 +66,7 @@ int main(void) Shader shader = LoadShader(0, TextFormat("resources/shaders/glsl%i/sdf.fs", GLSL_VERSION)); SetTextureFilter(fontSDF.texture, FILTER_BILINEAR); // Required for SDF font - Vector2 fontPosition = { 40, screenHeight/2 - 50 }; + Vector2 fontPosition = { 40, screenHeight/2.0f - 50 }; Vector2 textSize = { 0.0f, 0.0f }; float fontSize = 16.0f; int currentFont = 0; // 0 - fontDefault, 1 - fontSDF diff --git a/examples/text/text_font_spritefont.c b/examples/text/text_font_spritefont.c index 4a62c7182..0f4a08b27 100644 --- a/examples/text/text_font_spritefont.c +++ b/examples/text/text_font_spritefont.c @@ -38,14 +38,14 @@ int main(void) Font font2 = LoadFont("resources/custom_alagard.png"); // Font loading Font font3 = LoadFont("resources/custom_jupiter_crash.png"); // Font loading - Vector2 fontPosition1 = { screenWidth/2 - MeasureTextEx(font1, msg1, font1.baseSize, -3).x/2, + Vector2 fontPosition1 = { screenWidth/2 - MeasureTextEx(font1, msg1, (float)font1.baseSize, -3).x/2, screenHeight/2 - font1.baseSize/2 - 80 }; - Vector2 fontPosition2 = { screenWidth/2 - MeasureTextEx(font2, msg2, font2.baseSize, -2).x/2, + Vector2 fontPosition2 = { screenWidth/2 - MeasureTextEx(font2, msg2, (float)font2.baseSize, -2).x/2, screenHeight/2 - font2.baseSize/2 - 10 }; - Vector2 fontPosition3 = { screenWidth/2 - MeasureTextEx(font3, msg3, font3.baseSize, 2).x/2, - screenHeight/2 - font3.baseSize/2 + 50 }; + Vector2 fontPosition3 = { screenWidth/2.0f - MeasureTextEx(font3, msg3, (float)font3.baseSize, 2).x/2, + screenHeight/2.0f - font3.baseSize/2 + 50 }; SetTargetFPS(60); // Set our game to run at 60 frames-per-second //-------------------------------------------------------------------------------------- @@ -64,9 +64,9 @@ int main(void) ClearBackground(RAYWHITE); - DrawTextEx(font1, msg1, fontPosition1, font1.baseSize, -3, WHITE); - DrawTextEx(font2, msg2, fontPosition2, font2.baseSize, -2, WHITE); - DrawTextEx(font3, msg3, fontPosition3, font3.baseSize, 2, WHITE); + DrawTextEx(font1, msg1, fontPosition1, (float)font1.baseSize, -3, WHITE); + DrawTextEx(font2, msg2, fontPosition2, (float)font2.baseSize, -2, WHITE); + DrawTextEx(font3, msg3, fontPosition3, (float)font3.baseSize, 2, WHITE); EndDrawing(); //---------------------------------------------------------------------------------- diff --git a/examples/text/text_raylib_fonts.c b/examples/text/text_raylib_fonts.c index d7e41a78c..2718d67dd 100644 --- a/examples/text/text_raylib_fonts.c +++ b/examples/text/text_raylib_fonts.c @@ -52,7 +52,7 @@ int main(void) for (int i = 0; i < MAX_FONTS; i++) { - positions[i].x = screenWidth/2 - MeasureTextEx(fonts[i], messages[i], fonts[i].baseSize*2, spacings[i]).x/2; + positions[i].x = screenWidth/2 - MeasureTextEx(fonts[i], messages[i], fonts[i].baseSize*2.0f, spacings[i]).x/2.0f); positions[i].y = 60 + fonts[i].baseSize + 45*i; } @@ -85,7 +85,7 @@ int main(void) for (int i = 0; i < MAX_FONTS; i++) { - DrawTextEx(fonts[i], messages[i], positions[i], fonts[i].baseSize*2, spacings[i], colors[i]); + DrawTextEx(fonts[i], messages[i], positions[i], fonts[i].baseSize*2.0f, (float)spacings[i], colors[i]); } EndDrawing(); diff --git a/examples/text/text_rectangle_bounds.c b/examples/text/text_rectangle_bounds.c index 870561e1f..21dfcd91c 100644 --- a/examples/text/text_rectangle_bounds.c +++ b/examples/text/text_rectangle_bounds.c @@ -33,10 +33,10 @@ tempor incididunt ut labore et dolore magna aliqua. Nec ullamcorper sit amet ris Rectangle resizer = { container.x + container.width - 17, container.y + container.height - 17, 14, 14 }; // Minimum width and heigh for the container rectangle - const int minWidth = 60; - const int minHeight = 60; - const int maxWidth = screenWidth - 50; - const int maxHeight = screenHeight - 160; + const float minWidth = 60; + const float minHeight = 60; + const float maxWidth = screenWidth - 50; + const float maxHeight = screenHeight - 160; Vector2 lastMouse = { 0.0f, 0.0f }; // Stores last mouse coordinates Color borderColor = MAROON; // Container border color @@ -63,10 +63,10 @@ tempor incididunt ut labore et dolore magna aliqua. Nec ullamcorper sit amet ris { if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) resizing = false; - int width = container.width + (mouse.x - lastMouse.x); + float width = container.width + (mouse.x - lastMouse.x); container.width = (width > minWidth)? ((width < maxWidth)? width : maxWidth) : minWidth; - int height = container.height + (mouse.y - lastMouse.y); + float height = container.height + (mouse.y - lastMouse.y); container.height = (height > minHeight)? ((height < maxHeight)? height : maxHeight) : minHeight; } else diff --git a/examples/text/text_unicode.c b/examples/text/text_unicode.c index 161d46771..f481cb2da 100644 --- a/examples/text/text_unicode.c +++ b/examples/text/text_unicode.c @@ -203,15 +203,15 @@ int main(int argc, char **argv) for (int i = 0; i < SIZEOF(emoji); ++i) { const char *txt = &emojiCodepoints[emoji[i].index]; - Rectangle emojiRect = { pos.x, pos.y, fontEmoji.baseSize, fontEmoji.baseSize }; + Rectangle emojiRect = { pos.x, pos.y, (float)fontEmoji.baseSize, (float)fontEmoji.baseSize }; if (!CheckCollisionPointRec(mouse, emojiRect)) { - DrawTextEx(fontEmoji, txt, pos, fontEmoji.baseSize, 1.0, selected == i ? emoji[i].color : Fade(LIGHTGRAY, 0.4f)); + DrawTextEx(fontEmoji, txt, pos, (float)fontEmoji.baseSize, 1.0f, selected == i ? emoji[i].color : Fade(LIGHTGRAY, 0.4f)); } else { - DrawTextEx(fontEmoji, txt, pos, fontEmoji.baseSize, 1.0, emoji[i].color ); + DrawTextEx(fontEmoji, txt, pos, (float)fontEmoji.baseSize, 1.0f, emoji[i].color ); hovered = i; hoveredPos = pos; } @@ -235,7 +235,7 @@ int main(int argc, char **argv) TextIsEqual(messages[message].language, "Japanese")) font = &fontAsian; // Calculate size for the message box (approximate the height and width) - Vector2 sz = MeasureTextEx(*font, messages[message].text, font->baseSize, 1.0f); + Vector2 sz = MeasureTextEx(*font, messages[message].text, (float)font->baseSize, 1.0f); if (sz.x > 300) { sz.y *= sz.x/300; sz.x = 300; } else if (sz.x < 160) sz.x = 160; @@ -267,15 +267,15 @@ int main(int argc, char **argv) // Draw the main text message Rectangle textRect = { msgRect.x + horizontalPadding/2, msgRect.y + verticalPadding/2, msgRect.width - horizontalPadding, msgRect.height }; - DrawTextRec(*font, messages[message].text, textRect, font->baseSize, 1.0f, true, WHITE); + DrawTextRec(*font, messages[message].text, textRect, (float)font->baseSize, 1.0f, true, WHITE); // Draw the info text below the main message - int size = strlen(messages[message].text); + int size = (int)strlen(messages[message].text); int len = GetCodepointsCount(messages[message].text); const char *info = TextFormat("%s %u characters %i bytes", messages[message].language, len, size); sz = MeasureTextEx(GetFontDefault(), info, 10, 1.0f); Vector2 pos = { textRect.x + textRect.width - sz.x, msgRect.y + msgRect.height - sz.y - 2 }; - DrawText(info, pos.x, pos.y, 10, RAYWHITE); + DrawText(info, (int)pos.x, (int)pos.y, 10, RAYWHITE); } //------------------------------------------------------------------------------ diff --git a/examples/textures/textures_bunnymark.c b/examples/textures/textures_bunnymark.c index 8182102c6..b92b3d416 100644 --- a/examples/textures/textures_bunnymark.c +++ b/examples/textures/textures_bunnymark.c @@ -94,7 +94,7 @@ int main(void) // Process of sending data is costly and it could happen that GPU data has not been completely // processed for drawing while new data is tried to be sent (updating current in-use buffers) // it could generates a stall and consequently a frame drop, limiting the number of drawn bunnies - DrawTexture(texBunny, bunnies[i].position.x, bunnies[i].position.y, bunnies[i].color); + DrawTexture(texBunny, (int)bunnies[i].position.x, (int)bunnies[i].position.y, bunnies[i].color); } DrawRectangle(0, 0, screenWidth, 40, BLACK); diff --git a/examples/textures/textures_draw_tiled.c b/examples/textures/textures_draw_tiled.c index 7d8a3c419..97bffc80f 100644 --- a/examples/textures/textures_draw_tiled.c +++ b/examples/textures/textures_draw_tiled.c @@ -47,10 +47,10 @@ int main(int argc, char **argv) // Calculate rectangle for each color for (int i = 0, x = 0, y = 0; i < MAX_COLORS; i++) { - colorRec[i].x = 2 + MARGIN_SIZE + x; - colorRec[i].y = 22 + 256 + MARGIN_SIZE + y; - colorRec[i].width = COLOR_SIZE*2; - colorRec[i].height = COLOR_SIZE; + colorRec[i].x = 2.0f + MARGIN_SIZE + x; + colorRec[i].y = 22.0f + 256.0f + MARGIN_SIZE + y; + colorRec[i].width = COLOR_SIZE*2.0f; + colorRec[i].height = (float)COLOR_SIZE; if (i == (MAX_COLORS/2 - 1)) { @@ -122,7 +122,7 @@ int main(int argc, char **argv) ClearBackground(RAYWHITE); // Draw the tiled area - DrawTextureTiled(texPattern, recPattern[activePattern], (Rectangle){OPT_WIDTH+MARGIN_SIZE, MARGIN_SIZE, screenWidth - OPT_WIDTH - 2*MARGIN_SIZE, screenHeight - 2*MARGIN_SIZE}, + DrawTextureTiled(texPattern, recPattern[activePattern], (Rectangle){(float)OPT_WIDTH+MARGIN_SIZE, (float)MARGIN_SIZE, screenWidth - OPT_WIDTH - 2.0f*MARGIN_SIZE, screenHeight - 2.0f*MARGIN_SIZE}, (Vector2){0.0f, 0.0f}, rotation, scale, colors[activeCol]); // Draw options @@ -130,13 +130,13 @@ int main(int argc, char **argv) DrawText("Select Pattern", 2 + MARGIN_SIZE, 30 + MARGIN_SIZE, 10, BLACK); DrawTexture(texPattern, 2 + MARGIN_SIZE, 40 + MARGIN_SIZE, BLACK); - DrawRectangle(2 + MARGIN_SIZE + recPattern[activePattern].x, 40 + MARGIN_SIZE + recPattern[activePattern].y, recPattern[activePattern].width, recPattern[activePattern].height, ColorAlpha(DARKBLUE, 0.3f)); + DrawRectangle(2 + MARGIN_SIZE + (int)recPattern[activePattern].x, 40 + MARGIN_SIZE + (int)recPattern[activePattern].y, (int)recPattern[activePattern].width, (int)recPattern[activePattern].height, ColorAlpha(DARKBLUE, 0.3f)); DrawText("Select Color", 2+MARGIN_SIZE, 10+256+MARGIN_SIZE, 10, BLACK); for (int i = 0; i < MAX_COLORS; i++) { DrawRectangleRec(colorRec[i], colors[i]); - if (activeCol == i) DrawRectangleLinesEx(colorRec[i], 3.0f, ColorAlpha(WHITE, 0.5f)); + if (activeCol == i) DrawRectangleLinesEx(colorRec[i], 3, ColorAlpha(WHITE, 0.5f)); } DrawText("Scale (UP/DOWN to change)", 2 + MARGIN_SIZE, 80 + 256 + MARGIN_SIZE, 10, BLACK); diff --git a/examples/textures/textures_mouse_painting.c b/examples/textures/textures_mouse_painting.c index e9b876b43..30fd390f0 100644 --- a/examples/textures/textures_mouse_painting.c +++ b/examples/textures/textures_mouse_painting.c @@ -35,7 +35,7 @@ int main(void) for (int i = 0; i < MAX_COLORS_COUNT; i++) { - colorsRecs[i].x = 10 + 30*i + 2*i; + colorsRecs[i].x = 10 + 30.0f*i + 2*i; colorsRecs[i].y = 10; colorsRecs[i].width = 30; colorsRecs[i].height = 30; @@ -44,7 +44,7 @@ int main(void) int colorSelected = 0; int colorSelectedPrev = colorSelected; int colorMouseHover = 0; - int brushSize = 20; + float brushSize = 20.0f; bool mouseWasPressed = false; Rectangle btnSaveRec = { 750, 10, 40, 30 }; @@ -113,7 +113,7 @@ int main(void) // NOTE: To avoid discontinuous circles, we could store // previous-next mouse points and just draw a line using brush size BeginTextureMode(target); - if (mousePos.y > 50) DrawCircle(mousePos.x, mousePos.y, brushSize, colors[colorSelected]); + if (mousePos.y > 50) DrawCircle((int)mousePos.x, (int)mousePos.y, brushSize, colors[colorSelected]); EndTextureMode(); } @@ -129,7 +129,7 @@ int main(void) // Erase circle from render texture BeginTextureMode(target); - if (mousePos.y > 50) DrawCircle(mousePos.x, mousePos.y, brushSize, colors[0]); + if (mousePos.y > 50) DrawCircle((int)mousePos.x, (int)mousePos.y, brushSize, colors[0]); EndTextureMode(); } else if (IsMouseButtonReleased(MOUSE_RIGHT_BUTTON) && mouseWasPressed) @@ -172,7 +172,7 @@ int main(void) ClearBackground(RAYWHITE); // NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom) - DrawTextureRec(target.texture, (Rectangle) { 0, 0, target.texture.width, -target.texture.height }, (Vector2) { 0, 0 }, WHITE); + DrawTextureRec(target.texture, (Rectangle) { 0, 0, (float)target.texture.width, (float)-target.texture.height }, (Vector2) { 0, 0 }, WHITE); // Draw drawing circle for reference if (mousePos.y > 50) diff --git a/examples/textures/textures_sprite_button.c b/examples/textures/textures_sprite_button.c index a5b2d8d13..6ca4ea906 100644 --- a/examples/textures/textures_sprite_button.c +++ b/examples/textures/textures_sprite_button.c @@ -28,11 +28,11 @@ int main(void) Texture2D button = LoadTexture("resources/button.png"); // Load button texture // Define frame rectangle for drawing - int frameHeight = button.height/NUM_FRAMES; - Rectangle sourceRec = { 0, 0, button.width, frameHeight }; + float frameHeight = (float)button.height/NUM_FRAMES; + Rectangle sourceRec = { 0, 0, (float)button.width, frameHeight }; // Define button bounds on screen - Rectangle btnBounds = { screenWidth/2 - button.width/2, screenHeight/2 - button.height/NUM_FRAMES/2, button.width, frameHeight }; + Rectangle btnBounds = { screenWidth/2.0f - button.width/2.0f, screenHeight/2.0f - button.height/NUM_FRAMES/2.0f, (float)button.width, frameHeight }; int btnState = 0; // Button state: 0-NORMAL, 1-MOUSE_HOVER, 2-PRESSED bool btnAction = false; // Button action should be activated diff --git a/examples/textures/textures_sprite_explosion.c b/examples/textures/textures_sprite_explosion.c index 53f2626ed..52ac26060 100644 --- a/examples/textures/textures_sprite_explosion.c +++ b/examples/textures/textures_sprite_explosion.c @@ -58,8 +58,8 @@ int main(void) position = GetMousePosition(); active = true; - position.x -= frameWidth/2; - position.y -= frameHeight/2; + position.x -= frameWidth/2.0f; + position.y -= frameHeight/2.0f; PlaySound(fxBoom); } @@ -89,8 +89,8 @@ int main(void) } } - frameRec.x = frameWidth*currentFrame; - frameRec.y = frameHeight*currentLine; + frameRec.x = (float)frameWidth*currentFrame; + frameRec.y = (float)frameHeight*currentLine; //---------------------------------------------------------------------------------- // Draw diff --git a/projects/VS2019/examples/core_custom_logging.vcxproj b/projects/VS2019/examples/core_custom_logging.vcxproj index 99c78b794..89888887e 100644 --- a/projects/VS2019/examples/core_custom_logging.vcxproj +++ b/projects/VS2019/examples/core_custom_logging.vcxproj @@ -202,7 +202,7 @@ Level3 Disabled - WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions) CompileAsC $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) @@ -219,7 +219,7 @@ Level3 Disabled - WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions) CompileAsC $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) /FS %(AdditionalOptions) @@ -237,7 +237,7 @@ Level3 Disabled - WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions) CompileAsC $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) @@ -258,7 +258,7 @@ Level3 Disabled - WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions) CompileAsC $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) @@ -281,7 +281,7 @@ MaxSpeed true true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP + _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) CompileAsC true @@ -303,7 +303,7 @@ MaxSpeed true true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP + _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) CompileAsC true @@ -325,7 +325,7 @@ MaxSpeed true true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP + _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) CompileAsC true @@ -353,7 +353,7 @@ MaxSpeed true true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP + _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) CompileAsC true diff --git a/projects/VS2019/examples/core_input_gestures.vcxproj b/projects/VS2019/examples/core_input_gestures.vcxproj index 749e96b74..51c980e17 100644 --- a/projects/VS2019/examples/core_input_gestures.vcxproj +++ b/projects/VS2019/examples/core_input_gestures.vcxproj @@ -202,7 +202,7 @@ Level3 Disabled - WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions) CompileAsC $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) @@ -219,7 +219,7 @@ Level3 Disabled - WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions) CompileAsC $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) /FS %(AdditionalOptions) @@ -237,7 +237,7 @@ Level3 Disabled - WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions) CompileAsC $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) @@ -258,7 +258,7 @@ Level3 Disabled - WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions) CompileAsC $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) @@ -281,7 +281,7 @@ MaxSpeed true true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP + _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) CompileAsC true @@ -303,7 +303,7 @@ MaxSpeed true true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP + _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) CompileAsC true @@ -325,7 +325,7 @@ MaxSpeed true true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP + _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) CompileAsC true @@ -353,7 +353,7 @@ MaxSpeed true true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP + _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) CompileAsC true