ScummVM API documentation
settingsmenu.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef STARK_UI_MENU_SETTINGS_MENU_H
23 #define STARK_UI_MENU_SETTINGS_MENU_H
24 
25 #include "engines/stark/ui/menu/locationscreen.h"
26 #include "engines/stark/services/services.h"
27 #include "engines/stark/services/settings.h"
28 
29 namespace Stark {
30 
31 class VisualImageXMG;
32 
37 public:
39  ~TestSoundManager() {}
40 
42  void load();
43 
45  void close();
46 
48  void play(int index);
49 
51  void endLoop();
52 
54  void stop();
55 
57  void update();
58 
59 private:
60  Resources::Sound *_currentSound;
61  Resources::Sound *_sounds[3];
62  bool _isLopping;
63 };
64 
69 public:
70  SettingsMenuScreen(Gfx::Driver *gfx, Cursor *cursor);
71  virtual ~SettingsMenuScreen();
72 
73  // StaticLocationScreen API
74  void open() override;
75  void close() override;
76  void onGameLoop() override;
77 
78  void handleMouseUp();
79 
80 private:
81  enum HelpTextIndex {
82  kHighRes = 5,
83  kSubtitles = 7,
84  kSpecialFX = 9,
85  kShadows = 11,
86  kHighResFMV = 13,
87  kVoice = 16,
88  kMusic = 18,
89  kSfx = 20,
90  kAllowFF = 22
91  };
92 
93  enum WidgetIndex {
94  kWidgetVoice = 15,
95  kWidgetMusic = 17,
96  kWidgetSfx = 19
97  };
98 
99  template<HelpTextIndex N>
100  void textHandler(StaticLocationWidget &widget, const Common::Point &mousePos);
101 
102  template<Settings::BoolSettingIndex N>
103  void flipSettingHandler();
104 
105  void backHandler();
106 
107 private:
108  const Gfx::Color _textColorHovered = Gfx::Color(0x1E, 0x1E, 0x96);
109  const Gfx::Color _textColorDefault = Gfx::Color(0x00, 0x00, 0x00);
110 
111  TestSoundManager _soundManager;
112 };
113 
118 public:
119  CheckboxWidget(const char *renderEntryName, bool isChecked,
120  WidgetOnClickCallback *onClickCallback,
121  WidgetOnMouseMoveCallback *onMouseMoveCallback);
122  virtual ~CheckboxWidget() {};
123 
124  // StaticLocationWidget API
125  void render() override;
126  bool isMouseInside(const Common::Point &mousePos) const override;
127  void onClick() override;
128 
129 private:
130  VisualImageXMG *_currentImage;
131  VisualImageXMG *_checkBoxImage[2];
132  Common::Point _position;
133  int _checkboxWidth, _checkboxHeight;
134  bool _isChecked;
135 
136  bool isMouseInsideCheckbox(const Common::Point &mousePos) const;
137 };
138 
143 public:
144  VolumeWidget(const char *renderEntryName, Cursor *cursor,
145  TestSoundManager &soundManager, int soundIndex,
146  Settings::IntSettingIndex settingIndex,
147  WidgetOnMouseMoveCallback *onMouseMoveCallback);
148  virtual ~VolumeWidget() {};
149 
150  // StaticLocationWidget API
151  void render() override;
152  bool isMouseInside(const Common::Point &mousePos) const override;
153  void onClick() override;
154  void onMouseMove(const Common::Point &mousePos) override;
155  void onMouseUp() override;
156 
157 private:
158  const Gfx::Color _textColorBgHovered = Gfx::Color(0xFF, 0xFF, 0xFF);
159  static const int _maxVolume = 256;
160 
161  VisualImageXMG *_sliderImage;
162  VisualImageXMG *_bgImage;
163 
164  Cursor *_cursor;
165 
166  TestSoundManager &_soundManager;
167  const int _soundIndex;
168 
169  Common::Point _sliderPosition, _bgPosition;
170  int _bgWidth, _bgHeight, _sliderWidth, _minX, _maxX;
171 
172  bool _isDragged;
173  const Settings::IntSettingIndex _settingIndex;
174 
175  bool isMouseInsideBg(const Common::Point &mousePos) const;
176 
177  int volumeToX(int volume) {
178  return volume * (_maxX - _minX) / _maxVolume + _minX;
179  }
180 
181  int xToVolume(int x) {
182  return (x - _minX) * _maxVolume / (_maxX - _minX);
183  }
184 };
185 
186 } // End of namespace Stark
187 
188 #endif // STARK_UI_MENU_SETTING_MENU_H
Definition: settingsmenu.h:36
Definition: locationscreen.h:92
Definition: sound.h:47
Definition: settingsmenu.h:117
Definition: settingsmenu.h:68
Definition: settingsmenu.h:142
Definition: driver.h:44
Definition: cursor.h:45
Definition: locationscreen.h:46
Definition: console.h:27
Definition: rect.h:45
Definition: color.h:30
void play(int index)
Definition: image.h:45
Definition: func.h:473