ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

settingsmenu.h

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the AUTHORS
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef STARK_UI_MENU_SETTINGS_MENU_H
00024 #define STARK_UI_MENU_SETTINGS_MENU_H
00025 
00026 #include "engines/stark/ui/menu/locationscreen.h"
00027 #include "engines/stark/services/services.h"
00028 #include "engines/stark/services/settings.h"
00029 
00030 namespace Stark {
00031 
00032 class VisualImageXMG;
00033 
00037 class TestSoundManager {
00038 public:
00039     TestSoundManager();
00040     ~TestSoundManager() {}
00041 
00043     void load();
00044 
00046     void close();
00047 
00049     void play(int index);
00050 
00052     void endLoop();
00053 
00055     void stop();
00056 
00058     void update();
00059 
00060 private:
00061     Resources::Sound *_currentSound;
00062     Resources::Sound *_sounds[3];
00063     bool _isLopping;
00064 };
00065 
00069 class SettingsMenuScreen : public StaticLocationScreen {
00070 public:
00071     SettingsMenuScreen(Gfx::Driver *gfx, Cursor *cursor);
00072     virtual ~SettingsMenuScreen();
00073 
00074     // StaticLocationScreen API
00075     void open() override;
00076     void close() override;
00077     void onGameLoop() override;
00078 
00079     void handleMouseUp();
00080 
00081 private:
00082     enum HelpTextIndex {
00083         kHighRes = 5,
00084         kSubtitles = 7,
00085         kSpecialFX = 9,
00086         kShadows = 11,
00087         kHighResFMV = 13,
00088         kVoice = 16,
00089         kMusic = 18,
00090         kSfx = 20,
00091         kAllowFF = 22
00092     };
00093 
00094     enum WidgetIndex {
00095         kWidgetVoice = 15,
00096         kWidgetMusic = 17,
00097         kWidgetSfx = 19
00098     };
00099 
00100     template<HelpTextIndex N>
00101     void textHandler(StaticLocationWidget &widget, const Common::Point &mousePos);
00102 
00103     template<Settings::BoolSettingIndex N>
00104     void flipSettingHandler();
00105 
00106     void backHandler();
00107 
00108 private:
00109     static const Color _textColorHovered;
00110     static const Color _textColorDefault;
00111 
00112     TestSoundManager _soundManager;
00113 };
00114 
00118 class CheckboxWidget : public StaticLocationWidget {
00119 public:
00120     CheckboxWidget(const char *renderEntryName, bool isChecked,
00121                    WidgetOnClickCallback *onClickCallback,
00122                    WidgetOnMouseMoveCallback *onMouseMoveCallback);
00123     virtual ~CheckboxWidget() {};
00124 
00125     // StaticLocationWidget API
00126     void render() override;
00127     bool isMouseInside(const Common::Point &mousePos) const override;
00128     void onClick() override;
00129 
00130 private:
00131     VisualImageXMG *_currentImage;
00132     VisualImageXMG *_checkBoxImage[2];
00133     Common::Point _position;
00134     int _checkboxWidth, _checkboxHeight;
00135     bool _isChecked;
00136 
00137     bool isMouseInsideCheckbox(const Common::Point &mousePos) const;
00138 };
00139 
00143 class VolumeWidget : public StaticLocationWidget {
00144 public:
00145     VolumeWidget(const char *renderEntryName, Cursor *cursor,
00146                  TestSoundManager &soundManager, int soundIndex, 
00147                  Settings::IntSettingIndex settingIndex,
00148                  WidgetOnMouseMoveCallback *onMouseMoveCallback);
00149     virtual ~VolumeWidget() {};
00150 
00151     // StaticLocationWidget API
00152     void render() override;
00153     bool isMouseInside(const Common::Point &mousePos) const override;
00154     void onClick() override;
00155     void onMouseMove(const Common::Point &mousePos) override;
00156     void onMouseUp() override;
00157 
00158 private:
00159     static const Color _textColorBgHovered;
00160     static const int _maxVolume = 256;
00161 
00162     VisualImageXMG *_sliderImage;
00163     VisualImageXMG *_bgImage;
00164 
00165     Cursor *_cursor;
00166 
00167     TestSoundManager &_soundManager;
00168     const int _soundIndex;
00169 
00170     Common::Point _sliderPosition, _bgPosition;
00171     int _bgWidth, _bgHeight, _sliderWidth, _minX, _maxX;
00172     
00173     bool _isDragged;
00174     const Settings::IntSettingIndex _settingIndex;
00175 
00176     bool isMouseInsideBg(const Common::Point &mousePos) const;
00177 
00178     int volumeToX(int volume) {
00179         return volume * (_maxX - _minX) / _maxVolume + _minX;
00180     }
00181 
00182     int xToVolume(int x) {
00183         return (x - _minX) * _maxVolume / (_maxX - _minX);  
00184     }
00185 };
00186 
00187 } // End of namespace Stark
00188 
00189 #endif // STARK_UI_MENU_SETTING_MENU_H


Generated on Sat Apr 20 2019 05:03:54 for ResidualVM by doxygen 1.7.1
curved edge   curved edge