Fix title-screen flicker when loading a game or starting a campaign.

It was being displayed for a single frame in between loading dialogs.

(cherry picked from commit 9284871e91)
This commit is contained in:
Tommy 2022-04-29 00:13:16 +12:00 committed by Wedge009
parent 20d2c042ba
commit 9be14b4603
2 changed files with 11 additions and 0 deletions

View file

@ -259,6 +259,9 @@ void title_screen::pre_show(window& win)
register_button(win, "campaign", hotkey::TITLE_SCREEN__CAMPAIGN, [this, &win]() {
try{
if(game_.new_campaign()) {
// Suspend drawing of the title screen,
// so it doesn't flicker in between loading screens.
win.set_suspend_drawing(true);
win.set_retval(LAUNCH_GAME);
}
} catch (const config::error& e) {
@ -277,6 +280,9 @@ void title_screen::pre_show(window& win)
//
register_button(win, "load", hotkey::HOTKEY_LOAD_GAME, [this, &win]() {
if(game_.load_game()) {
// Suspend drawing of the title screen,
// so it doesn't flicker in between loading screens.
win.set_suspend_drawing(true);
win.set_retval(LAUNCH_GAME);
}
});

View file

@ -425,6 +425,11 @@ public:
callback_next_draw_ = func;
}
void set_suspend_drawing(bool s = true)
{
suspend_drawing_ = s;
}
enum class show_mode {
none,
modal,