taisei/src/framerate.h

28 lines
811 B
C
Raw Normal View History

2018-01-20 15:15:15 +01: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.
* ---
* 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
*/
#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
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);
#endif // IGUARD_framerate_h