Peoplemon  0.1.0
Peoplemon 3 game source documentation
StatBoxes.hpp
Go to the documentation of this file.
1 #ifndef CORE_BATTLES_VIEW_STATBOXES_HPP
2 #define CORE_BATTLES_VIEW_STATBOXES_HPP
3 
4 #include <BLIB/Graphics.hpp>
5 #include <BLIB/Render/Scenes/CodeScene.hpp>
6 #include <BLIB/Resources.hpp>
8 
9 namespace core
10 {
11 namespace battle
12 {
14 namespace view
15 {
21 class StatBoxes {
22 public:
28  StatBoxes(bl::engine::Engine& engine);
29 
35  void init(bl::rc::scene::CodeScene* scene);
36 
43 
50 
56  void sync(bool fromSwitch = false);
57 
63  void update(float dt);
64 
68  bool synced() const;
69 
75  void render(bl::rc::scene::CodeScene::RenderContext& ctx);
76 
77 private:
78  enum struct State { Hidden, Sliding, Showing };
79 
80  bl::engine::Engine& engine;
81 
82  pplmn::BattlePeoplemon* localPlayer;
83  pplmn::BattlePeoplemon* opponent;
84  State pState;
85  State oState;
86 
87  bl::rc::res::TextureRef opBoxTxtr;
88  bl::rc::res::TextureRef lpBoxTxtr;
89  bl::gfx::Sprite opBox;
90  bl::gfx::Sprite lpBox;
91 
92  bl::gfx::Rectangle opHpBar;
93  float opHpBarTarget;
94  bl::gfx::Text opName;
95  bl::gfx::Text opLevel;
96  bl::gfx::Sprite opAil;
97 
98  bl::gfx::Rectangle lpHpBar;
99  float lpHpBarTarget;
100  bl::gfx::Rectangle lpXpBar;
101  float lpXpBarTarget;
102  bl::gfx::Text lpName;
103  bl::gfx::Text lpHp;
104  bl::gfx::Text lpLevel;
105  bl::gfx::Sprite lpAil;
106 
107  bl::rc::res::TextureRef ailmentTexture(pplmn::Ailment ailment);
108 };
109 
110 } // namespace view
111 } // namespace battle
112 } // namespace core
113 
114 #endif
Ailment
Represents an ailment that a Peoplemon can have.
Definition: Ailment.hpp:16
Core classes and functionality for both the editor and game.
Renders both the player and opponent stat boxes.
Definition: StatBoxes.hpp:21
StatBoxes(bl::engine::Engine &engine)
Construct a new Stat Boxes component.
Definition: StatBoxes.cpp:39
void sync(bool fromSwitch=false)
Updates the UI to reflect the current peoplemon state.
Definition: StatBoxes.cpp:139
void init(bl::rc::scene::CodeScene *scene)
Creates entities and adds them to the scene.
Definition: StatBoxes.cpp:49
void update(float dt)
Updates bar sizes if they need to change.
Definition: StatBoxes.cpp:176
void setOpponent(pplmn::BattlePeoplemon *ppl)
Sets the opponent's peoplemon. Syncs right away.
Definition: StatBoxes.cpp:124
void setPlayer(pplmn::BattlePeoplemon *ppl)
Sets the player's peoplemon. Syncs right away.
Definition: StatBoxes.cpp:131
bool synced() const
Returns true if the view is in sync, false if an animation is in progress.
Definition: StatBoxes.cpp:241
void render(bl::rc::scene::CodeScene::RenderContext &ctx)
Renders the boxes.
Definition: StatBoxes.cpp:246
Represents a Peoplemon in battle. Stores some extra state that only exists in battle....