2021-10-09 00:58:55 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
2021-10-15 15:41:16 +02:00
|
|
|
#include <utils/WiiUScreen.h>
|
|
|
|
#include <utils/ScreenUtils.h>
|
2021-10-09 00:58:55 +02:00
|
|
|
|
|
|
|
class ApplicationState {
|
|
|
|
public:
|
2021-10-15 15:41:16 +02:00
|
|
|
enum eSubState {
|
|
|
|
SUBSTATE_RUNNING,
|
|
|
|
SUBSTATE_RETURN,
|
2021-10-09 00:58:55 +02:00
|
|
|
};
|
|
|
|
|
2021-10-15 15:41:16 +02:00
|
|
|
virtual ~ApplicationState() = default;
|
2021-10-09 00:58:55 +02:00
|
|
|
|
2021-10-15 15:41:16 +02:00
|
|
|
virtual void render() = 0;
|
2021-10-09 01:24:12 +02:00
|
|
|
|
2021-10-15 15:41:16 +02:00
|
|
|
virtual eSubState update(Input *input) = 0;
|
2021-10-09 00:58:55 +02:00
|
|
|
|
2021-10-15 15:41:16 +02:00
|
|
|
virtual void proccessMenuNavigation(Input *input, int32_t maxOptionValue) {
|
|
|
|
if (input->data.buttons_d & Input::BUTTON_UP) {
|
|
|
|
this->selectedOption--;
|
|
|
|
} else if (input->data.buttons_d & Input::BUTTON_DOWN) {
|
|
|
|
this->selectedOption++;
|
|
|
|
}
|
|
|
|
if (this->selectedOption < 0) {
|
|
|
|
this->selectedOption = maxOptionValue;
|
|
|
|
} else if (this->selectedOption >= maxOptionValue) {
|
|
|
|
this->selectedOption = 0;
|
|
|
|
}
|
|
|
|
}
|
2021-10-09 00:58:55 +02:00
|
|
|
|
2021-10-15 15:41:16 +02:00
|
|
|
virtual bool entrySelected(Input *input) {
|
|
|
|
return input->data.buttons_d & Input::BUTTON_A;
|
|
|
|
}
|
2021-10-09 00:58:55 +02:00
|
|
|
|
2021-10-15 15:41:16 +02:00
|
|
|
virtual void printHeader() {
|
|
|
|
WiiUScreen::drawLine("Wudump");
|
|
|
|
WiiUScreen::drawLine("==================");
|
|
|
|
WiiUScreen::drawLine("");
|
|
|
|
}
|
2021-10-09 00:58:55 +02:00
|
|
|
|
2021-10-15 15:41:16 +02:00
|
|
|
virtual void printFooter() {
|
|
|
|
ScreenUtils::printTextOnScreen(CONSOLE_SCREEN_TV, 0, 27, "By Maschell");
|
|
|
|
ScreenUtils::printTextOnScreen(CONSOLE_SCREEN_DRC, 0, 17, "By Maschell");
|
|
|
|
}
|
2021-10-09 00:58:55 +02:00
|
|
|
|
|
|
|
|
2021-10-15 15:41:16 +02:00
|
|
|
int selectedOption = 0;
|
2021-10-09 00:58:55 +02:00
|
|
|
};
|