1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 18:19:55 +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 updateWindow(Ogre::RenderWindow* rw) { mWindow = rw; }
private:
bool mFirstLoad;

View file

@ -56,10 +56,11 @@
using namespace MWGui;
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,
Translation::Storage& translationDataStorage)
: mGuiManager(NULL)
, mRendering(ogre)
, mHud(NULL)
, mMap(NULL)
, mMenu(NULL)
@ -111,7 +112,7 @@ WindowManager::WindowManager(
{
// 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();
//Register own widgets with MyGUI
@ -172,7 +173,7 @@ WindowManager::WindowManager(
mEnchantingDialog = new EnchantingDialog(*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);
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"));
bool changeRes = false;
bool windowRecreated = false;
for (Settings::CategorySettingVector::const_iterator it = changed.begin();
it != changed.end(); ++it)
{
@ -772,6 +774,8 @@ void WindowManager::processChangedSettings(const Settings::CategorySettingVector
{
changeRes = true;
}
else if (it->first == "Video" && it->second == "vsync")
windowRecreated = true;
else if (it->first == "HUD" && it->second == "crosshair")
mCrosshairEnabled = Settings::Manager::getBool ("crosshair", "HUD");
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));
mInputBlocker->setSize(MyGUI::IntSize(x,y));
}
if (windowRecreated)
{
mGuiManager->updateWindow (mRendering->getWindow ());
mLoadingScreen->updateWindow (mRendering->getWindow ());
}
}
void WindowManager::pushGuiMode(GuiMode mode)

View file

@ -229,6 +229,7 @@ namespace MWGui
private:
OEngine::GUI::MyGUIManager *mGuiManager;
OEngine::Render::OgreRenderer *mRendering;
HUD *mHud;
MapWindow *mMap;
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
if (mActiveQuery != NULL)
{
std::cout << "ending query (notifyRenderSingleObject)" << std::endl;
mActiveQuery->endOcclusionQuery();
mActiveQuery = NULL;
}
@ -128,7 +127,6 @@ void OcclusionQuery::notifyRenderSingleObject(Renderable* rend, const Pass* pass
// Open a new occlusion query
if (mDoQuery == true)
{
std::cout << "opening new query" << std::endl;
if (rend == mBBQueryTotal)
{
mActiveQuery = mSunTotalAreaQuery;
@ -214,7 +212,6 @@ void OcclusionQuery::update(float duration)
&& !mSunVisibleAreaQuery->isStillOutstanding()
&& !mSingleObjectQuery->isStillOutstanding())
{
std::cout << "update(), nothing is outstanding"<< std::endl;
unsigned int totalPixels;
unsigned int visiblePixels;
@ -250,8 +247,6 @@ void OcclusionQuery::occlusionTest(const Ogre::Vector3& position, Ogre::SceneNod
assert( !occlusionTestPending()
&& "Occlusion test still pending");
std::cout << "Occlusion test called " << std::endl;
mBBQuerySingleObject->setVisible(true);
mObjectNode->setPosition(position);

View file

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

View file

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