summaryrefslogtreecommitdiffhomepage
path: root/src/anim.hpp
blob: 1a4011dcf4e862964d2653fd66abd7f9a0624ac7 (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
32
33
34
35
36
37
38
39
40
41
#pragma once

#include <vector>
#include <Corrade/Containers/String.h>
#include <Magnum/Magnum.h>
#include <Magnum/Math/Vector2.h>
#include <Magnum/Math/Vector3.h>

namespace floormat {

struct anim_frame final
{
    Vector2i ground;
    Vector2ui offset, size;
};

enum class anim_direction : unsigned char
{
    N, NE, E, SE, S, SW, W, NW,
    COUNT,
};

struct anim_group final
{
    String name;
    std::vector<anim_frame> frames;
    Vector2ui ground;
    Vector3b offset;
};

struct anim_def final
{
    static constexpr int default_fps = 24;

    String object_name, anim_name;
    std::vector<anim_group> groups;
    Vector2ui pixel_size;
    std::size_t nframes = 0, width = 0, height = 0, fps = default_fps, actionframe = 0;
};

} // namespace floormat