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;
36 void process_options_menu()
38 switch (options_menu->check()) {
40 if(config->use_fullscreen != options_menu->is_toggled(MNID_FULLSCREEN)) {
41 config->use_fullscreen = !config->use_fullscreen;
47 if(config->sound_enabled != options_menu->is_toggled(MNID_SOUND)) {
48 config->sound_enabled = !config->sound_enabled;
49 sound_manager->enable_sound(config->sound_enabled);
54 if(config->music_enabled != options_menu->is_toggled(MNID_MUSIC)) {
55 config->music_enabled = !config->music_enabled;
56 sound_manager->enable_music(config->music_enabled);
67 main_menu = new Menu();
68 options_menu = new Menu();
69 game_menu = new Menu();
70 worldmap_menu = new Menu();
72 main_menu->set_pos(SCREEN_WIDTH/2, 335);
73 main_menu->add_entry(MNID_STARTGAME, _("Start Game"));
74 main_menu->add_entry(MNID_LEVELS_CONTRIB, _("Contrib Levels"));
75 main_menu->add_submenu(_("Options"), options_menu);
76 //main_menu->add_entry(MNID_LEVELEDITOR, _("Level Editor"));
77 main_menu->add_entry(MNID_CREDITS, _("Credits"));
78 main_menu->add_entry(MNID_QUITMAINMENU, _("Quit"));
80 options_menu->add_label(_("Options"));
81 options_menu->add_hl();
82 options_menu->add_toggle(MNID_FULLSCREEN,_("Fullscreen"), config->use_fullscreen);
83 options_menu->add_toggle(MNID_SOUND, _("Sound"), config->sound_enabled);
84 options_menu->add_toggle(MNID_MUSIC, _("Music"), config->music_enabled);
85 options_menu->add_submenu(_("Setup Keys"),
86 main_controller->get_key_options_menu());
87 options_menu->add_submenu(_("Setup Joystick"),
88 main_controller->get_joystick_options_menu());
89 options_menu->add_hl();
90 options_menu->add_back(_("Back"));
92 game_menu->add_label(_("Pause"));
94 game_menu->add_entry(MNID_CONTINUE, _("Continue"));
95 game_menu->add_submenu(_("Options"), options_menu);
97 game_menu->add_entry(MNID_ABORTLEVEL, _("Abort Level"));
99 worldmap_menu->add_label(_("Pause"));
100 worldmap_menu->add_hl();
101 worldmap_menu->add_entry(WorldMapNS::MNID_RETURNWORLDMAP, _("Continue"));
102 worldmap_menu->add_submenu(_("Options"), options_menu);
103 worldmap_menu->add_hl();
104 worldmap_menu->add_entry(WorldMapNS::MNID_QUITWORLDMAP, _("Quit Game"));
109 delete worldmap_menu;