summaryrefslogtreecommitdiffhomepage
path: root/examples/core
diff options
context:
space:
mode:
authorJeffery Myers <[email protected]>2021-03-22 23:51:52 -0700
committerGitHub <[email protected]>2021-03-23 07:51:52 +0100
commite48b9a6da1d3dd6163b1596e47c58e7026530dc1 (patch)
tree9d1bca87d19ae07f7605c112c53971531b109dc2 /examples/core
parentc6dd41495b2c0d96cf4d1ca108729ec87c9a0b53 (diff)
downloadraylib-e48b9a6da1d3dd6163b1596e47c58e7026530dc1.tar.gz
raylib-e48b9a6da1d3dd6163b1596e47c58e7026530dc1.zip
[Examples] Warning fixes (pt 1) (#1668)
* Fix some warnings in examples. * cleanups from review Co-authored-by: Jeffery Myers <[email protected]>
Diffstat (limited to 'examples/core')
-rw-r--r--examples/core/core_input_gamepad.c24
-rw-r--r--examples/core/core_input_gestures.c2
-rw-r--r--examples/core/core_input_multitouch.c4
-rw-r--r--examples/core/core_scissor_test.c2
-rw-r--r--examples/core/core_vr_simulator.c2
-rw-r--r--examples/core/core_window_flags.c6
-rw-r--r--examples/core/core_window_letterbox.c2
-rw-r--r--examples/core/core_world_screen.c2
8 files changed, 22 insertions, 22 deletions
diff --git a/examples/core/core_input_gamepad.c b/examples/core/core_input_gamepad.c
index 9eb96efb..f00f781f 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 affab3eb..50bbff7e 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 584e029a..cd074c15 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 55221330..56eb84f8 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 33e2ed6a..b311b8c0 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 1ecd451c..4b20066f 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 1712b9ba..c37e7560 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 d951c922..fe13b1b4 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();