mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-27 03:40:24 +00:00
Convert tabs to spaces.
This commit is contained in:
parent
7c17e27be4
commit
415426c30b
6 changed files with 238 additions and 238 deletions
|
@ -21,47 +21,47 @@ RaceDialog::RaceDialog(MWWorld::Environment& environment, bool showNext)
|
||||||
, faceCount(10)
|
, faceCount(10)
|
||||||
, hairCount(14)
|
, hairCount(14)
|
||||||
{
|
{
|
||||||
mMainWidget->setCoord(mMainWidget->getCoord() + MyGUI::IntPoint(0, 100));
|
mMainWidget->setCoord(mMainWidget->getCoord() + MyGUI::IntPoint(0, 100));
|
||||||
|
|
||||||
// These are just demo values, you should replace these with
|
// These are just demo values, you should replace these with
|
||||||
// real calls from outside the class later.
|
// real calls from outside the class later.
|
||||||
|
|
||||||
setText("AppearanceT", "Appearance");
|
setText("AppearanceT", "Appearance");
|
||||||
getWidget(appearanceBox, "AppearanceBox");
|
getWidget(appearanceBox, "AppearanceBox");
|
||||||
|
|
||||||
getWidget(headRotate, "HeadRotate");
|
getWidget(headRotate, "HeadRotate");
|
||||||
headRotate->setScrollRange(50);
|
headRotate->setScrollRange(50);
|
||||||
headRotate->setScrollPosition(20);
|
headRotate->setScrollPosition(20);
|
||||||
headRotate->setScrollViewPage(10);
|
headRotate->setScrollViewPage(10);
|
||||||
headRotate->eventScrollChangePosition = MyGUI::newDelegate(this, &RaceDialog::onHeadRotate);
|
headRotate->eventScrollChangePosition = MyGUI::newDelegate(this, &RaceDialog::onHeadRotate);
|
||||||
|
|
||||||
// Set up next/previous buttons
|
// Set up next/previous buttons
|
||||||
MyGUI::ButtonPtr prevButton, nextButton;
|
MyGUI::ButtonPtr prevButton, nextButton;
|
||||||
|
|
||||||
getWidget(prevButton, "PrevGenderButton");
|
getWidget(prevButton, "PrevGenderButton");
|
||||||
getWidget(nextButton, "NextGenderButton");
|
getWidget(nextButton, "NextGenderButton");
|
||||||
prevButton->eventMouseButtonClick = MyGUI::newDelegate(this, &RaceDialog::onSelectPreviousGender);
|
prevButton->eventMouseButtonClick = MyGUI::newDelegate(this, &RaceDialog::onSelectPreviousGender);
|
||||||
nextButton->eventMouseButtonClick = MyGUI::newDelegate(this, &RaceDialog::onSelectNextGender);
|
nextButton->eventMouseButtonClick = MyGUI::newDelegate(this, &RaceDialog::onSelectNextGender);
|
||||||
|
|
||||||
getWidget(prevButton, "PrevFaceButton");
|
getWidget(prevButton, "PrevFaceButton");
|
||||||
getWidget(nextButton, "NextFaceButton");
|
getWidget(nextButton, "NextFaceButton");
|
||||||
prevButton->eventMouseButtonClick = MyGUI::newDelegate(this, &RaceDialog::onSelectPreviousFace);
|
prevButton->eventMouseButtonClick = MyGUI::newDelegate(this, &RaceDialog::onSelectPreviousFace);
|
||||||
nextButton->eventMouseButtonClick = MyGUI::newDelegate(this, &RaceDialog::onSelectNextFace);
|
nextButton->eventMouseButtonClick = MyGUI::newDelegate(this, &RaceDialog::onSelectNextFace);
|
||||||
|
|
||||||
getWidget(prevButton, "PrevHairButton");
|
getWidget(prevButton, "PrevHairButton");
|
||||||
getWidget(nextButton, "NextHairButton");
|
getWidget(nextButton, "NextHairButton");
|
||||||
prevButton->eventMouseButtonClick = MyGUI::newDelegate(this, &RaceDialog::onSelectPreviousHair);
|
prevButton->eventMouseButtonClick = MyGUI::newDelegate(this, &RaceDialog::onSelectPreviousHair);
|
||||||
nextButton->eventMouseButtonClick = MyGUI::newDelegate(this, &RaceDialog::onSelectNextHair);
|
nextButton->eventMouseButtonClick = MyGUI::newDelegate(this, &RaceDialog::onSelectNextHair);
|
||||||
|
|
||||||
setText("RaceT", "Race");
|
setText("RaceT", "Race");
|
||||||
getWidget(raceList, "RaceList");
|
getWidget(raceList, "RaceList");
|
||||||
raceList->setScrollVisible(true);
|
raceList->setScrollVisible(true);
|
||||||
raceList->eventListSelectAccept = MyGUI::newDelegate(this, &RaceDialog::onSelectRace);
|
raceList->eventListSelectAccept = MyGUI::newDelegate(this, &RaceDialog::onSelectRace);
|
||||||
raceList->eventListMouseItemActivate = MyGUI::newDelegate(this, &RaceDialog::onSelectRace);
|
raceList->eventListMouseItemActivate = MyGUI::newDelegate(this, &RaceDialog::onSelectRace);
|
||||||
raceList->eventListChangePosition = MyGUI::newDelegate(this, &RaceDialog::onSelectRace);
|
raceList->eventListChangePosition = MyGUI::newDelegate(this, &RaceDialog::onSelectRace);
|
||||||
|
|
||||||
getWidget(skillList, "SkillList");
|
getWidget(skillList, "SkillList");
|
||||||
getWidget(spellPowerList, "SpellPowerList");
|
getWidget(spellPowerList, "SpellPowerList");
|
||||||
|
|
||||||
// TODO: These buttons should be managed by a Dialog class
|
// TODO: These buttons should be managed by a Dialog class
|
||||||
MyGUI::ButtonPtr backButton;
|
MyGUI::ButtonPtr backButton;
|
||||||
|
@ -76,13 +76,13 @@ RaceDialog::RaceDialog(MWWorld::Environment& environment, bool showNext)
|
||||||
okButton->setCaption("Next");
|
okButton->setCaption("Next");
|
||||||
|
|
||||||
// Adjust back button when next is shown
|
// Adjust back button when next is shown
|
||||||
backButton->setCoord(backButton->getCoord() + MyGUI::IntPoint(14, 0));
|
backButton->setCoord(backButton->getCoord() - MyGUI::IntPoint(18, 0));
|
||||||
okButton->setCoord(okButton->getCoord() + MyGUI::IntSize(14, 0));
|
okButton->setCoord(okButton->getCoord() + MyGUI::IntCoord(-18, 0, 18, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
updateRaces();
|
updateRaces();
|
||||||
updateSkills();
|
updateSkills();
|
||||||
updateSpellPowers();
|
updateSpellPowers();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RaceDialog::setRace(const std::string &race)
|
void RaceDialog::setRace(const std::string &race)
|
||||||
|
@ -99,18 +99,18 @@ void RaceDialog::setRace(const std::string &race)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSkills();
|
updateSkills();
|
||||||
updateSpellPowers();
|
updateSpellPowers();
|
||||||
}
|
}
|
||||||
|
|
||||||
int wrap(int index, int max)
|
int wrap(int index, int max)
|
||||||
{
|
{
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
return max - 1;
|
return max - 1;
|
||||||
else if (index >= max)
|
else if (index >= max)
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
// widget controls
|
// widget controls
|
||||||
|
@ -127,37 +127,37 @@ void RaceDialog::onBackClicked(MyGUI::Widget* _sender)
|
||||||
|
|
||||||
void RaceDialog::onHeadRotate(MyGUI::VScroll*, size_t _position)
|
void RaceDialog::onHeadRotate(MyGUI::VScroll*, size_t _position)
|
||||||
{
|
{
|
||||||
// TODO: Rotate head
|
// TODO: Rotate head
|
||||||
}
|
}
|
||||||
|
|
||||||
void RaceDialog::onSelectPreviousGender(MyGUI::Widget*)
|
void RaceDialog::onSelectPreviousGender(MyGUI::Widget*)
|
||||||
{
|
{
|
||||||
genderIndex = wrap(genderIndex - 1, 2);
|
genderIndex = wrap(genderIndex - 1, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RaceDialog::onSelectNextGender(MyGUI::Widget*)
|
void RaceDialog::onSelectNextGender(MyGUI::Widget*)
|
||||||
{
|
{
|
||||||
genderIndex = wrap(genderIndex + 1, 2);
|
genderIndex = wrap(genderIndex + 1, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RaceDialog::onSelectPreviousFace(MyGUI::Widget*)
|
void RaceDialog::onSelectPreviousFace(MyGUI::Widget*)
|
||||||
{
|
{
|
||||||
faceIndex = wrap(faceIndex - 1, faceCount);
|
faceIndex = wrap(faceIndex - 1, faceCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RaceDialog::onSelectNextFace(MyGUI::Widget*)
|
void RaceDialog::onSelectNextFace(MyGUI::Widget*)
|
||||||
{
|
{
|
||||||
faceIndex = wrap(faceIndex + 1, faceCount);
|
faceIndex = wrap(faceIndex + 1, faceCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RaceDialog::onSelectPreviousHair(MyGUI::Widget*)
|
void RaceDialog::onSelectPreviousHair(MyGUI::Widget*)
|
||||||
{
|
{
|
||||||
hairIndex = wrap(hairIndex - 1, hairCount);
|
hairIndex = wrap(hairIndex - 1, hairCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RaceDialog::onSelectNextHair(MyGUI::Widget*)
|
void RaceDialog::onSelectNextHair(MyGUI::Widget*)
|
||||||
{
|
{
|
||||||
hairIndex = wrap(hairIndex - 1, hairCount);
|
hairIndex = wrap(hairIndex - 1, hairCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RaceDialog::onSelectRace(MyGUI::List* _sender, size_t _index)
|
void RaceDialog::onSelectRace(MyGUI::List* _sender, size_t _index)
|
||||||
|
@ -171,55 +171,55 @@ void RaceDialog::onSelectRace(MyGUI::List* _sender, size_t _index)
|
||||||
|
|
||||||
currentRace = race;
|
currentRace = race;
|
||||||
updateSkills();
|
updateSkills();
|
||||||
updateSpellPowers();
|
updateSpellPowers();
|
||||||
}
|
}
|
||||||
|
|
||||||
// update widget content
|
// update widget content
|
||||||
|
|
||||||
void RaceDialog::updateRaces()
|
void RaceDialog::updateRaces()
|
||||||
{
|
{
|
||||||
raceList->removeAllItems();
|
raceList->removeAllItems();
|
||||||
|
|
||||||
ESMS::ESMStore &store = environment.mWorld->getStore();
|
ESMS::ESMStore &store = environment.mWorld->getStore();
|
||||||
|
|
||||||
ESMS::RecListT<ESM::Race>::MapType::const_iterator it = store.races.list.begin();
|
ESMS::RecListT<ESM::Race>::MapType::const_iterator it = store.races.list.begin();
|
||||||
ESMS::RecListT<ESM::Race>::MapType::const_iterator end = store.races.list.end();
|
ESMS::RecListT<ESM::Race>::MapType::const_iterator end = store.races.list.end();
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (; it != end; ++it)
|
for (; it != end; ++it)
|
||||||
{
|
{
|
||||||
const ESM::Race &race = it->second;
|
const ESM::Race &race = it->second;
|
||||||
bool playable = race.data.flags & ESM::Race::Playable;
|
bool playable = race.data.flags & ESM::Race::Playable;
|
||||||
if (!playable) // Only display playable races
|
if (!playable) // Only display playable races
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
raceList->addItem(race.name);
|
raceList->addItem(race.name);
|
||||||
if (boost::iequals(race.name, currentRace))
|
if (boost::iequals(race.name, currentRace))
|
||||||
raceList->setIndexSelected(index);
|
raceList->setIndexSelected(index);
|
||||||
++index;
|
++index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RaceDialog::updateSkills()
|
void RaceDialog::updateSkills()
|
||||||
{
|
{
|
||||||
for (std::vector<MyGUI::WidgetPtr>::iterator it = skillItems.begin(); it != skillItems.end(); ++it)
|
for (std::vector<MyGUI::WidgetPtr>::iterator it = skillItems.begin(); it != skillItems.end(); ++it)
|
||||||
{
|
{
|
||||||
MyGUI::Gui::getInstance().destroyWidget(*it);
|
MyGUI::Gui::getInstance().destroyWidget(*it);
|
||||||
}
|
}
|
||||||
skillItems.clear();
|
skillItems.clear();
|
||||||
|
|
||||||
if (currentRace.empty())
|
if (currentRace.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MyGUI::StaticTextPtr skillNameWidget, skillBonusWidget;
|
MyGUI::StaticTextPtr skillNameWidget, skillBonusWidget;
|
||||||
const int lineHeight = 18;
|
const int lineHeight = 18;
|
||||||
MyGUI::IntCoord coord1(0, 0, skillList->getWidth() - (40 + 4), 18);
|
MyGUI::IntCoord coord1(0, 0, skillList->getWidth() - (40 + 4), 18);
|
||||||
MyGUI::IntCoord coord2(coord1.left + coord1.width, 0, 40, 18);
|
MyGUI::IntCoord coord2(coord1.left + coord1.width, 0, 40, 18);
|
||||||
|
|
||||||
ESMS::ESMStore &store = environment.mWorld->getStore();
|
ESMS::ESMStore &store = environment.mWorld->getStore();
|
||||||
const ESM::Race *race = store.races.find(currentRace);
|
const ESM::Race *race = store.races.find(currentRace);
|
||||||
int count = sizeof(race->data.bonus)/sizeof(race->data.bonus[0]); // TODO: Find a portable macro for this ARRAYSIZE?
|
int count = sizeof(race->data.bonus)/sizeof(race->data.bonus[0]); // TODO: Find a portable macro for this ARRAYSIZE?
|
||||||
for (int i = 0; i < count; ++i)
|
for (int i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
int skillId = race->data.bonus[i].skill;
|
int skillId = race->data.bonus[i].skill;
|
||||||
if (skillId < 0 || skillId > ESM::Skill::Length) // Skip unknown skill indexes
|
if (skillId < 0 || skillId > ESM::Skill::Length) // Skip unknown skill indexes
|
||||||
continue;
|
continue;
|
||||||
|
@ -227,52 +227,52 @@ void RaceDialog::updateSkills()
|
||||||
skillNameWidget = skillList->createWidget<MyGUI::StaticText>("SandText", coord1, MyGUI::Align::Default,
|
skillNameWidget = skillList->createWidget<MyGUI::StaticText>("SandText", coord1, MyGUI::Align::Default,
|
||||||
std::string("SkillName") + boost::lexical_cast<std::string>(i));
|
std::string("SkillName") + boost::lexical_cast<std::string>(i));
|
||||||
assert(skillId >= 0 && skillId < ESM::Skill::Length);
|
assert(skillId >= 0 && skillId < ESM::Skill::Length);
|
||||||
skillNameWidget->setCaption(ESMS::Skill::sSkillNames[skillId]);
|
skillNameWidget->setCaption(ESMS::Skill::sSkillNames[skillId]);
|
||||||
|
|
||||||
skillBonusWidget = skillList->createWidget<MyGUI::StaticText>("SandTextRight", coord2, MyGUI::Align::Default,
|
skillBonusWidget = skillList->createWidget<MyGUI::StaticText>("SandTextRight", coord2, MyGUI::Align::Default,
|
||||||
std::string("SkillBonus") + boost::lexical_cast<std::string>(i));
|
std::string("SkillBonus") + boost::lexical_cast<std::string>(i));
|
||||||
int bonus = race->data.bonus[i].bonus;
|
int bonus = race->data.bonus[i].bonus;
|
||||||
skillBonusWidget->setCaption(boost::lexical_cast<std::string>(bonus));
|
skillBonusWidget->setCaption(boost::lexical_cast<std::string>(bonus));
|
||||||
|
|
||||||
skillItems.push_back(skillNameWidget);
|
skillItems.push_back(skillNameWidget);
|
||||||
skillItems.push_back(skillBonusWidget);
|
skillItems.push_back(skillBonusWidget);
|
||||||
|
|
||||||
coord1.top += lineHeight;
|
coord1.top += lineHeight;
|
||||||
coord2.top += lineHeight;
|
coord2.top += lineHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RaceDialog::updateSpellPowers()
|
void RaceDialog::updateSpellPowers()
|
||||||
{
|
{
|
||||||
for (std::vector<MyGUI::WidgetPtr>::iterator it = spellPowerItems.begin(); it != spellPowerItems.end(); ++it)
|
for (std::vector<MyGUI::WidgetPtr>::iterator it = spellPowerItems.begin(); it != spellPowerItems.end(); ++it)
|
||||||
{
|
{
|
||||||
MyGUI::Gui::getInstance().destroyWidget(*it);
|
MyGUI::Gui::getInstance().destroyWidget(*it);
|
||||||
}
|
}
|
||||||
spellPowerItems.clear();
|
spellPowerItems.clear();
|
||||||
|
|
||||||
if (currentRace.empty())
|
if (currentRace.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MyGUI::StaticTextPtr spellPowerWidget;
|
MyGUI::StaticTextPtr spellPowerWidget;
|
||||||
const int lineHeight = 18;
|
const int lineHeight = 18;
|
||||||
MyGUI::IntCoord coord(0, 0, spellPowerList->getWidth(), 18);
|
MyGUI::IntCoord coord(0, 0, spellPowerList->getWidth(), 18);
|
||||||
|
|
||||||
ESMS::ESMStore &store = environment.mWorld->getStore();
|
ESMS::ESMStore &store = environment.mWorld->getStore();
|
||||||
const ESM::Race *race = store.races.find(currentRace);
|
const ESM::Race *race = store.races.find(currentRace);
|
||||||
|
|
||||||
std::vector<std::string>::const_iterator it = race->powers.list.begin();
|
std::vector<std::string>::const_iterator it = race->powers.list.begin();
|
||||||
std::vector<std::string>::const_iterator end = race->powers.list.end();
|
std::vector<std::string>::const_iterator end = race->powers.list.end();
|
||||||
for (int i = 0; it != end; ++it)
|
for (int i = 0; it != end; ++it)
|
||||||
{
|
{
|
||||||
const std::string &spellpower = *it;
|
const std::string &spellpower = *it;
|
||||||
const ESM::Spell *spell = store.spells.find(spellpower);
|
const ESM::Spell *spell = store.spells.find(spellpower);
|
||||||
assert(spell);
|
assert(spell);
|
||||||
spellPowerWidget = spellPowerList->createWidget<MyGUI::StaticText>("SandText", coord, MyGUI::Align::Default, std::string("SpellPowerName") + boost::lexical_cast<std::string>(i));
|
spellPowerWidget = spellPowerList->createWidget<MyGUI::StaticText>("SandText", coord, MyGUI::Align::Default, std::string("SpellPowerName") + boost::lexical_cast<std::string>(i));
|
||||||
spellPowerWidget->setCaption(spell->name);
|
spellPowerWidget->setCaption(spell->name);
|
||||||
|
|
||||||
spellPowerItems.push_back(spellPowerWidget);
|
spellPowerItems.push_back(spellPowerWidget);
|
||||||
|
|
||||||
coord.top += lineHeight;
|
coord.top += lineHeight;
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,13 +27,13 @@ namespace MWWorld
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
using namespace MyGUI;
|
using namespace MyGUI;
|
||||||
|
|
||||||
typedef delegates::CDelegate0 EventHandle_Void;
|
typedef delegates::CDelegate0 EventHandle_Void;
|
||||||
|
|
||||||
class RaceDialog : public OEngine::GUI::Layout
|
class RaceDialog : public OEngine::GUI::Layout
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RaceDialog(MWWorld::Environment& environment, bool showNext);
|
RaceDialog(MWWorld::Environment& environment, bool showNext);
|
||||||
|
|
||||||
enum Gender
|
enum Gender
|
||||||
|
@ -55,53 +55,53 @@ namespace MWGui
|
||||||
// Events
|
// Events
|
||||||
|
|
||||||
/** Event : Back button clicked.\n
|
/** Event : Back button clicked.\n
|
||||||
signature : void method()\n
|
signature : void method()\n
|
||||||
*/
|
*/
|
||||||
EventHandle_Void eventBack;
|
EventHandle_Void eventBack;
|
||||||
|
|
||||||
/** Event : Dialog finished, OK button clicked.\n
|
/** Event : Dialog finished, OK button clicked.\n
|
||||||
signature : void method()\n
|
signature : void method()\n
|
||||||
*/
|
*/
|
||||||
EventHandle_Void eventDone;
|
EventHandle_Void eventDone;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onHeadRotate(MyGUI::VScroll* _sender, size_t _position);
|
void onHeadRotate(MyGUI::VScroll* _sender, size_t _position);
|
||||||
|
|
||||||
void onSelectPreviousGender(MyGUI::Widget* _sender);
|
void onSelectPreviousGender(MyGUI::Widget* _sender);
|
||||||
void onSelectNextGender(MyGUI::Widget* _sender);
|
void onSelectNextGender(MyGUI::Widget* _sender);
|
||||||
|
|
||||||
void onSelectPreviousFace(MyGUI::Widget* _sender);
|
void onSelectPreviousFace(MyGUI::Widget* _sender);
|
||||||
void onSelectNextFace(MyGUI::Widget* _sender);
|
void onSelectNextFace(MyGUI::Widget* _sender);
|
||||||
|
|
||||||
void onSelectPreviousHair(MyGUI::Widget* _sender);
|
void onSelectPreviousHair(MyGUI::Widget* _sender);
|
||||||
void onSelectNextHair(MyGUI::Widget* _sender);
|
void onSelectNextHair(MyGUI::Widget* _sender);
|
||||||
|
|
||||||
void onSelectRace(MyGUI::List* _sender, size_t _index);
|
void onSelectRace(MyGUI::List* _sender, size_t _index);
|
||||||
|
|
||||||
void onOkClicked(MyGUI::Widget* _sender);
|
void onOkClicked(MyGUI::Widget* _sender);
|
||||||
void onBackClicked(MyGUI::Widget* _sender);
|
void onBackClicked(MyGUI::Widget* _sender);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateRaces();
|
void updateRaces();
|
||||||
void updateSkills();
|
void updateSkills();
|
||||||
void updateSpellPowers();
|
void updateSpellPowers();
|
||||||
|
|
||||||
MWWorld::Environment& environment;
|
MWWorld::Environment& environment;
|
||||||
|
|
||||||
MyGUI::CanvasPtr appearanceBox;
|
MyGUI::CanvasPtr appearanceBox;
|
||||||
MyGUI::ListPtr raceList;
|
MyGUI::ListPtr raceList;
|
||||||
MyGUI::HScrollPtr headRotate;
|
MyGUI::HScrollPtr headRotate;
|
||||||
|
|
||||||
MyGUI::WidgetPtr skillList;
|
MyGUI::WidgetPtr skillList;
|
||||||
std::vector<MyGUI::WidgetPtr> skillItems;
|
std::vector<MyGUI::WidgetPtr> skillItems;
|
||||||
|
|
||||||
MyGUI::WidgetPtr spellPowerList;
|
MyGUI::WidgetPtr spellPowerList;
|
||||||
std::vector<MyGUI::WidgetPtr> spellPowerItems;
|
std::vector<MyGUI::WidgetPtr> spellPowerItems;
|
||||||
|
|
||||||
int genderIndex, faceIndex, hairIndex;
|
int genderIndex, faceIndex, hairIndex;
|
||||||
int faceCount, hairCount;
|
int faceCount, hairCount;
|
||||||
|
|
||||||
std::string currentRace;
|
std::string currentRace;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -274,120 +274,120 @@ namespace MWGui
|
||||||
class InventoryWindow : public OEngine::GUI::Layout
|
class InventoryWindow : public OEngine::GUI::Layout
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum CategoryMode
|
enum CategoryMode
|
||||||
{
|
{
|
||||||
CM_All = 0, // All items
|
CM_All = 0, // All items
|
||||||
CM_Weapon = 1, // Only weapons
|
CM_Weapon = 1, // Only weapons
|
||||||
CM_Apparel = 2, // Apparel
|
CM_Apparel = 2, // Apparel
|
||||||
CM_Magic = 3, // Magic
|
CM_Magic = 3, // Magic
|
||||||
CM_Misc = 4 // Misc
|
CM_Misc = 4 // Misc
|
||||||
};
|
};
|
||||||
|
|
||||||
InventoryWindow ()
|
InventoryWindow ()
|
||||||
: Layout("openmw_inventory_window_layout.xml")
|
: Layout("openmw_inventory_window_layout.xml")
|
||||||
, categoryMode(CM_All)
|
, categoryMode(CM_All)
|
||||||
|
|
||||||
// color should be fetched from skin
|
// color should be fetched from skin
|
||||||
, activeColor(0, 0, 1)
|
, activeColor(0, 0, 1)
|
||||||
, inactiveColor(0.7, 0.7, 0.7)
|
, inactiveColor(0.7, 0.7, 0.7)
|
||||||
{
|
{
|
||||||
setCoord(0, 200, 600, 400);
|
setCoord(0, 200, 600, 400);
|
||||||
|
|
||||||
// These are just demo values, you should replace these with
|
// These are just demo values, you should replace these with
|
||||||
// real calls from outside the class later.
|
// real calls from outside the class later.
|
||||||
|
|
||||||
mMainWidget->setCaption("Glass Frostsword");
|
mMainWidget->setCaption("Glass Frostsword");
|
||||||
setText("EncumbranceBarT", "176/210");
|
setText("EncumbranceBarT", "176/210");
|
||||||
|
|
||||||
MyGUI::ProgressPtr pt;
|
MyGUI::ProgressPtr pt;
|
||||||
getWidget(pt, "EncumbranceBar");
|
getWidget(pt, "EncumbranceBar");
|
||||||
pt->setProgressRange(210);
|
pt->setProgressRange(210);
|
||||||
pt->setProgressPosition(176);
|
pt->setProgressPosition(176);
|
||||||
|
|
||||||
MyGUI::WidgetPtr avatar;
|
MyGUI::WidgetPtr avatar;
|
||||||
getWidget(avatar, "Avatar");
|
getWidget(avatar, "Avatar");
|
||||||
|
|
||||||
// Adjust armor rating text to bottom of avatar widget
|
// Adjust armor rating text to bottom of avatar widget
|
||||||
MyGUI::StaticTextPtr armor_rating;
|
MyGUI::StaticTextPtr armor_rating;
|
||||||
getWidget(armor_rating, "ArmorRating");
|
getWidget(armor_rating, "ArmorRating");
|
||||||
armor_rating->setCaption("Armor: 11");
|
armor_rating->setCaption("Armor: 11");
|
||||||
MyGUI::IntCoord coord = armor_rating->getCoord();
|
MyGUI::IntCoord coord = armor_rating->getCoord();
|
||||||
coord.top = avatar->getCoord().height - 4 - coord.height;
|
coord.top = avatar->getCoord().height - 4 - coord.height;
|
||||||
armor_rating->setCoord(coord);
|
armor_rating->setCoord(coord);
|
||||||
|
|
||||||
names[0] = "All";
|
names[0] = "All";
|
||||||
names[1] = "Weapon";
|
names[1] = "Weapon";
|
||||||
names[2] = "Apparel";
|
names[2] = "Apparel";
|
||||||
names[3] = "Magic";
|
names[3] = "Magic";
|
||||||
names[4] = "Misc";
|
names[4] = "Misc";
|
||||||
|
|
||||||
boost::array<CategoryMode, 5> categories = { {
|
boost::array<CategoryMode, 5> categories = { {
|
||||||
CM_All, CM_Weapon, CM_Apparel, CM_Magic, CM_Misc
|
CM_All, CM_Weapon, CM_Apparel, CM_Magic, CM_Misc
|
||||||
} };
|
} };
|
||||||
|
|
||||||
// Initialize buttons with text and adjust sizes, also mark All as active button
|
// Initialize buttons with text and adjust sizes, also mark All as active button
|
||||||
int margin = 2;
|
int margin = 2;
|
||||||
int last_x = 0;
|
int last_x = 0;
|
||||||
for (int i = 0; i < categories.size(); ++i)
|
for (int i = 0; i < categories.size(); ++i)
|
||||||
{
|
{
|
||||||
CategoryMode mode = categories[i];
|
CategoryMode mode = categories[i];
|
||||||
std::string name = names[mode];
|
std::string name = names[mode];
|
||||||
name += "Button";
|
name += "Button";
|
||||||
setText(name, names[mode]);
|
setText(name, names[mode]);
|
||||||
getWidget(buttons[mode], name);
|
getWidget(buttons[mode], name);
|
||||||
|
|
||||||
MyGUI::ButtonPtr &button_pt = buttons[mode];
|
MyGUI::ButtonPtr &button_pt = buttons[mode];
|
||||||
if (mode == CM_All)
|
if (mode == CM_All)
|
||||||
button_pt->setTextColour(activeColor);
|
button_pt->setTextColour(activeColor);
|
||||||
else
|
else
|
||||||
button_pt->setTextColour(inactiveColor);
|
button_pt->setTextColour(inactiveColor);
|
||||||
MyGUI::IntCoord coord = button_pt->getCoord();
|
MyGUI::IntCoord coord = button_pt->getCoord();
|
||||||
coord.left = last_x;
|
coord.left = last_x;
|
||||||
last_x += coord.width + margin;
|
last_x += coord.width + margin;
|
||||||
button_pt->setCoord(coord);
|
button_pt->setCoord(coord);
|
||||||
|
|
||||||
button_pt->eventMouseButtonClick = MyGUI::newDelegate(this, &InventoryWindow::onCategorySelected);
|
button_pt->eventMouseButtonClick = MyGUI::newDelegate(this, &InventoryWindow::onCategorySelected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setCategory(CategoryMode mode)
|
void setCategory(CategoryMode mode)
|
||||||
{
|
{
|
||||||
MyGUI::ButtonPtr pt = getCategoryButton(categoryMode);
|
MyGUI::ButtonPtr pt = getCategoryButton(categoryMode);
|
||||||
pt->setTextColour(inactiveColor);
|
pt->setTextColour(inactiveColor);
|
||||||
|
|
||||||
pt = getCategoryButton(mode);
|
pt = getCategoryButton(mode);
|
||||||
pt->setTextColour(activeColor);
|
pt->setTextColour(activeColor);
|
||||||
categoryMode = mode;
|
categoryMode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
MyGUI::ButtonPtr getCategoryButton(CategoryMode mode)
|
MyGUI::ButtonPtr getCategoryButton(CategoryMode mode)
|
||||||
{
|
{
|
||||||
return buttons[mode];
|
return buttons[mode];
|
||||||
}
|
}
|
||||||
|
|
||||||
void onCategorySelected(MyGUI::Widget *widget)
|
void onCategorySelected(MyGUI::Widget *widget)
|
||||||
{
|
{
|
||||||
boost::array<CategoryMode, 5> categories = { {
|
boost::array<CategoryMode, 5> categories = { {
|
||||||
CM_All, CM_Weapon, CM_Apparel, CM_Magic, CM_Misc
|
CM_All, CM_Weapon, CM_Apparel, CM_Magic, CM_Misc
|
||||||
} };
|
} };
|
||||||
|
|
||||||
for (int i = 0; i < categories.size(); ++i)
|
for (int i = 0; i < categories.size(); ++i)
|
||||||
{
|
{
|
||||||
CategoryMode mode = categories[i];
|
CategoryMode mode = categories[i];
|
||||||
if (widget == buttons[mode])
|
if (widget == buttons[mode])
|
||||||
{
|
{
|
||||||
setCategory(mode);
|
setCategory(mode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CategoryMode categoryMode; // Current category filter
|
CategoryMode categoryMode; // Current category filter
|
||||||
MyGUI::ButtonPtr buttons[5]; // Button pointers
|
MyGUI::ButtonPtr buttons[5]; // Button pointers
|
||||||
std::string names[5]; // Names of category buttons
|
std::string names[5]; // Names of category buttons
|
||||||
|
|
||||||
MyGUI::Colour activeColor;
|
MyGUI::Colour activeColor;
|
||||||
MyGUI::Colour inactiveColor;
|
MyGUI::Colour inactiveColor;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -110,7 +110,7 @@ void WindowManager::updateVisible()
|
||||||
map -> setVisible( eff & GW_Map );
|
map -> setVisible( eff & GW_Map );
|
||||||
stats -> setVisible( eff & GW_Stats );
|
stats -> setVisible( eff & GW_Stats );
|
||||||
// inventory -> setVisible( eff & GW_Inventory );
|
// inventory -> setVisible( eff & GW_Inventory );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// All other modes are ignored
|
// All other modes are ignored
|
||||||
|
|
|
@ -88,7 +88,7 @@ namespace MWGui
|
||||||
Console *console;
|
Console *console;
|
||||||
|
|
||||||
// Character creation
|
// Character creation
|
||||||
RaceDialog *raceDialog;
|
RaceDialog *raceDialog;
|
||||||
|
|
||||||
// Which dialogs have been shown, controls back/next/ok buttons
|
// Which dialogs have been shown, controls back/next/ok buttons
|
||||||
bool nameChosen;
|
bool nameChosen;
|
||||||
|
|
|
@ -3,32 +3,32 @@
|
||||||
namespace ESM
|
namespace ESM
|
||||||
{
|
{
|
||||||
const std::string Skill::sSkillNames[Length] = {
|
const std::string Skill::sSkillNames[Length] = {
|
||||||
"Block",
|
"Block",
|
||||||
"Armorer",
|
"Armorer",
|
||||||
"Medium Armor",
|
"Medium Armor",
|
||||||
"Heavy Armor",
|
"Heavy Armor",
|
||||||
"Blunt Weapon",
|
"Blunt Weapon",
|
||||||
"Long Blade",
|
"Long Blade",
|
||||||
"Axe",
|
"Axe",
|
||||||
"Spear",
|
"Spear",
|
||||||
"Athletics",
|
"Athletics",
|
||||||
"Enchant",
|
"Enchant",
|
||||||
"Destruction",
|
"Destruction",
|
||||||
"Alteration",
|
"Alteration",
|
||||||
"Illusion",
|
"Illusion",
|
||||||
"Conjuration",
|
"Conjuration",
|
||||||
"Mysticism",
|
"Mysticism",
|
||||||
"Restoration",
|
"Restoration",
|
||||||
"Alchemy",
|
"Alchemy",
|
||||||
"Unarmored",
|
"Unarmored",
|
||||||
"Security",
|
"Security",
|
||||||
"Sneak",
|
"Sneak",
|
||||||
"Acrobatics",
|
"Acrobatics",
|
||||||
"Light Armor",
|
"Light Armor",
|
||||||
"Short Blade",
|
"Short Blade",
|
||||||
"Marksman",
|
"Marksman",
|
||||||
"Mercantile",
|
"Mercantile",
|
||||||
"Speechcraft",
|
"Speechcraft",
|
||||||
"Hand To Hand",
|
"Hand To Hand",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue