xoreos  0.0.5
options.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/version/version.h"
26 
28 
30 
37 
40 
41 namespace Engines {
42 
43 namespace KotOR {
44 
45 OptionsMenu::OptionsMenu(const Version &gameVersion, ::Engines::Console *console) : GUI(console) {
46  load("optionsmain");
47 
49 
54  _sound.reset(new OptionsSoundMenu(_console));
55 
57 
58  if (gameVersion.hasVersion())
59  versionString += " v" + gameVersion.getVersionString();
60 
61  WidgetLabel *lblVersion = new WidgetLabel(*this, "Version");
62  addWidget(lblVersion);
63 
64  lblVersion->createText("fnt_console", versionString);
65 
66  const float x = (800.0f / 2.0f) - lblVersion->getWidth();
67  const float y = -(600.0f / 2.0f);
68 
69  lblVersion->setPosition(x, y, -50.0f);
70  lblVersion->setTextColor(0.6f, 0.6f, 0.6f, 1.0f);
71 }
72 
74 }
75 
77  if (widget.getTag() == "BTN_GAMEPLAY") {
78  sub(*_gameplay);
79  return;
80  }
81 
82  if (widget.getTag() == "BTN_FEEDBACK") {
83  sub(*_feedback);
84  return;
85  }
86 
87  if (widget.getTag() == "BTN_AUTOPAUSE") {
88  sub(*_autopause);
89  return;
90  }
91 
92  if (widget.getTag() == "BTN_GRAPHICS") {
93  sub(*_graphics);
94  return;
95  }
96 
97  if (widget.getTag() == "BTN_SOUND") {
98  sub(*_sound);
99  return;
100  }
101 
102  if (widget.getTag() == "BTN_BACK") {
103  _returnCode = 1;
104  return;
105  }
106 }
107 
108 } // End of namespace KotOR
109 
110 } // End of namespace Engines
void load(const Common::UString &resref)
Definition: gui.cpp:103
The options menu.
static const Common::UString & kBackgroundTypeMenu
Definition: guibackground.h:42
A label widget for Star Wars: Knights of the Old Republic and Jade Empire.
uint32 _returnCode
The GUI&#39;s return code.
Definition: gui.h:75
A class holding an UTF-8 string.
Definition: ustring.h:48
void setTextColor(float r, float g, float b, float a)
void createText(const Common::UString &font, const Common::UString &str)
Initialize the text within this widget.
A button widget for Star Wars: Knights of the Old Republic and Jade Empire.
Console * _console
Definition: gui.h:70
void callbackActive(Widget &widget)
Callback that&#39;s triggered when a widget was activated.
Definition: options.cpp:76
The feedback menu.
Common::ScopedPtr< GUI > _gameplay
Definition: options.h:51
The sound menu.
The auto pause menu.
bool hasVersion() const
Did we detect a version?
Definition: version.cpp:55
Basic xoreos version information.
const Common::UString & getTag() const
Get the widget&#39;s tag.
Definition: widget.cpp:45
const char * getProjectNameVersion()
Definition: version.cpp:92
uint32 sub(GUI &gui, uint32 startCode=kStartCodeNone, bool showSelf=true, bool hideSelf=true)
Open up a sub GUI.
Definition: gui.cpp:349
Star Wars: Knights of the Old Republic installation version detection.
Common::ScopedPtr< GUI > _feedback
Definition: options.h:52
void addBackground(const Common::UString &background, bool front=false)
Definition: gui.cpp:300
A widget in a GUI.
A widget in a GUI.
Definition: widget.h:40
The gameplay menu.
OptionsMenu(const Version &gameVersion, ::Engines::Console *console=0)
Definition: options.cpp:45
Common::ScopedPtr< GUI > _sound
Definition: options.h:55
Common::UString getVersionString() const
Definition: version.cpp:79
Common::ScopedPtr< GUI > _autopause
Definition: options.h:53
A KotOR GUI.
Definition: gui.h:57
void addWidget(Widget *widget)
Add a widget.
Definition: gui.cpp:250
The graphics menu.
float getWidth() const
Get the widget&#39;s width.
Common::ScopedPtr< GUI > _graphics
Definition: options.h:54
virtual void setPosition(float x, float y, float z)
Set the widget&#39;s position.