From 3cf8472ddc3b01f076549b35eee51e5e9fea5520 Mon Sep 17 00:00:00 2001 From: Jan Borsodi Date: Wed, 15 Sep 2010 21:48:10 +0200 Subject: [PATCH] Centre race dialog on screen. --- apps/openmw/mwgui/race.cpp | 8 ++++++-- apps/openmw/mwgui/race.hpp | 2 +- apps/openmw/mwgui/window_manager.cpp | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwgui/race.cpp b/apps/openmw/mwgui/race.cpp index 9b6f8e76d9..00952782c9 100644 --- a/apps/openmw/mwgui/race.cpp +++ b/apps/openmw/mwgui/race.cpp @@ -13,7 +13,7 @@ using namespace MWGui; -RaceDialog::RaceDialog(MWWorld::Environment& environment) +RaceDialog::RaceDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize) : Layout("openmw_chargen_race_layout.xml") , environment(environment) , genderIndex(0) @@ -22,7 +22,11 @@ RaceDialog::RaceDialog(MWWorld::Environment& environment) , faceCount(10) , 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 // real calls from outside the class later. diff --git a/apps/openmw/mwgui/race.hpp b/apps/openmw/mwgui/race.hpp index bfa3c505d1..fc147c6c7c 100644 --- a/apps/openmw/mwgui/race.hpp +++ b/apps/openmw/mwgui/race.hpp @@ -24,7 +24,7 @@ namespace MWGui class RaceDialog : public OEngine::GUI::Layout { public: - RaceDialog(MWWorld::Environment& environment); + RaceDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize); enum Gender { diff --git a/apps/openmw/mwgui/window_manager.cpp b/apps/openmw/mwgui/window_manager.cpp index 0a9c38062f..bed832989c 100644 --- a/apps/openmw/mwgui/window_manager.cpp +++ b/apps/openmw/mwgui/window_manager.cpp @@ -114,7 +114,7 @@ void WindowManager::updateVisible() if (mode == GM_Race) { if (!raceDialog) - raceDialog = new RaceDialog(environment); + raceDialog = new RaceDialog(environment, gui->getViewSize()); raceDialog->setNextButtonShow(raceChosen); raceDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onRaceDialogDone); raceDialog->eventBack = MyGUI::newDelegate(this, &WindowManager::onRaceDialogBack);