P-E-R-R-Y
Utilitaires, contrats et vendors du moteur, en une seule doc
Loading...
Searching...
No Matches
RayAnimationSet.hpp
Go to the documentation of this file.
1
10
11#ifndef RAYANIMATIONSET_HPP_
12#define RAYANIMATIONSET_HPP_
13
14//Raylib (without conflict)
15#include "RaylibAliases.hpp"
16
17//Interface
18#include "IAnimationSet.hpp"
19
20#include <string>
21
27
28 public:
29 RayAnimationSet(std::string path) {
30 _animations = raylib::LoadModelAnimations(path.c_str(), &_size);
31 }
32
34 if (_animations)
35 raylib::UnloadModelAnimations(_animations, _size);
36 }
37
38 bool isReady() const override {
39 return _animations != nullptr;
40 }
41
42 int getSize() const override {
43 return _size;
44 }
45
46 std::string getName(int index) const override {
47 return valid(index) ? _animations[index].name : std::string();
48 }
49
50 int getFrameCount(int index) const override {
51 return valid(index) ? _animations[index].frameCount : 0;
52 }
53
54 raylib::ModelAnimation *handle() const {
55 return _animations;
56 }
57
58 private:
59 bool valid(int index) const {
60 return _animations && index >= 0 && index < _size;
61 }
62
63 raylib::ModelAnimation *_animations;
64 int _size = 0;
65};
66
68
69#endif /* !RAYANIMATIONSET_HPP_ */
raylib::ModelAnimation * handle() const
Definition RayAnimationSet.hpp:54
bool isReady() const override
notice if the animation set is ready
Definition RayAnimationSet.hpp:38
~RayAnimationSet()
Definition RayAnimationSet.hpp:33
std::string getName(int index) const override
The clip name, as it appears in the file.
Definition RayAnimationSet.hpp:46
RayAnimationSet(std::string path)
Definition RayAnimationSet.hpp:29
int getFrameCount(int index) const override
How many frames this clip has.
Definition RayAnimationSet.hpp:50
int getSize() const override
Get the number of clips in this set.
Definition RayAnimationSet.hpp:42
A file's loaded animation clips, independent of any IModel bound to it - deleting every bound IModel ...
Definition IAnimationSet.hpp:26