* moved "Menu::set_current(NULL);" before fadeout, so it closes during it
* added main_loop->has_no_pending_fadeout() to avoid reopening main menu during fadeouts.
git-svn-id: http://supertux.lethargik.org/svn/supertux/trunk/supertux@5906
837edb03-e0f3-0310-88ca-
d4d4e8b29345
void
GameSession::setup()
{
- Menu::set_current(NULL);
current_ = this;
if(currentsector != Sector::current()) {
void
LevelIntro::setup()
{
- Menu::set_current(NULL);
}
void
return speed;
}
+bool
+MainLoop::has_no_pending_fadeout() const
+{
+ return screen_fade.get() == NULL || screen_fade->done();
+}
+
void
MainLoop::draw_fps(DrawingContext& context, float fps_fps)
{
MainLoop::handle_screen_switch()
{
while( (next_screen.get() != NULL || nextpop) &&
- (screen_fade.get() == NULL || screen_fade->done())) {
+ has_no_pending_fadeout()) {
if(current_screen.get() != NULL) {
current_screen->leave();
}
void quit(ScreenFade* fade = NULL);
void set_speed(float speed);
float get_speed() const;
+ bool has_no_pending_fadeout() const;
/**
* requests that a screenshot be taken after the next frame has been rendered
TextScroller::setup()
{
sound_manager->play_music(music);
- Menu::set_current(NULL);
}
void
break;
case MNID_CREDITS:
+ Menu::set_current(NULL);
main_loop->push_screen(new TextScroller("credits.txt"),
new FadeOut(0.5));
break;
}
}
- // reopen menu of user closed it (so that the app doesn't close when user
+ // reopen menu if user closed it (so that the app doesn't close when user
// accidently hit ESC)
- if(Menu::current() == 0) {
+ if(Menu::current() == 0 && main_loop->has_no_pending_fadeout()) {
generate_main_menu();
Menu::set_current(main_menu.get());
}
void
TitleScreen::start_game()
{
+ Menu::set_current(NULL);
std::string basename = current_world->get_basedir();
basename = basename.substr(0, basename.length()-1);
std::string worlddirname = FileSystem::basename(basename);