2 // Copyright (C) 2009 Ingo Ruhnke <grumbel@gmx.de>
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/contrib_world_menu.hpp"
23 #include "supertux/menu/game_menu.hpp"
24 #include "supertux/menu/joystick_menu.hpp"
25 #include "supertux/menu/keyboard_menu.hpp"
26 #include "supertux/menu/language_menu.hpp"
27 #include "supertux/menu/main_menu.hpp"
28 #include "supertux/menu/options_menu.hpp"
29 #include "supertux/menu/profile_menu.hpp"
30 #include "supertux/menu/worldmap_menu.hpp"
32 MenuStorage* MenuStorage::s_instance = 0;
35 MenuStorage::instance()
41 MenuStorage::MenuStorage()
47 MenuStorage::~MenuStorage()
53 MenuStorage::create(MenuId menu_id)
58 return std::unique_ptr<Menu>(new MainMenu);
61 return std::unique_ptr<Menu>(new LanguageMenu);
64 return std::unique_ptr<Menu>(new OptionsMenu(true));
66 case INGAME_OPTIONS_MENU:
67 return std::unique_ptr<Menu>(new OptionsMenu(false));
70 return std::unique_ptr<Menu>(new ProfileMenu);
73 return std::unique_ptr<Menu>(new KeyboardMenu(g_input_manager));
76 return std::unique_ptr<Menu>(new JoystickMenu(g_input_manager));
79 return std::unique_ptr<Menu>(new WorldmapMenu);
82 return std::unique_ptr<Menu>(new GameMenu);
85 return std::unique_ptr<Menu>(new ContribMenu);
87 case CONTRIB_WORLD_MENU:
88 return 0; //return new ContribWorldMenu();
91 return std::unique_ptr<Menu>(new AddonMenu);
94 return std::unique_ptr<Menu>();
97 assert(!"unknown MenuId provided");
102 MenuStorage::get_key_options_menu()
105 return new KeyboardMenu(g_input_manager);
109 MenuStorage::get_joystick_options_menu()
112 return new JoystickMenu(g_input_manager);