mirror of
https://github.com/wiiu-env/WiiUPluginLoaderBackend.git
synced 2024-11-22 04:39:17 +01:00
Config: Implement "onSelected" callback
This commit is contained in:
parent
4a2f60592e
commit
030c9b4265
@ -160,6 +160,7 @@ void ConfigUtils::displayMenu() {
|
|||||||
KPADStatus kpad_data{};
|
KPADStatus kpad_data{};
|
||||||
KPADError kpad_error;
|
KPADError kpad_error;
|
||||||
|
|
||||||
|
int32_t prevSelectedItem = -1;
|
||||||
bool isItemMovementAllowed = true;
|
bool isItemMovementAllowed = true;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
@ -313,9 +314,10 @@ void ConfigUtils::displayMenu() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
selectedBtn = 0;
|
selectedBtn = 0;
|
||||||
start = 0;
|
start = 0;
|
||||||
end = MAX_BUTTONS_ON_SCREEN;
|
end = MAX_BUTTONS_ON_SCREEN;
|
||||||
|
prevSelectedItem = -1;
|
||||||
|
|
||||||
auto items = currentCategory->getItems();
|
auto items = currentCategory->getItems();
|
||||||
if (items.size() < MAX_BUTTONS_ON_SCREEN) {
|
if (items.size() < MAX_BUTTONS_ON_SCREEN) {
|
||||||
@ -493,6 +495,14 @@ void ConfigUtils::displayMenu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (redraw) {
|
if (redraw) {
|
||||||
|
if (prevSelectedItem != (int32_t) selectedBtn) {
|
||||||
|
if (prevSelectedItem >= 0) {
|
||||||
|
config_items[prevSelectedItem]->onSelected(false);
|
||||||
|
}
|
||||||
|
config_items[selectedBtn]->onSelected(true);
|
||||||
|
prevSelectedItem = (int32_t) selectedBtn;
|
||||||
|
}
|
||||||
|
|
||||||
DrawUtils::beginDraw();
|
DrawUtils::beginDraw();
|
||||||
DrawUtils::clear(COLOR_BACKGROUND);
|
DrawUtils::clear(COLOR_BACKGROUND);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user