mirror of https://github.com/auygun/kaliber.git
Fix for benchmark
This commit is contained in:
parent
5c6e414a15
commit
3bc8785469
|
@ -130,11 +130,11 @@ void Demo::Update(float delta_time) {
|
|||
|
||||
if (do_benchmark_) {
|
||||
benchmark_time_ += delta_time;
|
||||
if (benchmark_time_ > 1) {
|
||||
if (benchmark_time_ > 3) {
|
||||
avarage_fps_ += Engine::Get().fps();
|
||||
++num_benchmark_samples_;
|
||||
}
|
||||
if (benchmark_time_ > 6) {
|
||||
if (benchmark_time_ > 5) {
|
||||
avarage_fps_ /= num_benchmark_samples_;
|
||||
do_benchmark_ = false;
|
||||
BenchmarkResult(avarage_fps_);
|
||||
|
@ -166,6 +166,14 @@ void Demo::Update(float delta_time) {
|
|||
UpdateGameState(delta_time);
|
||||
}
|
||||
|
||||
void Demo::ContextLost() {
|
||||
if (do_benchmark_) {
|
||||
benchmark_time_ = 0;
|
||||
num_benchmark_samples_ = 0;
|
||||
avarage_fps_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void Demo::LostFocus() {}
|
||||
|
||||
void Demo::GainedFocus(bool from_interstitial_ad) {
|
||||
|
|
|
@ -27,7 +27,7 @@ class Demo final : public eng::Game {
|
|||
|
||||
void Update(float delta_time) final;
|
||||
|
||||
void ContextLost() final {}
|
||||
void ContextLost() final;
|
||||
|
||||
void LostFocus() final;
|
||||
|
||||
|
|
Loading…
Reference in New Issue