summaryrefslogtreecommitdiff
path: root/core/src/cpp/fps_counter.h
blob: 6ac289e8516ca936fc8012d20c7c425ee42db169 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#pragma once

#include "sprite.h"

struct FPS_Counter {
    explicit FPS_Counter(SDL_Renderer* renderer);

    void draw();

    /*!
     * \brief fps_cur - the FPS readings are updated once in a while; fps_cur is
     * the number of draw() calls since the last reading
     */
    int fps_cur{0};
    /*!
     * \brief fps_prev - and here is the last fps reading
     */
    int fps_prev{0};
    /*!
     * \brief timestamp - last time fps_prev was updated
     */
    TimeStamp timestamp{Clock::now()};
    /*!
     * \brief renderer - draw here
     */
    SDL_Renderer* renderer{nullptr};
    /*!
     * \brief numbers - "font" file
     */
    const Sprite numbers;
};