Skip to content

Commit

Permalink
JADE: Add character generation selection menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Nostritius committed Jul 21, 2019
1 parent 9d8f7a0 commit 28ac221
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 0 deletions.
75 changes: 75 additions & 0 deletions src/engines/jade/gui/chargen/characterselection.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/* xoreos - A reimplementation of BioWare's Aurora engine
*
* xoreos is the legal property of its developers, whose names
* can be found in the AUTHORS file distributed with this source
* distribution.
*
* xoreos is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* xoreos is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with xoreos. If not, see <http://www.gnu.org/licenses/>.
*/

/** @file
* Character generation selection menu.
*/

#include "src/aurora/2dareg.h"

#include "src/engines/jade/gui/chargen/characterselection.h"

#include "src/engines/odyssey/widget.h"
#include "src/engines/odyssey/label.h"
#include "src/engines/odyssey/button.h"

namespace Engines {

namespace Jade {

CharacterSelection::CharacterSelection(CharacterGeneration &chargen, CharacterInfo &charInfo) :
CharacterGenerationBase(chargen, charInfo) {
load("char_select2");

_nameButton = getButton("bNameStr");

_defaultCharacters = CharacterInfo::getDefaultCharacterInfos();

_characterId = 0;
updateCharacterInfo();
}

void CharacterSelection::updateCharacterInfo() {
if (_nameButton)
_nameButton->setText(_defaultCharacters[_characterId].getName());
}

void CharacterSelection::initWidget(Widget &widget) {
if (widget.getTag() == "ButtonHelp")
widget.setInvisible(true);
}

void CharacterSelection::callbackActive(Widget &widget) {
if (widget.getTag() == "ButtonBack") {
_returnCode = 1;
return;
}

if (widget.getTag() == "ButtonAccept") {
_charInfo = _defaultCharacters[_characterId];
_chargen.showName();
_chargen.setCustom(false);
return;
}
}

} // End of namespace Jade

} // End of namespace Engines
59 changes: 59 additions & 0 deletions src/engines/jade/gui/chargen/characterselection.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/* xoreos - A reimplementation of BioWare's Aurora engine
*
* xoreos is the legal property of its developers, whose names
* can be found in the AUTHORS file distributed with this source
* distribution.
*
* xoreos is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* xoreos is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with xoreos. If not, see <http://www.gnu.org/licenses/>.
*/

/** @file
* Character generation selection menu.
*/

#ifndef ENGINES_JADE_GUI_CHARGEN_CHARACTERSELECTION_H
#define ENGINES_JADE_GUI_CHARGEN_CHARACTERSELECTION_H

#include "src/engines/jade/gui/gui.h"
#include "src/engines/jade/gui/chargen/characterinfo.h"
#include "src/engines/jade/gui/chargen/charactergeneration.h"
#include "src/engines/jade/gui/chargen/charactergenerationbase.h"

namespace Engines {

namespace Jade {

class CharacterSelection : public CharacterGenerationBase {
public:
CharacterSelection(CharacterGeneration &chargen, CharacterInfo &charInfo);

protected:
void callbackActive(Widget &widget) override;

void initWidget(Widget &widget) override;

private:
void updateCharacterInfo();

Odyssey::WidgetButton *_nameButton;

size_t _characterId;
std::vector<CharacterInfo> _defaultCharacters;
};

}

}

#endif // ENGINES_JADE_GUI_CHARGEN_CHARACTERSELECTION_H
2 changes: 2 additions & 0 deletions src/engines/jade/gui/chargen/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ src_engines_jade_libjade_la_SOURCES += \
src/engines/jade/gui/chargen/charactergenerationbase.h \
src/engines/jade/gui/chargen/characterinfo.h \
src/engines/jade/gui/chargen/charactername.h \
src/engines/jade/gui/chargen/characterselection.h \
$(EMPTY)

src_engines_jade_libjade_la_SOURCES += \
src/engines/jade/gui/chargen/charactergenerationbase.cpp \
src/engines/jade/gui/chargen/characterinfo.cpp \
src/engines/jade/gui/chargen/charactername.cpp \
src/engines/jade/gui/chargen/characterselection.cpp \
$(EMPTY)

0 comments on commit 28ac221

Please sign in to comment.