xoreos  0.0.5
graphics.cpp
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos 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 xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
25 #include "src/common/configman.h"
26 
28 
32 
34 
35 namespace Engines {
36 
37 namespace KotOR {
38 
40  load("optgraphics");
41 
43 
46 
47  // Hardcoded, the gui file returns incorrect values
48  getCheckBox("CB_SHADOWS", true)->setColor(0.0f, 0.658824f, 0.980392f, 1.0f);
49  getCheckBox("CB_GRASS", true)->setColor(0.0f, 0.658824f, 0.980392f, 1.0f);
50 
51  readConfig();
52 }
53 
55 }
56 
58  readConfig();
59  displayConfig();
60 
61  GUI::show();
62 }
63 
65  if (widget.getTag() == "BTN_ADVANCED") {
66  adoptChanges();
67  sub(*_advanced);
68  return;
69  }
70 
71  if (widget.getTag() == "BTN_RESOLUTION") {
72  sub(*_resolution, kStartCodeNone, true, false);
73  return;
74  }
75 
76  if (widget.getTag() == "BTN_DEFAULT") {
77  setDefault();
78  displayConfig();
79  }
80 
81  if (widget.getTag() == "BTN_BACK") {
82  adoptChanges();
83  _returnCode = 1;
84  return;
85  }
86 
87  if (widget.getTag() == "CB_SHADOWS") {
88  _shadows = getCheckBoxState("CB_SHADOWS");
89  return;
90  }
91 
92  if (widget.getTag() == "CB_GRASS") {
93  _grass = getCheckBoxState("CB_GRASS");
94  return;
95  }
96 }
97 
99  _shadows = ConfigMan.getDefaultBool("shadows");
100  _grass = ConfigMan.getDefaultBool("grass");
101 }
102 
104  _shadows = ConfigMan.getBool("shadows");
105  _grass = ConfigMan.getBool("grass");
106 }
107 
109  setCheckBoxState("CB_SHADOWS", _shadows);
110  setCheckBoxState("CB_GRASS", _grass);
111 }
112 
114  ConfigMan.setBool("shadows", _shadows, true);
115  ConfigMan.setBool("grass", _grass, true);
116 }
117 
118 } // End of namespace KotOR
119 
120 } // End of namespace Engines
121 
void load(const Common::UString &resref)
Definition: gui.cpp:103
static const Common::UString & kBackgroundTypeMenu
Definition: guibackground.h:42
uint32 _returnCode
The GUI&#39;s return code.
Definition: gui.h:75
The global config manager.
A checkbox widget for Star Wars: Knights of the Old Repulic and Jade Empire.
Console * _console
Definition: gui.h:70
The graphics resolution menu.
Common::ScopedPtr< GUI > _resolution
Definition: graphics.h:50
bool getCheckBoxState(const Common::UString &tag)
Definition: gui.cpp:312
The advanced graphics menu.
#define ConfigMan
Shortcut for accessing the config manager.
Definition: configman.h:176
const Common::UString & getTag() const
Get the widget&#39;s tag.
Definition: widget.cpp:45
uint32 sub(GUI &gui, uint32 startCode=kStartCodeNone, bool showSelf=true, bool hideSelf=true)
Open up a sub GUI.
Definition: gui.cpp:349
void addBackground(const Common::UString &background, bool front=false)
Definition: gui.cpp:300
Common::ScopedPtr< GUI > _advanced
Definition: graphics.h:51
virtual void show()
Show the GUI.
Definition: gui.cpp:69
virtual void show()
Show the GUI.
Definition: graphics.cpp:57
A widget in a GUI.
A widget in a GUI.
Definition: widget.h:40
void setColor(float r, float g, float b, float a)
WidgetCheckBox * getCheckBox(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:240
static const uint32 kStartCodeNone
Definition: gui.h:45
A KotOR GUI.
Definition: gui.h:57
The graphics menu.
OptionsGraphicsMenu(::Engines::Console *console=0)
Definition: graphics.cpp:39
void setCheckBoxState(const Common::UString &tag, bool state)
Definition: gui.cpp:307
void callbackActive(Widget &widget)
Callback that&#39;s triggered when a widget was activated.
Definition: graphics.cpp:64