SuperTuxKart
options_screen_video.hpp
1 // SuperTuxKart - a fun racing game with go-kart
2 // Copyright (C) 2009-2015 Marianne Gagnon
3 //
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 3
7 // of the License, or (at your option) any later version.
8 //
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.
13 //
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.
17 
18 
19 #ifndef __HEADER_OPTIONS_SCREEN_VIDEO_HPP__
20 #define __HEADER_OPTIONS_SCREEN_VIDEO_HPP__
21 
22 #include <string>
23 
24 #include "guiengine/screen.hpp"
25 
26 namespace GUIEngine { class Widget; }
27 
28 struct GFXPreset
29 {
30  bool lights;
31  int shadows;
32  bool bloom;
33  bool lightshaft;
34  bool glow;
35  bool mlaa;
36  bool ssao;
37  bool light_scatter;
38  bool animatedCharacters;
39  int particles;
40  int image_quality;
41  bool degraded_ibl;
42 };
43 
44 struct BlurPreset
45 {
46  bool motionblur;
48  bool dof;
49 };
50 
51 struct Resolution
52 {
53  int width;
54  int height;
55  bool fullscreen;
56 
57  Resolution()
58  {
59  width = 0;
60  height = 0;
61  }
62 
63  Resolution(int w, int h)
64  {
65  width = w;
66  height = h;
67  }
68 
69  bool operator< (Resolution r) const
70  {
71  return width < r.width || (width == r.width && height < r.height);
72  }
73 
74  float getRatio() const
75  {
76  return (float) width / height;
77  }
78 };
79 
84 class OptionsScreenVideo : public GUIEngine::Screen, public GUIEngine::ScreenSingleton<OptionsScreenVideo>
85 {
86 private:
87  bool m_prev_adv_pipline;
88  int m_prev_img_quality;
90  bool m_inited;
91  std::vector<GFXPreset> m_presets;
92  std::vector<BlurPreset> m_blur_presets;
93  std::vector<Resolution> m_resolutions;
94 
95  void updateTooltip();
96  void updateBlurTooltip();
97  void updateResolutionsList();
98  void initPresets();
99  static void onScrollResolutionsList(void* data);
100 public:
102 
104  virtual void loadedFromFile() OVERRIDE;
105 
107  virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name,
108  const int playerID) OVERRIDE;
109 
111  virtual void init() OVERRIDE;
112 
114  virtual void tearDown() OVERRIDE;
115 
117  virtual void unloaded() OVERRIDE;
118 
119  void updateGfxSlider();
120  void updateBlurSlider();
121  static int getImageQuality();
122  static void setImageQuality(int quality);
123 };
124 
125 #endif
virtual void tearDown() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: options_screen_video.cpp:746
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:31
Definition: options_screen_video.hpp:28
virtual void eventCallback(GUIEngine::Widget *widget, const std::string &name, const int playerID) OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: options_screen_video.cpp:617
virtual void init() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: options_screen_video.cpp:193
Graphics options screen.
Definition: options_screen_video.hpp:84
Definition: options_screen_video.hpp:44
virtual void loadedFromFile() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: options_screen_video.cpp:172
Represents a single GUI screen.
Definition: screen.hpp:94
Declares a class to be a singleton.
Definition: screen.hpp:57
virtual void unloaded() OVERRIDE
implement optional callback from parent class GUIEngine::Screen
Definition: options_screen_video.cpp:766
The nearly-abstract base of all widgets (not fully abstract since a bare Widget can be created for th...
Definition: widget.hpp:138
bool dof
Depth of field.
Definition: options_screen_video.hpp:48
Definition: options_screen_video.hpp:51