xoreos  0.0.5
chargenportrait.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 
27 
30 
31 namespace Engines {
32 
33 namespace KotOR {
34 
36  Console *console) : CharacterGenerationBaseMenu(info, console) {
37 
38  load("portcust");
39 
41 
42  getLabel("LBL_PORTRAIT")->setFill(_info.getPortrait());
43 }
44 
46  if (widget.getTag() == "BTN_BACK") {
47  _returnCode = 1;
48  return;
49  }
50  if (widget.getTag() == "BTN_ACCEPT") {
51  accept();
52  _returnCode = 1;
53  return;
54  }
55 
56  if (widget.getTag() == "BTN_ARRL") {
57  // Get the current skin and face
58  Skin skin = _info.getSkin();
59  uint8_t face = _info.getFace();
60 
61  // Move them to left and go in another skin type if needed
62  if (face == 0) {
63  if (skin == kSkinA)
64  skin = kSkinC;
65  else
66  skin = Skin(skin - 1);
67  face = 4;
68  } else {
69  face -= 1;
70  }
71 
72  // Set the new skin and face values
73  _info.setSkin(skin);
74  _info.setFace(face);
75 
76  // And then reset the portrait
77  getLabel("LBL_PORTRAIT")->setFill(_info.getPortrait());
78 
79  return;
80  }
81 
82  if (widget.getTag() == "BTN_ARRR") {
83  // Get the current skin and face
84  Skin skin = _info.getSkin();
85  uint8_t face = _info.getFace();
86 
87  // Move them to right and go in another skin type if needed
88  if (face == 4) {
89  if (skin == kSkinC)
90  skin = kSkinA;
91  else
92  skin = Skin(skin + 1);
93  face = 0;
94  } else {
95  face += 1;
96  }
97 
98  // Set the new skin and face values
99  _info.setSkin(skin);
100  _info.setFace(face);
101 
102  // And then reset the portrait
103  getLabel("LBL_PORTRAIT")->setFill(_info.getPortrait());
104 
105  return;
106  }
107 }
108 
109 } // End of namespace KotOR
110 
111 } // End of namespace Engines
void load(const Common::UString &resref)
Definition: gui.cpp:103
void setFill(const Common::UString &fill)
The menu for modifying the portrait of the.
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
CharacterGenerationPortraitMenu(CharacterGenerationInfo &chargen, ::Engines::Console *console=0)
A button widget for Star Wars: Knights of the Old Republic and Jade Empire.
void setFace(unsigned int face)
Set the face index of the character.
void setSkin(Skin skin)
Set the skin type of the Character.
unsigned int getFace() const
Get the current face index of the character.
const Common::UString & getTag() const
Get the widget&#39;s tag.
Definition: widget.cpp:45
void info(const char *s,...)
Definition: util.cpp:69
Skin getSkin() const
Get the skin type of the character.
void addBackground(const Common::UString &background, bool front=false)
Definition: gui.cpp:300
virtual void callbackActive(Widget &widget)
Callback that&#39;s triggered when a widget was activated.
WidgetLabel * getLabel(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:204
A widget in a GUI.
Definition: widget.h:40
The class for storing character information for generation.
static const Common::UString & kBackgroundTypeMenu
Definition: guibackground.h:42