forked from teamnwah/openmw-tes3coop
Pause simulationTime when the GUI is up
This commit is contained in:
parent
4dd96f3318
commit
e3b1707bbd
2 changed files with 10 additions and 4 deletions
|
@ -73,7 +73,7 @@ void OMW::Engine::executeLocalScripts()
|
|||
localScripts.setIgnore (MWWorld::Ptr());
|
||||
}
|
||||
|
||||
void OMW::Engine::frame(float frametime)
|
||||
double OMW::Engine::frame(float frametime)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -94,6 +94,8 @@ void OMW::Engine::frame(float frametime)
|
|||
|
||||
// GUI active? Most game processing will be paused, but scripts still run.
|
||||
bool guiActive = MWBase::Environment::get().getWindowManager()->isGuiMode();
|
||||
if (!guiActive)
|
||||
mSimulationTime += frametime;
|
||||
|
||||
// Main menu opened? Then scripts are also paused.
|
||||
bool paused = MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_MainMenu);
|
||||
|
@ -182,6 +184,7 @@ void OMW::Engine::frame(float frametime)
|
|||
{
|
||||
std::cerr << "Error in framelistener: " << e.what() << std::endl;
|
||||
}
|
||||
return mSimulationTime;
|
||||
}
|
||||
|
||||
OMW::Engine::Engine(Files::ConfigurationManager& configurationManager)
|
||||
|
@ -203,6 +206,7 @@ OMW::Engine::Engine(Files::ConfigurationManager& configurationManager)
|
|||
, mScriptBlacklistUse (true)
|
||||
, mNewGame (false)
|
||||
, mCfgMgr(configurationManager)
|
||||
, mSimulationTime(0.0)
|
||||
{
|
||||
Misc::Rng::init();
|
||||
MWClass::registerClasses();
|
||||
|
@ -587,8 +591,8 @@ void OMW::Engine::go()
|
|||
frameTimer.setStartTick();
|
||||
//dt = std::min(dt, 0.2);
|
||||
|
||||
frame(dt);
|
||||
mViewer->frame(/*simulationTime*/);
|
||||
double simulationTime = frame(dt);
|
||||
mViewer->frame(simulationTime);
|
||||
}
|
||||
|
||||
// Save user settings
|
||||
|
|
|
@ -100,6 +100,7 @@ namespace OMW
|
|||
bool mNewGame;
|
||||
|
||||
osg::Timer_t mStartTick;
|
||||
double mSimulationTime;
|
||||
|
||||
// not implemented
|
||||
Engine (const Engine&);
|
||||
|
@ -107,7 +108,8 @@ namespace OMW
|
|||
|
||||
void executeLocalScripts();
|
||||
|
||||
void frame (float dt);
|
||||
/// @return The new simulationTime
|
||||
double frame (float dt);
|
||||
|
||||
/// Load settings from various files, returns the path to the user settings file
|
||||
std::string loadSettings (Settings::Manager & settings);
|
||||
|
|
Loading…
Reference in a new issue