2 // Copyright (C) 2004 Tobas Glaesser <tobi.web@gmx.de>
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (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, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 #include "gameconfig.hpp"
22 #include "game_session.hpp"
23 #include "gui/menu.hpp"
24 #include "gui/button.hpp"
25 #include "audio/sound_manager.hpp"
27 #include "resources.hpp"
28 #include "worldmap.hpp"
29 #include "gettext.hpp"
30 #include "control/joystickkeyboardcontroller.hpp"
34 Menu* options_menu = 0;
35 Menu* options_keys_menu = 0;
36 Menu* options_joystick_menu = 0;
37 Menu* highscore_menu = 0;
38 Menu* load_game_menu = 0;
39 Menu* save_game_menu = 0;
40 Menu* contrib_menu = 0;
41 Menu* contrib_subset_menu = 0;
43 void process_options_menu()
45 switch (options_menu->check()) {
47 if(config->use_fullscreen != options_menu->is_toggled(MNID_FULLSCREEN)) {
48 config->use_fullscreen = !config->use_fullscreen;
54 if(config->sound_enabled != options_menu->is_toggled(MNID_SOUND)) {
55 config->sound_enabled = !config->sound_enabled;
56 sound_manager->enable_sound(config->sound_enabled);
61 if(config->music_enabled != options_menu->is_toggled(MNID_MUSIC)) {
62 config->music_enabled = !config->music_enabled;
63 sound_manager->enable_music(config->music_enabled);
74 main_menu = new Menu();
75 options_menu = new Menu();
76 load_game_menu = new Menu();
77 game_menu = new Menu();
78 contrib_menu = new Menu();
79 contrib_subset_menu = new Menu();
80 worldmap_menu = new Menu();
82 main_menu->set_pos(SCREEN_WIDTH/2, 335);
83 main_menu->add_submenu(_("Start Game"), load_game_menu, MNID_STARTGAME);
84 main_menu->add_submenu(_("Contrib Levels"), contrib_menu, MNID_LEVELS_CONTRIB);
85 main_menu->add_submenu(_("Options"), options_menu);
86 //main_menu->add_entry(MNID_LEVELEDITOR, _("Level Editor"));
87 main_menu->add_entry(MNID_CREDITS, _("Credits"));
88 main_menu->add_entry(MNID_QUITMAINMENU, _("Quit"));
90 options_menu->add_label(_("Options"));
91 options_menu->add_hl();
92 options_menu->add_toggle(MNID_FULLSCREEN,_("Fullscreen"), config->use_fullscreen);
93 options_menu->add_toggle(MNID_SOUND, _("Sound"), config->sound_enabled);
94 options_menu->add_toggle(MNID_MUSIC, _("Music"), config->music_enabled);
95 options_menu->add_submenu(_("Setup Keys"),
96 main_controller->get_key_options_menu());
97 options_menu->add_submenu(_("Setup Joystick"),
98 main_controller->get_joystick_options_menu());
99 options_menu->add_hl();
100 options_menu->add_back(_("Back"));
102 load_game_menu->add_label(_("Start Game"));
103 load_game_menu->add_hl();
104 load_game_menu->add_deactive(1, "Slot 1");
105 load_game_menu->add_deactive(2, "Slot 2");
106 load_game_menu->add_deactive(3, "Slot 3");
107 load_game_menu->add_deactive(4, "Slot 4");
108 load_game_menu->add_deactive(5, "Slot 5");
109 load_game_menu->add_hl();
110 load_game_menu->add_back(_("Back"));
112 game_menu->add_label(_("Pause"));
114 game_menu->add_entry(MNID_CONTINUE, _("Continue"));
115 game_menu->add_submenu(_("Options"), options_menu);
117 game_menu->add_entry(MNID_ABORTLEVEL, _("Abort Level"));
119 worldmap_menu->add_label(_("Pause"));
120 worldmap_menu->add_hl();
121 worldmap_menu->add_entry(WorldMapNS::MNID_RETURNWORLDMAP, _("Continue"));
122 worldmap_menu->add_submenu(_("Options"), options_menu);
123 worldmap_menu->add_hl();
124 worldmap_menu->add_entry(WorldMapNS::MNID_QUITWORLDMAP, _("Quit Game"));
129 delete worldmap_menu;
134 delete contrib_subset_menu;
135 delete load_game_menu;