taisei/src/framerate.h
2019-08-03 20:44:22 +03:00

27 lines
811 B
C

/*
* This software is licensed under the terms of the MIT License.
* See COPYING for further information.
* ---
* Copyright (c) 2011-2019, Lukas Weber <laochailan@web.de>.
* Copyright (c) 2012-2019, Andrei Alexeyev <akari@taisei-project.org>.
*/
#ifndef IGUARD_framerate_h
#define IGUARD_framerate_h
#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;
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