Skip to content

Commit

Permalink
Change order of definitions of methodf to match declaration order.
Browse files Browse the repository at this point in the history
  • Loading branch information
przemek83 committed Oct 2, 2024
1 parent 275f6af commit 99e1ff3
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions src/Menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,31 @@

Menu::Menu(Display& display) : display_(display) {}

UserChoice Menu::getUserChoice(Input& input)
{
int currentItem{0};
while (true)
{
const InputAction action{input.getMenuAction()};

if (action == InputAction::QUIT)
return UserChoice::EXIT;

if (action == InputAction::ACCEPT)
return items_[static_cast<std::size_t>(currentItem)]
.getUserChoice();

if (action == InputAction::BACK)
return items_.back().getUserChoice();

currentItem =
getCurrentItem(input.getMousePosition(), action, currentItem);

if (action == InputAction::TIMER)
redraw(currentItem);
}
}

void Menu::refresh(UserChoice choice)
{
switch (choice)
Expand Down Expand Up @@ -158,28 +183,3 @@ std::pair<bool, int> Menu::getPointedItem(
}
return {false, 0};
}

UserChoice Menu::getUserChoice(Input& input)
{
int currentItem{0};
while (true)
{
const InputAction action{input.getMenuAction()};

if (action == InputAction::QUIT)
return UserChoice::EXIT;

if (action == InputAction::ACCEPT)
return items_[static_cast<std::size_t>(currentItem)]
.getUserChoice();

if (action == InputAction::BACK)
return items_.back().getUserChoice();

currentItem =
getCurrentItem(input.getMousePosition(), action, currentItem);

if (action == InputAction::TIMER)
redraw(currentItem);
}
}

0 comments on commit 99e1ff3

Please sign in to comment.