Skip to content

Commit

Permalink
Replace usae of ternary operators.
Browse files Browse the repository at this point in the history
  • Loading branch information
przemek83 committed Sep 13, 2024
1 parent 86f9385 commit eca45de
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/Input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,22 @@ InputAction Input::getMenuAction()
if (keyDownUsed(event))
return InputAction::DOWN;

if (event.type == ALLEGRO_EVENT_MOUSE_AXES)
{
mouseX_ =
(event.mouse.x > 0 ? static_cast<unsigned int>(event.mouse.x) : 0);
mouseY_ =
(event.mouse.y > 0 ? static_cast<unsigned int>(event.mouse.y) : 0);
return InputAction::MOUSE_MOVE;
}
if (event.type != ALLEGRO_EVENT_MOUSE_AXES)
return InputAction::EMPTY;

return InputAction::EMPTY;
if (event.mouse.x > 0)

mouseX_ = static_cast<unsigned int>(event.mouse.x);
else
mouseX_ = 0;

if (event.mouse.y > 0)

mouseY_ = static_cast<unsigned int>(event.mouse.y);
else
mouseX_ = 0;

return InputAction::MOUSE_MOVE;
}

std::set<InputAction> Input::getGameActions()
Expand Down

0 comments on commit eca45de

Please sign in to comment.