Simplified animation methods
This commit is contained in:
@@ -826,14 +826,20 @@ void gui_Menu(const menuitem *menu) {
|
||||
static bool enterGUIMenu = true;
|
||||
enterGUIMenu = true;
|
||||
|
||||
// Animated menu opening.
|
||||
if (menu[currentScreen].draw.func != NULL) {
|
||||
uint8_t secondFrameBuffer[OLED_WIDTH * 2];
|
||||
OLED::set_framebuffer(secondFrameBuffer);
|
||||
// This menu is drawn in a secondary framebuffer.
|
||||
// Then we play a transition from the current primary
|
||||
// framebuffer to the new buffer.
|
||||
// The extra buffer is discarded at the end of the transition.
|
||||
uint8_t secondaryFrameBuffer[OLED_WIDTH * 2];
|
||||
OLED::set_framebuffer(secondaryFrameBuffer);
|
||||
OLED::setFont(0);
|
||||
OLED::setCursor(0, 0);
|
||||
OLED::clearScreen();
|
||||
menu[currentScreen].draw.func();
|
||||
OLED::presentSecondScreenBufferAnimated();
|
||||
OLED::set_framebuffer(NULL);
|
||||
OLED::transitionToContents(secondaryFrameBuffer, true);
|
||||
}
|
||||
|
||||
while ((menu[currentScreen].draw.func != NULL) && earlyExit == false) {
|
||||
@@ -888,13 +894,14 @@ void gui_Menu(const menuitem *menu) {
|
||||
menu[currentScreen].incrementHandler.func();
|
||||
|
||||
if (enterGUIMenu) {
|
||||
uint8_t secondFrameBuffer[OLED_WIDTH * 2];
|
||||
OLED::set_framebuffer(secondFrameBuffer);
|
||||
uint8_t secondaryFrameBuffer[OLED_WIDTH * 2];
|
||||
OLED::set_framebuffer(secondaryFrameBuffer);
|
||||
OLED::setFont(0);
|
||||
OLED::setCursor(0, 0);
|
||||
OLED::clearScreen();
|
||||
menu[currentScreen].draw.func();
|
||||
OLED::presentSecondScreenBufferAnimatedBack();
|
||||
OLED::set_framebuffer(NULL);
|
||||
OLED::transitionToContents(secondaryFrameBuffer, false);
|
||||
}
|
||||
} else {
|
||||
earlyExit = true;
|
||||
|
||||
Reference in New Issue
Block a user