diff options
| author | Jeffery Myers <[email protected]> | 2021-03-22 23:51:52 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-03-23 07:51:52 +0100 |
| commit | e48b9a6da1d3dd6163b1596e47c58e7026530dc1 (patch) | |
| tree | 9d1bca87d19ae07f7605c112c53971531b109dc2 /examples/core/core_input_gamepad.c | |
| parent | c6dd41495b2c0d96cf4d1ca108729ec87c9a0b53 (diff) | |
| download | raylib-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/core_input_gamepad.c')
| -rw-r--r-- | examples/core/core_input_gamepad.c | 24 |
1 files changed, 12 insertions, 12 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 { |
