mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2025-12-18 15:17:42 +03:00
Wrap-around navigation in Settings.
This commit is contained in:
parent
c262f222de
commit
9bad03b723
@ -45,37 +45,28 @@ void SettingsScreen::onExit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SettingsScreen::handleInput() {
|
void SettingsScreen::handleInput() {
|
||||||
// Check for Confirm button to toggle setting
|
// Handle actions with early return
|
||||||
if (inputManager.wasPressed(InputManager::BTN_CONFIRM)) {
|
if (inputManager.wasPressed(InputManager::BTN_CONFIRM)) {
|
||||||
// Toggle the current setting
|
|
||||||
toggleCurrentSetting();
|
toggleCurrentSetting();
|
||||||
|
|
||||||
// Trigger a redraw of the entire screen
|
|
||||||
updateRequired = true;
|
updateRequired = true;
|
||||||
return; // Return early to prevent further processing
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for Back button to exit settings
|
|
||||||
if (inputManager.wasPressed(InputManager::BTN_BACK)) {
|
if (inputManager.wasPressed(InputManager::BTN_BACK)) {
|
||||||
// Save settings and exit
|
|
||||||
SETTINGS.saveToFile();
|
SETTINGS.saveToFile();
|
||||||
onGoHome();
|
onGoHome();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle UP/DOWN navigation for multiple settings
|
// Handle navigation
|
||||||
if (inputManager.wasPressed(InputManager::BTN_UP) || inputManager.wasPressed(InputManager::BTN_LEFT)) {
|
if (inputManager.wasPressed(InputManager::BTN_UP) || inputManager.wasPressed(InputManager::BTN_LEFT)) {
|
||||||
// Move selection up
|
// Move selection up (with wrap-around)
|
||||||
if (selectedSettingIndex > 0) {
|
selectedSettingIndex = (selectedSettingIndex > 0) ? (selectedSettingIndex - 1) : (settingsCount - 1);
|
||||||
selectedSettingIndex--;
|
updateRequired = true;
|
||||||
updateRequired = true;
|
|
||||||
}
|
|
||||||
} else if (inputManager.wasPressed(InputManager::BTN_DOWN) || inputManager.wasPressed(InputManager::BTN_RIGHT)) {
|
} else if (inputManager.wasPressed(InputManager::BTN_DOWN) || inputManager.wasPressed(InputManager::BTN_RIGHT)) {
|
||||||
// Move selection down
|
// Move selection down (with wrap-around)
|
||||||
if (selectedSettingIndex < settingsCount - 1) {
|
selectedSettingIndex = (selectedSettingIndex < settingsCount - 1) ? (selectedSettingIndex + 1) : 0;
|
||||||
selectedSettingIndex++;
|
updateRequired = true;
|
||||||
updateRequired = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user