Peoplemon  0.1.0
Peoplemon 3 game source documentation
WalkAnimations.hpp
Go to the documentation of this file.
1 #ifndef CORE_RESOURCES_WALKANIMATIONS_HPP
2 #define CORE_RESOURCES_WALKANIMATIONS_HPP
3 
4 #include <BLIB/Graphics/Animation2D/AnimationData.hpp>
5 #include <BLIB/Resources.hpp>
6 #include <BLIB/Tilemap/Direction.hpp>
7 
8 namespace core
9 {
10 namespace res
11 {
18 class WalkAnimations : public bl::gfx::a2d::AnimationData {
19 public:
26  bool loadFromDirectory(const std::string& path);
27 
34  static std::size_t getStateFromDirection(bl::tmap::Direction dir) {
35  return static_cast<std::size_t>(dir);
36  }
37 
41  float getMaxStateLength() const { return maxLen; }
42 
43 private:
44  float maxLen;
45 };
46 
52 struct WalkAnimationLoader : public bl::resource::LoaderBase<WalkAnimations> {
62  virtual bool load(const std::string& path, const char*, std::size_t, std::istream&,
63  WalkAnimations& result) override;
64 };
65 
66 } // namespace res
67 } // namespace core
68 
69 #endif
Core classes and functionality for both the editor and game.
Extension of animation data that loads and combines the animations for each movement direction into a...
bool loadFromDirectory(const std::string &path)
Loads the walking animations from the given directory.
float getMaxStateLength() const
Returns the maximum length of any substate animation in seconds.
static std::size_t getStateFromDirection(bl::tmap::Direction dir)
Maps the movement direction to the state index.
Specialized loader for walking animations.
virtual bool load(const std::string &path, const char *, std::size_t, std::istream &, WalkAnimations &result) override
Loads the walking animations from the given path.