2018-02-15 18:10:58 +08:00
|
|
|
#ifndef FPSCOUNTER_H
|
|
|
|
#define FPSCOUNTER_H
|
|
|
|
|
2019-03-03 06:52:22 +08:00
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
2018-02-15 18:10:58 +08:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
struct fps_counter {
|
2019-03-03 06:52:22 +08:00
|
|
|
bool started;
|
|
|
|
uint32_t slice_start; // initialized by SDL_GetTicks()
|
2018-02-15 18:10:58 +08:00
|
|
|
int nr_rendered;
|
|
|
|
#ifdef SKIP_FRAMES
|
|
|
|
int nr_skipped;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2019-03-03 03:09:56 +08:00
|
|
|
void
|
|
|
|
fps_counter_init(struct fps_counter *counter);
|
|
|
|
|
|
|
|
void
|
|
|
|
fps_counter_start(struct fps_counter *counter);
|
|
|
|
|
|
|
|
void
|
|
|
|
fps_counter_stop(struct fps_counter *counter);
|
|
|
|
|
|
|
|
void
|
|
|
|
fps_counter_add_rendered_frame(struct fps_counter *counter);
|
2018-02-15 18:10:58 +08:00
|
|
|
|
|
|
|
#ifdef SKIP_FRAMES
|
2019-03-03 03:09:56 +08:00
|
|
|
void
|
|
|
|
fps_counter_add_skipped_frame(struct fps_counter *counter);
|
2018-02-15 18:10:58 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|