Ejemplo n.º 1
0
/// Has the inventory GUI respond to the provided user input
/// @param[in]  input_controller - The controller on which to check user input.
void InventoryGui::RespondToInput(const INPUT_CONTROL::KeyboardInputController& input_controller)
{
    // CHECK WHICH TAB IS OPENED.
    switch (CurrentTab)
    {
    case TabType::BIBLE:
    {
        // CHECK WHICH BUTTON WAS PRESSED.
        if (input_controller.ButtonWasPressed(INPUT_CONTROL::KeyboardInputController::UP_KEY))
        {
            // SELECT THE PREVIOUS BIBLE VERSE.
            BiblePage.BibleVerseListBox.SelectPreviousVerse();
        }
        else if (input_controller.ButtonWasPressed(INPUT_CONTROL::KeyboardInputController::DOWN_KEY))
        {
            // SELECT THE NEXT BIBLE VERSE.
            BiblePage.BibleVerseListBox.SelectNextVerse();
        }
        else if (input_controller.ButtonWasPressed(INPUT_CONTROL::KeyboardInputController::RIGHT_KEY))
        {
            // SWITCH TO THE ANIMALS TAB ON THE RIGHT.
            CurrentTab = TabType::ANIMALS;
        }
        break;
    }
    case TabType::ANIMALS:
    {
        // CHECK WHICH BUTTON WAS PRESSED.
        if (input_controller.ButtonWasPressed(INPUT_CONTROL::KeyboardInputController::LEFT_KEY))
        {
            // SWITCH TO THE BIBLE TAB ON THE LEFT.
            CurrentTab = TabType::BIBLE;
        }
        else if (input_controller.ButtonWasPressed(INPUT_CONTROL::KeyboardInputController::RIGHT_KEY))
        {
            // SWITCH TO THE FOOD TAB ON THE RIGHT.
            CurrentTab = TabType::FOOD;
        }
        break;
    }
    case TabType::FOOD:
    {
        // CHECK WHICH BUTTON WAS PRESSED.
        if (input_controller.ButtonWasPressed(INPUT_CONTROL::KeyboardInputController::LEFT_KEY))
        {
            // SWITCH TO THE ANIMALS TAB ON THE LEFT.
            CurrentTab = TabType::ANIMALS;
        }
        break;
    }
    default:
        // Nothing to do.
        break;
    }
}
Ejemplo n.º 2
0
 /// Handles any user input for the title screen.
 /// @param[in]  input_controller - The controller supplying user input to respond to.
 /// @return True if the user selected an option for starting the main gameplay; false otherwise.
 bool TitleScreen::RespondToInput(const INPUT_CONTROL::KeyboardInputController& input_controller) const
 {
     // CHECK IF THE MAIN 'START' BUTTON WAS PRESSED.
     bool start_button_pressed = input_controller.ButtonWasPressed(INPUT_CONTROL::KeyboardInputController::START_KEY);
     return start_button_pressed;
 }