Move `SDL_ShowWindow` to after assets are loaded

This is a minor optimization to streamline the experience of Ved
playtesting. Previously, the user would have to wait for all the assets
to load when launching playtesting (most of the time, I suspect, is
taken up by loading music from a vvvvvvmusic blob). With this
optimization, however, the game can be launched in the background and
its assets can be loaded, while it blocks on STDIN input. During this
time, the user in Ved will be choosing where to start playtesting. After
Ved provides STDIN input, then the window will be created and appears
instantaneously.

This also fixes a related issue in which providing an invalid
playtesting level name would result in a brief window flash that gets
instantly destroyed. With this, if the level is invalid then no window
is ever shown at all.
This commit is contained in:
Misa 2022-06-01 16:42:22 -07:00
parent a46c49c89a
commit cc61194bed
2 changed files with 3 additions and 1 deletions

View File

@ -191,7 +191,6 @@ void Screen::ResizeScreen(int x, int y)
return;
}
}
SDL_ShowWindow(m_window);
}
void Screen::ResizeToNearestMultiple(void)

View File

@ -668,6 +668,9 @@ int main(int argc, char *argv[])
}
#endif
/* Only create the window after we have loaded all the assets. */
SDL_ShowWindow(gameScreen.m_window);
key.isActive = true;
gamestate_funcs = get_gamestate_funcs(game.gamestate, &num_gamestate_funcs);