X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fsupertux%2Fmenu%2Fmain_menu.cpp;h=8eb4d7aa8031baf88c15c2d46fa3a51298cd3a1e;hb=9216f1fcdf1b42ad67f794c383d252b35c885df7;hp=133da757463fa73ab6feaf58397afddcb7334f61;hpb=fb7ec3e0b1fefa5d88bd1a4c8b81a3b71a72c1fd;p=supertux.git diff --git a/src/supertux/menu/main_menu.cpp b/src/supertux/menu/main_menu.cpp index 133da7574..8eb4d7aa8 100644 --- a/src/supertux/menu/main_menu.cpp +++ b/src/supertux/menu/main_menu.cpp @@ -1,5 +1,5 @@ // SuperTux -// Copyright (C) 2009 Ingo Ruhnke +// Copyright (C) 2009 Ingo Ruhnke // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -17,6 +17,7 @@ #include "supertux/menu/main_menu.hpp" #include "audio/sound_manager.hpp" +#include "gui/menu_item.hpp" #include "gui/menu_manager.hpp" #include "supertux/fadeout.hpp" #include "supertux/game_manager.hpp" @@ -51,15 +52,14 @@ MainMenu::on_window_resize() } void -MainMenu::check_menu() +MainMenu::menu_action(MenuItem* item) { - switch (check()) + switch (item->id) { case MNID_STARTGAME: { - std::unique_ptr world(new World); - world->load("levels/world1/info"); - GameManager::current()->start_game(std::move(world)); + std::unique_ptr world = World::load("levels/world1"); + GameManager::current()->start_worldmap(std::move(world)); } break; @@ -75,13 +75,13 @@ MainMenu::check_menu() case MNID_CREDITS: MenuManager::instance().clear_menu_stack(); - g_screen_manager->push_screen(std::unique_ptr(new TextScroller("credits.txt")), + ScreenManager::current()->push_screen(std::unique_ptr(new TextScroller("credits.txt")), std::unique_ptr(new FadeOut(0.5))); break; case MNID_QUITMAINMENU: - g_screen_manager->quit(std::unique_ptr(new FadeOut(0.25))); - sound_manager->stop_music(0.25); + ScreenManager::current()->quit(std::unique_ptr(new FadeOut(0.25))); + SoundManager::current()->stop_music(0.25); break; } }