1
0
forked from me/IronOS

Simplified animation methods

This commit is contained in:
Patrick Horlebein
2020-04-06 18:49:10 +02:00
parent 172eea4909
commit f3d0bc3965
3 changed files with 42 additions and 59 deletions

View File

@@ -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;