forked from phisko/kengine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnimationComponent.hpp
More file actions
57 lines (47 loc) · 1.43 KB
/
Copy pathAnimationComponent.hpp
File metadata and controls
57 lines (47 loc) · 1.43 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#pragma once
#ifndef KENGINE_ANIMATION_FILE_PATH_LENGTH
# define KENGINE_ANIMATION_FILE_PATH_LENGTH 128
#endif
#include <string>
#include <vector>
#include "reflection.hpp"
namespace kengine {
struct AnimationComponent {
unsigned int currentAnim = 0; // Index into AnimListComponent.anims
float currentTime = 0.f;
float speed = 1.f;
bool loop = true;
putils_reflection_class_name(AnimationComponent);
putils_reflection_attributes(
putils_reflection_attribute(&AnimationComponent::currentAnim),
putils_reflection_attribute(&AnimationComponent::currentTime),
putils_reflection_attribute(&AnimationComponent::speed),
putils_reflection_attribute(&AnimationComponent::loop)
);
};
struct AnimListComponent {
struct Anim {
std::string name;
float totalTime;
float ticksPerSecond;
putils_reflection_class_name(AnimListComponentAnim);
putils_reflection_attributes(
putils_reflection_attribute(&Anim::name),
putils_reflection_attribute(&Anim::totalTime),
putils_reflection_attribute(&Anim::ticksPerSecond)
);
};
std::vector<Anim> anims;
putils_reflection_class_name(AnimListComponent);
putils_reflection_attributes(
putils_reflection_attribute(&AnimListComponent::anims)
);
};
struct AnimFilesComponent {
std::vector<std::string> files;
putils_reflection_class_name(AnimFilesComponent);
putils_reflection_attributes(
putils_reflection_attribute(&AnimFilesComponent::files)
);
};
}