2018-01-20 15:15:15 +01:00
|
|
|
/*
|
2019-08-03 19:43:48 +02:00
|
|
|
* This software is licensed under the terms of the MIT License.
|
2018-01-20 15:15:15 +01:00
|
|
|
* See COPYING for further information.
|
|
|
|
* ---
|
2019-01-23 21:10:43 +01:00
|
|
|
* Copyright (c) 2011-2019, Lukas Weber <laochailan@web.de>.
|
2019-07-03 20:00:56 +02:00
|
|
|
* Copyright (c) 2012-2019, Andrei Alexeyev <akari@taisei-project.org>.
|
2018-01-20 15:15:15 +01:00
|
|
|
*/
|
|
|
|
|
2019-01-23 21:10:43 +01:00
|
|
|
#ifndef IGUARD_framerate_h
|
|
|
|
#define IGUARD_framerate_h
|
|
|
|
|
2018-01-20 15:15:15 +01:00
|
|
|
#include "taisei.h"
|
|
|
|
|
|
|
|
#include "hirestime.h"
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
hrtime_t frametimes[120]; // size = number of frames to average
|
|
|
|
double fps; // average fps over the last X frames
|
2019-01-09 04:25:10 +01:00
|
|
|
hrtime_t frametime; // average frame time over the last X frames;
|
2018-01-20 15:15:15 +01:00
|
|
|
hrtime_t last_update_time; // internal; last time the average was recalculated
|
|
|
|
} FPSCounter;
|
|
|
|
|
|
|
|
uint32_t get_effective_frameskip(void);
|
|
|
|
void fpscounter_reset(FPSCounter *fps);
|
|
|
|
void fpscounter_update(FPSCounter *fps);
|
2019-01-23 21:10:43 +01:00
|
|
|
|
|
|
|
#endif // IGUARD_framerate_h
|