Cleanup fix

c++11
scrawl 10 years ago
parent 42d6c6140c
commit 15164e20f7

@ -314,9 +314,9 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
settings.getBool("minimize on focus loss", "Video") ? "1" : "0");
// not handling fullscreen yet, we should figure this out when adding SDL to the mix
mViewer.setUpViewInWindow(0, 0, settings.getInt("resolution x", "Video"), settings.getInt("resolution y", "Video"), settings.getInt("screen", "Video"));
mViewer->setUpViewInWindow(0, 0, settings.getInt("resolution x", "Video"), settings.getInt("resolution y", "Video"), settings.getInt("screen", "Video"));
osg::ref_ptr<osg::Group> rootNode (new osg::Group);
mViewer.setSceneData(rootNode);
mViewer->setSceneData(rootNode);
mVFS.reset(new VFS::Manager(mFSStrict));
@ -355,7 +355,7 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
std::string myguiResources = (mResDir / "mygui").string();
osg::ref_ptr<osg::Group> guiRoot = new osg::Group;
rootNode->addChild(guiRoot);
MWGui::WindowManager* window = new MWGui::WindowManager(&mViewer, guiRoot, mResourceSystem->getTextureManager(),
MWGui::WindowManager* window = new MWGui::WindowManager(mViewer, guiRoot, mResourceSystem->getTextureManager(),
mCfgMgr.getLogPath().string() + std::string("/"), myguiResources,
mScriptConsoleMode, mTranslationDataStorage, mEncoding, mExportFonts, mFallbackMap);
mEnvironment.setWindowManager (window);
@ -371,7 +371,7 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
}
// Create the world
mEnvironment.setWorld( new MWWorld::World (mViewer, rootNode, mResourceSystem.get(),
mEnvironment.setWorld( new MWWorld::World (*mViewer, rootNode, mResourceSystem.get(),
mFileCollections, mContentFiles, mEncoder, mFallbackMap,
mActivationDistanceOverride, mCellName, mStartupScript));
MWBase::Environment::get().getWorld()->setupPlayer();
@ -433,7 +433,8 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
void OMW::Engine::go()
{
assert (!mContentFiles.empty());
//assert (!mOgre);
mViewer = new osgViewer::Viewer;
Settings::Manager settings;
std::string settingspath;
@ -474,12 +475,12 @@ void OMW::Engine::go()
}
// Start the main rendering loop
mViewer.setCameraManipulator(new osgGA::TrackballManipulator);
mViewer.addEventHandler(new osgViewer::StatsHandler);
mViewer->setCameraManipulator(new osgGA::TrackballManipulator);
mViewer->addEventHandler(new osgViewer::StatsHandler);
mViewer.realize();
mViewer->realize();
osg::Timer frameTimer;
while (!mViewer.done())
while (!mViewer->done())
{
double dt = frameTimer.time_s();
frameTimer.setStartTick();
@ -491,7 +492,7 @@ void OMW::Engine::go()
MWBase::Environment::get().getWorld()->advanceTime(
dt*MWBase::Environment::get().getWorld()->getTimeScaleFactor()/3600);
mViewer.frame(/*simulationTime*/);
mViewer->frame(/*simulationTime*/);
}
// Save user settings

@ -69,7 +69,7 @@ namespace OMW
Files::PathContainer mDataDirs;
std::vector<std::string> mArchives;
boost::filesystem::path mResDir;
osgViewer::Viewer mViewer;
osg::ref_ptr<osgViewer::Viewer> mViewer;
std::string mCellName;
std::vector<std::string> mContentFiles;
bool mVerboseScripts;

@ -561,7 +561,7 @@ void RenderManager::setViewSize(int width, int height)
mInfo.aspectCoef = float(mViewSize.height) / float(mViewSize.width);
mInfo.pixScaleX = 1.0f / float(mViewSize.width);
mInfo.pixScaleY = 1.0f / float(mViewSize.height);
std::cout << "setviewsize " << width << " " << height << std::endl;
onResizeView(mViewSize);
mUpdate = true;
}

@ -173,8 +173,8 @@ namespace MWGui
, mCurrentModals()
, mFallbackMap(fallbackMap)
{
Platform* platform = new Platform(viewer, guiRoot, textureManager);
platform->initialise(resourcePath, logpath);
mGuiPlatform = new Platform(viewer, guiRoot, textureManager);
mGuiPlatform->initialise(resourcePath, logpath);
MyGUI::Gui* gui = new MyGUI::Gui;
gui->initialise("");
@ -411,6 +411,8 @@ namespace MWGui
//delete mCursorManager;
cleanupGarbage();
delete mGuiPlatform;
}
void WindowManager::cleanupGarbage()

@ -107,6 +107,8 @@ namespace MWGui
class DebugWindow;
class JailScreen;
class Platform;
class WindowManager : public MWBase::WindowManager
{
public:
@ -365,6 +367,8 @@ namespace MWGui
virtual void cycleWeapon(bool next);
private:
Platform* mGuiPlatform;
bool mConsoleOnlyScripts;
std::map<MyGUI::Window*, std::string> mTrackedWindows;

Loading…
Cancel
Save