Peoplemon  0.1.0
Peoplemon 3 game source documentation
MoveAnimation.hpp
Go to the documentation of this file.
1 #ifndef CORE_BATTLES_MOVEANIMATION_HPP
2 #define CORE_BATTLES_MOVEANIMATION_HPP
3 
4 #include <BLIB/Graphics/Animation2D.hpp>
5 #include <BLIB/Render/Scenes/CodeScene.hpp>
6 #include <BLIB/Resources.hpp>
9 
10 namespace core
11 {
12 namespace battle
13 {
14 namespace view
15 {
22 public:
26  enum User { Player, Opponent };
27 
33  MoveAnimation(bl::engine::Engine& engine);
34 
40  void init(bl::rc::scene::CodeScene* scene);
41 
48  void ensureLoaded(const pplmn::BattlePeoplemon& player, const pplmn::BattlePeoplemon& opponent);
49 
56  void playAnimation(User user, pplmn::MoveId move);
57 
61  bool completed() const;
62 
68  void renderBackground(bl::rc::scene::CodeScene::RenderContext& ctx);
69 
75  void renderForeground(bl::rc::scene::CodeScene::RenderContext& ctx);
76 
77 private:
78  struct Anim {
79  pplmn::MoveId move;
80  bl::gfx::Animation2D background;
81  bl::gfx::Animation2D foreground;
82  bool valid;
83 
84  Anim();
85  bool init(bl::engine::Engine& engine, bl::rc::scene::CodeScene* scene, User user,
86  pplmn::MoveId move);
87  void play();
88  bool finished() const;
89  };
90 
91  bl::engine::Engine& engine;
92  bl::rc::scene::CodeScene* scene;
93  Anim playerAnims[4];
94  Anim opponentAnims[4];
95  Anim extraMove;
96  Anim* playing;
97 };
98 
99 } // namespace view
100 } // namespace battle
101 } // namespace core
102 
103 #endif
MoveId
The id of a move.
Definition: MoveId.hpp:16
Core classes and functionality for both the editor and game.
Utility for rendering move animations.
void renderBackground(bl::rc::scene::CodeScene::RenderContext &ctx)
Renders the move animation background.
void ensureLoaded(const pplmn::BattlePeoplemon &player, const pplmn::BattlePeoplemon &opponent)
Loads the move animations into the resource manager for the given peoplemon.
MoveAnimation(bl::engine::Engine &engine)
Construct a new Move Animation helper.
void playAnimation(User user, pplmn::MoveId move)
Begins playing the given move animation.
bool completed() const
Returns whether or not the animation has completed playing.
void init(bl::rc::scene::CodeScene *scene)
Initializes the animations.
User
Which peoplemon is using the move.
void renderForeground(bl::rc::scene::CodeScene::RenderContext &ctx)
Renders the move animation foreground.
Represents a Peoplemon in battle. Stores some extra state that only exists in battle....