summaryrefslogtreecommitdiffstats
path: root/src/game/client/voxel_anims.cc
blob: 4e0f1688c83b0b9594ab96c74ae3f63f5371af4e (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
#include "client/pch.hh"

#include "client/voxel_anims.hh"

#include "core/config.hh"
#include "core/constexpr.hh"

#include "client/globals.hh"

static ConfigUnsigned base_framerate(16U, 1U, 16U);

std::uint64_t voxel_anims::nextframe = 0U;
std::uint32_t voxel_anims::frame = 0U;

void voxel_anims::init(void)
{
    globals::client_config.add_value("voxel_anims.base_framerate", base_framerate);

    voxel_anims::nextframe = 0U;
    voxel_anims::frame = 0U;
}

void voxel_anims::update(void)
{
    if(globals::curtime >= voxel_anims::nextframe) {
        voxel_anims::nextframe = globals::curtime + static_cast<std::uint64_t>(1000000.0 / static_cast<float>(base_framerate.get_value()));
        voxel_anims::frame += 1U;
    }
}