supertux
options_menu.hpp
1 // SuperTux
2 // Copyright (C) 2004 Tobas Glaesser <tobi.web@gmx.de>
3 // Copyright (C) 2006 Matthias Braun <matze@braunis.de>
4 //
5 // This program is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18 #ifndef HEADER_SUPERTUX_SUPERTUX_MENU_OPTIONS_MENU_HPP
19 #define HEADER_SUPERTUX_SUPERTUX_MENU_OPTIONS_MENU_HPP
20 
21 #include "gui/menu.hpp"
22 
23 class OptionsMenu final : public Menu
24 {
25 private:
26  static bool less_than_volume(const std::string& lhs, const std::string& rhs);
27 
28 public:
29  enum Type {
30  LOCALE,
31  VIDEO,
32  AUDIO,
33  CONTROLS,
34  EXTRAS,
35  ADVANCED
36  };
37 
38 public:
39  OptionsMenu(Type type, bool complete);
40  ~OptionsMenu() override;
41 
42  void on_window_resize() override;
43 
44  void menu_action(MenuItem& item) override;
45 
46 private:
47  void insert_label(const std::string& text);
48 
49  void add_magnification();
50  void add_aspect_ratio();
51  void add_window_resolutions();
52  void add_resolutions();
53  void add_vsync();
54  void add_sound_volume();
55  void add_music_volume();
56  void add_flash_intensity();
57  void add_mobile_control_scales();
58 
59 private:
60  enum MenuIDs {
61  MNID_WINDOW_RESIZABLE,
62  MNID_WINDOW_RESOLUTION,
63  MNID_FULLSCREEN,
64  MNID_FULLSCREEN_RESOLUTION,
65  MNID_FIT_WINDOW,
66  MNID_MAGNIFICATION,
67  MNID_ASPECTRATIO,
68  MNID_VSYNC,
69  MNID_FRAME_PREDICTION,
70  MNID_SOUND,
71  MNID_MUSIC,
72  MNID_SOUND_VOLUME,
73  MNID_MUSIC_VOLUME,
74  MNID_FLASH_INTENSITY,
75  MNID_RUMBLING,
76  MNID_DEVELOPER_MODE,
77  MNID_CHRISTMAS_MODE,
78  MNID_TRANSITIONS,
79  MNID_CUSTOM_TITLE_LEVELS,
80  MNID_CONFIRMATION_DIALOG,
81  MNID_PAUSE_ON_FOCUSLOSS,
82  MNID_CUSTOM_CURSOR,
83  MNID_RELEASE_CHECK,
84  MNID_MOBILE_CONTROLS,
85  MNID_MOBILE_CONTROLS_SCALE
86  };
87 
88 private:
89  struct StringOption {
90  std::vector<std::string> list = {};
91  int next = 0;
92  };
93 
94 private:
95  StringOption m_magnifications;
96  StringOption m_aspect_ratios;
97  StringOption m_window_resolutions;
98  StringOption m_resolutions;
99  StringOption m_vsyncs;
100  StringOption m_sound_volumes;
101  StringOption m_music_volumes;
102  StringOption m_flash_intensity_values;
103  StringOption m_mobile_control_scales;
104 
105 private:
106  OptionsMenu(const OptionsMenu&) = delete;
107  OptionsMenu& operator=(const OptionsMenu&) = delete;
108 };
109 
110 #endif
111 
112 /* EOF */
Definition: menu_item.hpp:23
Definition: options_menu.hpp:23
Definition: menu.hpp:55
OptionsMenu(Type type, bool complete)
Definition: options_menu.cpp:58