Commit 695da29c authored by VAN TOLL Wouter's avatar VAN TOLL Wouter
Browse files

GUI bugfix: The refresh rate became incorrect when loading a new simulation...

GUI bugfix: The refresh rate became incorrect when loading a new simulation with a different framerate.
parent 48d336bc
......@@ -130,6 +130,11 @@ void UMANSOpenGLWidget::startNewSimulation(const std::string& scenarioFilename)
setActiveAgent(nullptr);
simulator = newSimulator;
// Prepare a timer for update events, using the current value of playbackMultiplier.
// This works for the very first simulation, because playbackMultiplier=1 by default.
// In other cases, the new simulation may use a different framerate than the previous one, so we need to re-initialize the timer.
SetPlaybackMultiplier(playbackMultiplier);
}
else
{
......@@ -533,9 +538,6 @@ void UMANSOpenGLWidget::initializeGL()
// initialize the simulation
startNewSimulation(DefaultScenarioFile);
// prepare a timer for updating the simulation
SetPlaybackMultiplier(1);
program.release();
}
......
......@@ -108,7 +108,7 @@ private:
bool inAgentSelectMode;
bool panning;
bool simulationRunning;
int playbackMultiplier;
int playbackMultiplier = 1;
bool makeScreenshotsPerFrame;
bool writeCSVOutput;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment