diff options
Diffstat (limited to 'screen_ui.cpp')
-rw-r--r-- | screen_ui.cpp | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/screen_ui.cpp b/screen_ui.cpp index f2fda2f..f23affa 100644 --- a/screen_ui.cpp +++ b/screen_ui.cpp @@ -76,7 +76,9 @@ ScreenRecoveryUI::ScreenRecoveryUI() : animation_fps(20), installing_frames(-1), stage(-1), - max_stage(-1) { + max_stage(-1), + rainbow(false), + wrap_count(0) { for (int i = 0; i < 5; i++) { backgroundIcon[i] = nullptr; @@ -321,6 +323,12 @@ void* ScreenRecoveryUI::ProgressThreadStartRoutine(void* data) { return nullptr; } +void ScreenRecoveryUI::OMGRainbows() +{ + rainbow = rainbow ? false : true; + set_rainbow_mode(rainbow); +} + void ScreenRecoveryUI::ProgressThreadLoop() { double interval = 1.0 / animation_fps; while (true) { @@ -664,16 +672,40 @@ void ScreenRecoveryUI::StartMenu(const char* const * headers, const char* const } int ScreenRecoveryUI::SelectMenu(int sel) { + int wrapped = 0; pthread_mutex_lock(&updateMutex); if (show_menu) { int old_sel = menu_sel; menu_sel = sel; // Wrap at top and bottom. - if (menu_sel < 0) menu_sel = menu_items - 1; - if (menu_sel >= menu_items) menu_sel = 0; - + if (rainbow) { + if (menu_sel > old_sel) { + move_rainbow(1); + } else if (menu_sel < old_sel) { + move_rainbow(-1); + } + } + if (menu_sel < 0) { + wrapped = -1; + menu_sel = menu_items - 1; + } + if (menu_sel >= menu_items) { + wrapped = 1; + menu_sel = 0; + } sel = menu_sel; + if (wrapped != 0) { + if (wrap_count / wrapped > 0) { + wrap_count += wrapped; + } else { + wrap_count = wrapped; + } + if (wrap_count / wrapped >= 5) { + wrap_count = 0; + OMGRainbows(); + } + } if (menu_sel != old_sel) update_screen_locked(); } pthread_mutex_unlock(&updateMutex); |