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.h"
22 #include "game_session.h"
24 #include "gui/button.h"
26 #include "resources.h"
29 #include "control/joystickkeyboardcontroller.h"
33 Menu* options_menu = 0;
34 Menu* options_keys_menu = 0;
35 Menu* options_joystick_menu = 0;
36 Menu* highscore_menu = 0;
37 Menu* load_game_menu = 0;
38 Menu* save_game_menu = 0;
39 Menu* contrib_menu = 0;
40 Menu* contrib_subset_menu = 0;
42 void process_options_menu()
44 switch (options_menu->check()) {
46 if(config->use_fullscreen != options_menu->is_toggled(MNID_FULLSCREEN)) {
47 config->use_fullscreen = !config->use_fullscreen;
52 if(config->sound_enabled != options_menu->is_toggled(MNID_SOUND)) {
53 config->sound_enabled = !config->sound_enabled;
54 sound_manager->enable_sound(config->sound_enabled);
58 if(config->music_enabled != options_menu->is_toggled(MNID_MUSIC)) {
59 config->music_enabled = !config->music_enabled;
60 sound_manager->enable_music(config->music_enabled);
70 main_menu = new Menu();
71 options_menu = new Menu();
72 load_game_menu = new Menu();
73 game_menu = new Menu();
74 contrib_menu = new Menu();
75 contrib_subset_menu = new Menu();
76 worldmap_menu = new Menu();
78 main_menu->set_pos(SCREEN_WIDTH/2, 335);
79 main_menu->add_submenu(_("Start Game"), load_game_menu, MNID_STARTGAME);
80 main_menu->add_submenu(_("Contrib Levels"), contrib_menu, MNID_LEVELS_CONTRIB);
81 main_menu->add_submenu(_("Options"), options_menu);
82 main_menu->add_entry(MNID_LEVELEDITOR, _("Level Editor"));
83 main_menu->add_entry(MNID_CREDITS, _("Credits"));
84 main_menu->add_entry(MNID_QUITMAINMENU, _("Quit"));
86 options_menu->add_label(_("Options"));
87 options_menu->add_hl();
88 options_menu->add_toggle(MNID_FULLSCREEN,_("Fullscreen"), config->use_fullscreen);
89 options_menu->add_toggle(MNID_SOUND, _("Sound"), config->sound_enabled);
90 options_menu->add_toggle(MNID_MUSIC, _("Music"), config->music_enabled);
91 options_menu->add_submenu(_("Setup Keys"),
92 main_controller->get_key_options_menu());
93 options_menu->add_submenu(_("Setup Joystick"),
94 main_controller->get_joystick_options_menu());
95 options_menu->add_hl();
96 options_menu->add_back(_("Back"));
98 load_game_menu->add_label(_("Start Game"));
99 load_game_menu->add_hl();
100 load_game_menu->add_deactive(1, "Slot 1");
101 load_game_menu->add_deactive(2, "Slot 2");
102 load_game_menu->add_deactive(3, "Slot 3");
103 load_game_menu->add_deactive(4, "Slot 4");
104 load_game_menu->add_deactive(5, "Slot 5");
105 load_game_menu->add_hl();
106 load_game_menu->add_back(_("Back"));
108 game_menu->add_label(_("Pause"));
110 game_menu->add_entry(MNID_CONTINUE, _("Continue"));
111 game_menu->add_submenu(_("Options"), options_menu);
113 game_menu->add_entry(MNID_ABORTLEVEL, _("Abort Level"));
115 worldmap_menu->add_label(_("Pause"));
116 worldmap_menu->add_hl();
117 worldmap_menu->add_entry(WorldMapNS::MNID_RETURNWORLDMAP, _("Continue"));
118 worldmap_menu->add_submenu(_("Options"), options_menu);
119 worldmap_menu->add_hl();
120 worldmap_menu->add_entry(WorldMapNS::MNID_QUITWORLDMAP, _("Quit Game"));
125 delete worldmap_menu;
130 delete contrib_subset_menu;
131 delete load_game_menu;