xoreos  0.0.5
charappearance.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 
26 
28 
31 
32 namespace Engines {
33 
34 namespace NWN {
35 
37  CharGenBase(console) {
38 
39  _choices = &choices;
40  load("cg_appearance");
41 
42  // TODO: Show character.
43  adjustButtons("ClothingButton");
44  adjustButtons("SkinButton");
45  adjustButtons("TattooButton");
46  adjustButtons("TattooColButton");
47  adjustButtons("HairButton");
48  adjustButtons("BodyButton");
49  adjustButtons("HeadButton");
50 }
51 
53 }
54 
56 }
57 
59  if (widget.getTag() == "OkButton") {
60  if (!_charInfo)
62 
63  if (sub(*_charInfo, 0, false) == 1) {
64  reset();
65  _returnCode = 1;
66  return;
67  }
68  _returnCode = 2;
69  return;
70  }
71 
72  if (widget.getTag() == "CancelButton") {
73  _returnCode = 1;
74  return;
75  }
76 }
77 
79  float wX, wY, wZ;
80  float cX, cY, cZ;
81  getWidget(tag, true)->getPosition(wX,wY,wZ);
82  getButton(tag, true)->getNode("text")->getPosition(cX,cY,cZ);
83  getWidget(tag, true)->setPosition(wX + cX, wY + cY - 7.f, wZ - cZ);
84 }
85 
86 } // End of namespace NWN
87 
88 } // End of namespace Engines
Widget * getWidget(const Common::UString &tag, bool vital=false)
Return a widget in the GUI.
Definition: gui.cpp:314
A NWN button widget.
uint32 _returnCode
The GUI&#39;s return code.
Definition: gui.h:75
A class holding an UTF-8 string.
Definition: ustring.h:48
Common::ScopedPtr< CharInfoVoice > _charInfo
void callbackActive(Widget &widget)
Callback that&#39;s triggered when a widget was activated.
void adjustButtons(const Common::UString &tag)
virtual void setPosition(float x, float y, float z)
Set the widget&#39;s position.
Definition: widget.cpp:119
Console * _console
Definition: gui.h:70
virtual void getPosition(float &x, float &y, float &z) const
Get the widget&#39;s position.
Definition: widget.cpp:140
void getPosition(float &x, float &y, float &z) const
Get the position of the node.
Definition: modelnode.cpp:181
CharAppearance(CharGenChoices &choices, ::Engines::Console *console=0)
WidgetButton * getButton(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:306
const Common::UString & getTag() const
Get the widget&#39;s tag.
Definition: widget.cpp:45
CharGenChoices * _choices
Definition: chargenbase.h:45
A node within a 3D model.
uint32 sub(GUI &gui, uint32 startCode=kStartCodeNone, bool showSelf=true, bool hideSelf=true)
Open up a sub GUI.
Definition: gui.cpp:349
void load(const Common::UString &resref)
Definition: gui.cpp:77
A widget in a GUI.
Definition: widget.h:40
Graphics::Aurora::ModelNode * getNode(const Common::UString &nodeName) const
Definition: modelwidget.cpp:92
The character appearance GUI in CharGen.
The character information GUI in CharGen.