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 #ifndef SERVER_ONLY // No GUI files in server builds
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  int geometry_detail;
43  bool pc_soft_shadows;
44  bool ssr;
45 };
46 
47 struct BlurPreset
48 {
49  bool motionblur;
51  bool dof;
52 };
53 
55 {
56  float value;
57 };
58 
63 class OptionsScreenVideo : public GUIEngine::Screen, public GUIEngine::ScreenSingleton<OptionsScreenVideo>
64 {
65 private:
66  bool m_prev_adv_pipline;
68  bool m_inited;
69  std::vector<GFXPreset> m_presets;
70  std::vector<BlurPreset> m_blur_presets;
71  std::vector<ScaleRttsCustomPreset> m_scale_rtts_custom_presets;
72 
73  void updateTooltip();
74  void updateBlurTooltip();
75  void initPresets();
76  static void onScrollResolutionsList(void* data);
77  /* Returns 1 or 2 if a restart will be done, 0 otherwise */
78  int applySettings();
79 public:
81 
83  virtual void loadedFromFile() OVERRIDE;
84 
86  virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name,
87  const int playerID) OVERRIDE;
88 
90  virtual void init() OVERRIDE;
91 
93  virtual void tearDown() OVERRIDE;
94 
96  virtual void unloaded() OVERRIDE;
97 
98  virtual bool onEscapePressed() OVERRIDE;
99 
100  virtual void onResize() OVERRIDE;
101 
102  void updateGfxSlider();
103  void updateBlurSlider();
104  void updateScaleRTTsSlider();
105  static int getImageQuality();
106  static void setImageQuality(int quality, bool force_reload_texture);
107  static void setSSR();
108 };
109 
110 #endif
111 #endif // ifndef SERVER_ONLY
Declares a class to be a singleton.
Definition: screen.hpp:59
Represents a single GUI screen.
Definition: screen.hpp:94
The nearly-abstract base of all widgets (not fully abstract since a bare Widget can be created for th...
Definition: widget.hpp:147
Graphics options screen.
Definition: options_screen_video.hpp:64
virtual void tearDown() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: options_screen_video.cpp:713
virtual void loadedFromFile() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: options_screen_video.cpp:232
virtual void unloaded() OVERRIDE
implement optional callback from parent class GUIEngine::Screen
Definition: options_screen_video.cpp:743
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:584
virtual bool onEscapePressed() OVERRIDE
Called when escape is pressed.
Definition: options_screen_video.cpp:735
virtual void onResize() OVERRIDE
optional callback you can override to be notified at every resize.
Definition: options_screen_video.cpp:353
virtual void init() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: options_screen_video.cpp:253
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:33
Definition: options_screen_video.hpp:48
bool dof
Depth of field.
Definition: options_screen_video.hpp:51
Definition: options_screen_video.hpp:29
Definition: options_screen_video.hpp:55