1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-29 09:45:32 +00:00

Supply the new render window to mygui

This commit is contained in:
scrawl 2013-02-05 20:48:25 +01:00
parent 31f760ccce
commit 608c112f34
6 changed files with 23 additions and 8 deletions

View file

@ -19,6 +19,8 @@ namespace MWGui
void onResChange(int w, int h); void onResChange(int w, int h);
void updateWindow(Ogre::RenderWindow* rw) { mWindow = rw; }
private: private:
bool mFirstLoad; bool mFirstLoad;

View file

@ -56,10 +56,11 @@
using namespace MWGui; using namespace MWGui;
WindowManager::WindowManager( WindowManager::WindowManager(
const Compiler::Extensions& extensions, int fpsLevel, bool newGame, OEngine::Render::OgreRenderer *mOgre, const Compiler::Extensions& extensions, int fpsLevel, bool newGame, OEngine::Render::OgreRenderer *ogre,
const std::string& logpath, const std::string& cacheDir, bool consoleOnlyScripts, const std::string& logpath, const std::string& cacheDir, bool consoleOnlyScripts,
Translation::Storage& translationDataStorage) Translation::Storage& translationDataStorage)
: mGuiManager(NULL) : mGuiManager(NULL)
, mRendering(ogre)
, mHud(NULL) , mHud(NULL)
, mMap(NULL) , mMap(NULL)
, mMenu(NULL) , mMenu(NULL)
@ -111,7 +112,7 @@ WindowManager::WindowManager(
{ {
// Set up the GUI system // Set up the GUI system
mGuiManager = new OEngine::GUI::MyGUIManager(mOgre->getWindow(), mOgre->getScene(), false, logpath); mGuiManager = new OEngine::GUI::MyGUIManager(mRendering->getWindow(), mRendering->getScene(), false, logpath);
mGui = mGuiManager->getGui(); mGui = mGuiManager->getGui();
//Register own widgets with MyGUI //Register own widgets with MyGUI
@ -172,7 +173,7 @@ WindowManager::WindowManager(
mEnchantingDialog = new EnchantingDialog(*this); mEnchantingDialog = new EnchantingDialog(*this);
mTrainingWindow = new TrainingWindow(*this); mTrainingWindow = new TrainingWindow(*this);
mLoadingScreen = new LoadingScreen(mOgre->getScene (), mOgre->getWindow (), *this); mLoadingScreen = new LoadingScreen(mRendering->getScene (), mRendering->getWindow (), *this);
mLoadingScreen->onResChange (w,h); mLoadingScreen->onResChange (w,h);
mInputBlocker = mGui->createWidget<MyGUI::Widget>("",0,0,w,h,MyGUI::Align::Default,"Windows",""); mInputBlocker = mGui->createWidget<MyGUI::Widget>("",0,0,w,h,MyGUI::Align::Default,"Windows","");
@ -763,6 +764,7 @@ void WindowManager::processChangedSettings(const Settings::CategorySettingVector
mToolTips->setDelay(Settings::Manager::getFloat("tooltip delay", "GUI")); mToolTips->setDelay(Settings::Manager::getFloat("tooltip delay", "GUI"));
bool changeRes = false; bool changeRes = false;
bool windowRecreated = false;
for (Settings::CategorySettingVector::const_iterator it = changed.begin(); for (Settings::CategorySettingVector::const_iterator it = changed.begin();
it != changed.end(); ++it) it != changed.end(); ++it)
{ {
@ -772,6 +774,8 @@ void WindowManager::processChangedSettings(const Settings::CategorySettingVector
{ {
changeRes = true; changeRes = true;
} }
else if (it->first == "Video" && it->second == "vsync")
windowRecreated = true;
else if (it->first == "HUD" && it->second == "crosshair") else if (it->first == "HUD" && it->second == "crosshair")
mCrosshairEnabled = Settings::Manager::getBool ("crosshair", "HUD"); mCrosshairEnabled = Settings::Manager::getBool ("crosshair", "HUD");
else if (it->first == "GUI" && it->second == "subtitles") else if (it->first == "GUI" && it->second == "subtitles")
@ -795,6 +799,11 @@ void WindowManager::processChangedSettings(const Settings::CategorySettingVector
mDragAndDrop->mDragAndDropWidget->setSize(MyGUI::IntSize(x, y)); mDragAndDrop->mDragAndDropWidget->setSize(MyGUI::IntSize(x, y));
mInputBlocker->setSize(MyGUI::IntSize(x,y)); mInputBlocker->setSize(MyGUI::IntSize(x,y));
} }
if (windowRecreated)
{
mGuiManager->updateWindow (mRendering->getWindow ());
mLoadingScreen->updateWindow (mRendering->getWindow ());
}
} }
void WindowManager::pushGuiMode(GuiMode mode) void WindowManager::pushGuiMode(GuiMode mode)

View file

@ -229,6 +229,7 @@ namespace MWGui
private: private:
OEngine::GUI::MyGUIManager *mGuiManager; OEngine::GUI::MyGUIManager *mGuiManager;
OEngine::Render::OgreRenderer *mRendering;
HUD *mHud; HUD *mHud;
MapWindow *mMap; MapWindow *mMap;
MainMenu *mMenu; MainMenu *mMenu;

View file

@ -120,7 +120,6 @@ void OcclusionQuery::notifyRenderSingleObject(Renderable* rend, const Pass* pass
// Each occlusion query should only last a single rendering // Each occlusion query should only last a single rendering
if (mActiveQuery != NULL) if (mActiveQuery != NULL)
{ {
std::cout << "ending query (notifyRenderSingleObject)" << std::endl;
mActiveQuery->endOcclusionQuery(); mActiveQuery->endOcclusionQuery();
mActiveQuery = NULL; mActiveQuery = NULL;
} }
@ -128,7 +127,6 @@ void OcclusionQuery::notifyRenderSingleObject(Renderable* rend, const Pass* pass
// Open a new occlusion query // Open a new occlusion query
if (mDoQuery == true) if (mDoQuery == true)
{ {
std::cout << "opening new query" << std::endl;
if (rend == mBBQueryTotal) if (rend == mBBQueryTotal)
{ {
mActiveQuery = mSunTotalAreaQuery; mActiveQuery = mSunTotalAreaQuery;
@ -214,7 +212,6 @@ void OcclusionQuery::update(float duration)
&& !mSunVisibleAreaQuery->isStillOutstanding() && !mSunVisibleAreaQuery->isStillOutstanding()
&& !mSingleObjectQuery->isStillOutstanding()) && !mSingleObjectQuery->isStillOutstanding())
{ {
std::cout << "update(), nothing is outstanding"<< std::endl;
unsigned int totalPixels; unsigned int totalPixels;
unsigned int visiblePixels; unsigned int visiblePixels;
@ -250,8 +247,6 @@ void OcclusionQuery::occlusionTest(const Ogre::Vector3& position, Ogre::SceneNod
assert( !occlusionTestPending() assert( !occlusionTestPending()
&& "Occlusion test still pending"); && "Occlusion test still pending");
std::cout << "Occlusion test called " << std::endl;
mBBQuerySingleObject->setVisible(true); mBBQuerySingleObject->setVisible(true);
mObjectNode->setPosition(position); mObjectNode->setPosition(position);

View file

@ -56,6 +56,12 @@ void MyGUIManager::setup(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool
mGui->initialise("core.xml"); mGui->initialise("core.xml");
} }
void MyGUIManager::updateWindow (Ogre::RenderWindow *wnd)
{
mRenderManager->setRenderWindow (wnd);
mRenderManager->setActiveViewport(0);
}
void MyGUIManager::shutdown() void MyGUIManager::shutdown()
{ {
mGui->shutdown (); mGui->shutdown ();

View file

@ -38,6 +38,8 @@ namespace GUI
shutdown(); shutdown();
} }
void updateWindow (Ogre::RenderWindow* wnd);
void setup(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool logging=false, const std::string& logDir = std::string("")); void setup(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool logging=false, const std::string& logDir = std::string(""));
void shutdown(); void shutdown();