=== modified file 'src/scene.cpp'
@@ -35,7 +35,7 @@
Scene::Scene(Canvas &pCanvas, const string &name) :
canvas_(pCanvas), name_(name),
- startTime_(0), lastUpdateTime_(0), currentFrame_(0), averageFPS_(0),
+ startTime_(0), lastUpdateTime_(0), currentFrame_(0),
running_(0), duration_(0)
{
options_["duration"] = Scene::Option("duration", "10.0",
@@ -95,10 +95,8 @@
lastUpdateTime_ = current_time;
- if (elapsed_time >= duration_) {
- averageFPS_ = currentFrame_ / elapsed_time;
+ if (elapsed_time >= duration_)
running_ = false;
- }
}
void
@@ -119,7 +117,8 @@
unsigned
Scene::average_fps()
{
- return averageFPS_;
+ double elapsed_time = lastUpdateTime_ - startTime_;
+ return currentFrame_ / elapsed_time;
}
=== modified file 'src/scene.h'
@@ -210,7 +210,6 @@
double startTime_;
double lastUpdateTime_;
unsigned currentFrame_;
- unsigned averageFPS_; // Average FPS of run
bool running_;
double duration_; // Duration of run in seconds
};