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,38 +45,29 @@ void SettingsScreen::onExit() {
|
||||
}
|
||||
|
||||
void SettingsScreen::handleInput() {
|
||||
// Check for Confirm button to toggle setting
|
||||
// Handle actions with early return
|
||||
if (inputManager.wasPressed(InputManager::BTN_CONFIRM)) {
|
||||
// Toggle the current setting
|
||||
toggleCurrentSetting();
|
||||
|
||||
// Trigger a redraw of the entire screen
|
||||
updateRequired = true;
|
||||
return; // Return early to prevent further processing
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for Back button to exit settings
|
||||
if (inputManager.wasPressed(InputManager::BTN_BACK)) {
|
||||
// Save settings and exit
|
||||
SETTINGS.saveToFile();
|
||||
onGoHome();
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle UP/DOWN navigation for multiple settings
|
||||
// Handle navigation
|
||||
if (inputManager.wasPressed(InputManager::BTN_UP) || inputManager.wasPressed(InputManager::BTN_LEFT)) {
|
||||
// Move selection up
|
||||
if (selectedSettingIndex > 0) {
|
||||
selectedSettingIndex--;
|
||||
// Move selection up (with wrap-around)
|
||||
selectedSettingIndex = (selectedSettingIndex > 0) ? (selectedSettingIndex - 1) : (settingsCount - 1);
|
||||
updateRequired = true;
|
||||
}
|
||||
} else if (inputManager.wasPressed(InputManager::BTN_DOWN) || inputManager.wasPressed(InputManager::BTN_RIGHT)) {
|
||||
// Move selection down
|
||||
if (selectedSettingIndex < settingsCount - 1) {
|
||||
selectedSettingIndex++;
|
||||
// Move selection down (with wrap-around)
|
||||
selectedSettingIndex = (selectedSettingIndex < settingsCount - 1) ? (selectedSettingIndex + 1) : 0;
|
||||
updateRequired = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsScreen::toggleCurrentSetting() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user