Centre race dialog on screen.

This commit is contained in:
Jan Borsodi 2010-09-15 21:48:10 +02:00
parent 31a728bf07
commit 3cf8472ddc
3 changed files with 8 additions and 4 deletions

View file

@ -13,7 +13,7 @@
using namespace MWGui; using namespace MWGui;
RaceDialog::RaceDialog(MWWorld::Environment& environment) RaceDialog::RaceDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize)
: Layout("openmw_chargen_race_layout.xml") : Layout("openmw_chargen_race_layout.xml")
, environment(environment) , environment(environment)
, genderIndex(0) , genderIndex(0)
@ -22,7 +22,11 @@ RaceDialog::RaceDialog(MWWorld::Environment& environment)
, faceCount(10) , faceCount(10)
, hairCount(14) , hairCount(14)
{ {
mMainWidget->setCoord(mMainWidget->getCoord() + MyGUI::IntPoint(0, 100)); // Centre dialog
MyGUI::IntCoord coord = mMainWidget->getCoord();
coord.left = (gameWindowSize.width - coord.width)/2;
coord.top = (gameWindowSize.height - coord.height)/2;
mMainWidget->setCoord(coord);
// 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.

View file

@ -24,7 +24,7 @@ namespace MWGui
class RaceDialog : public OEngine::GUI::Layout class RaceDialog : public OEngine::GUI::Layout
{ {
public: public:
RaceDialog(MWWorld::Environment& environment); RaceDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize);
enum Gender enum Gender
{ {

View file

@ -114,7 +114,7 @@ void WindowManager::updateVisible()
if (mode == GM_Race) if (mode == GM_Race)
{ {
if (!raceDialog) if (!raceDialog)
raceDialog = new RaceDialog(environment); raceDialog = new RaceDialog(environment, gui->getViewSize());
raceDialog->setNextButtonShow(raceChosen); raceDialog->setNextButtonShow(raceChosen);
raceDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onRaceDialogDone); raceDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onRaceDialogDone);
raceDialog->eventBack = MyGUI::newDelegate(this, &WindowManager::onRaceDialogBack); raceDialog->eventBack = MyGUI::newDelegate(this, &WindowManager::onRaceDialogBack);