2 // Copyright (C) 2009 Ingo Ruhnke <grumbel@gmail.com>
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #include "supertux/menu/menu_storage.hpp"
19 #include "supertux/globals.hpp"
20 #include "supertux/menu/addon_menu.hpp"
21 #include "supertux/menu/contrib_menu.hpp"
22 #include "supertux/menu/game_menu.hpp"
23 #include "supertux/menu/joystick_menu.hpp"
24 #include "supertux/menu/keyboard_menu.hpp"
25 #include "supertux/menu/language_menu.hpp"
26 #include "supertux/menu/main_menu.hpp"
27 #include "supertux/menu/options_menu.hpp"
28 #include "supertux/menu/profile_menu.hpp"
29 #include "supertux/menu/worldmap_menu.hpp"
31 MenuStorage* MenuStorage::s_instance = 0;
34 MenuStorage::instance()
40 MenuStorage::MenuStorage()
46 MenuStorage::~MenuStorage()
52 MenuStorage::create(MenuId menu_id)
57 return std::unique_ptr<Menu>(new MainMenu);
60 return std::unique_ptr<Menu>(new LanguageMenu);
63 return std::unique_ptr<Menu>(new OptionsMenu(true));
65 case INGAME_OPTIONS_MENU:
66 return std::unique_ptr<Menu>(new OptionsMenu(false));
69 return std::unique_ptr<Menu>(new ProfileMenu);
72 return std::unique_ptr<Menu>(new KeyboardMenu(g_input_manager));
75 return std::unique_ptr<Menu>(new JoystickMenu(g_input_manager));
78 return std::unique_ptr<Menu>(new WorldmapMenu);
81 return std::unique_ptr<Menu>(new GameMenu);
84 return std::unique_ptr<Menu>(new ContribMenu);
86 case CONTRIB_WORLD_MENU:
87 return 0; //return new ContribWorldMenu();
90 return std::unique_ptr<Menu>(new AddonMenu);
93 return std::unique_ptr<Menu>();
96 assert(!"unknown MenuId provided");
97 return std::unique_ptr<Menu>();