mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2024-12-05 00:38:00 +01:00
mainloop: React to expose events when the engine is paused
When the engine is paused, it doesn't redraw the window content anymore. On uncomposited environments, this means that the window content can be lost. Enable expose events and react to them when the engine is paused (if it's not, the whole window will be repainted soon anyway, so we can ignore them).
This commit is contained in:
parent
f5eb7b088b
commit
6f22f54f5d
2 changed files with 7 additions and 1 deletions
|
@ -240,7 +240,7 @@ SYMBOL_EXPORT struct Game* libsuperderpy_init(int argc, char** argv, const char*
|
|||
windowMode |= ALLEGRO_RESIZABLE;
|
||||
}
|
||||
|
||||
al_set_new_display_flags(windowMode | ALLEGRO_OPENGL | ALLEGRO_PROGRAMMABLE_PIPELINE);
|
||||
al_set_new_display_flags(windowMode | ALLEGRO_OPENGL | ALLEGRO_PROGRAMMABLE_PIPELINE | ALLEGRO_GENERATE_EXPOSE_EVENTS);
|
||||
al_set_new_display_option(ALLEGRO_VSYNC, 2 - strtol(GetConfigOptionDefault(game, "SuperDerpy", "vsync", "1"), NULL, 10), ALLEGRO_SUGGEST);
|
||||
|
||||
#ifdef LIBSUPERDERPY_ORIENTATION_LANDSCAPE
|
||||
|
|
|
@ -48,6 +48,12 @@ static inline bool HandleEvent(struct Game* game, ALLEGRO_EVENT* ev) {
|
|||
}
|
||||
break;
|
||||
|
||||
case ALLEGRO_EVENT_DISPLAY_EXPOSE:
|
||||
if (game->_priv.paused) {
|
||||
RedrawScreen(game);
|
||||
}
|
||||
break;
|
||||
|
||||
case ALLEGRO_EVENT_DISPLAY_RESIZE:
|
||||
PrintConsole(game, "Resize event: %dx%d", ev->display.width, ev->display.height);
|
||||
#ifdef LIBSUPERDERPY_IMGUI
|
||||
|
|
Loading…
Reference in a new issue