Peoplemon  0.1.0
Peoplemon 3 game source documentation
BattleView.hpp
Go to the documentation of this file.
1 #ifndef GAME_BATTLES_BATTLEVIEW_HPP
2 #define GAME_BATTLES_BATTLEVIEW_HPP
3 
4 #include <BLIB/Render/Scenes/CodeScene.hpp>
13 #include <SFML/Graphics.hpp>
14 #include <SFML/Graphics/RenderTarget.hpp>
15 #include <queue>
16 
17 namespace core
18 {
19 namespace battle
20 {
21 class BattleState;
22 
29 class BattleView : public bl::input::Listener {
30 public:
38  BattleView(bl::engine::Engine& engine, BattleState& state, bool canRun);
39 
45  void init(bl::rc::scene::CodeScene* scene);
46 
51 
55  bool playerChoseForgetMove() const;
56 
60  bool playerChoseToSetName() const;
61 
65  const std::string& chosenNickname() const;
66 
72  bool actionsCompleted() const;
73 
77  void hideText();
78 
84  void processCommand(const Command& command);
85 
91  void update(float dt);
92 
98  void render(bl::rc::scene::CodeScene::RenderContext& ctx);
99 
100 private:
101  bl::engine::Engine& engine;
102  BattleState& battleState;
103  view::PlayerMenu playerMenu;
104  view::StatBoxes statBoxes;
105  view::MessagePrinter printer;
106  view::PeoplemonAnimation localPeoplemon;
107  view::PeoplemonAnimation opponentPeoplemon;
108  view::MoveAnimation moveAnimation;
109 
110  bl::rc::res::TextureRef bgndTxtr;
111  bl::gfx::Sprite background;
112 
113  virtual bool observe(const bl::input::Actor&, unsigned int activatedControl,
114  bl::input::DispatchType, bool eventTriggered) override;
115 };
116 
117 } // namespace battle
118 } // namespace core
119 
120 #endif
Core classes and functionality for both the editor and game.
Stores and represents the current state of a battle. This is the base class for local and remote batt...
Definition: BattleState.hpp:18
This is the top level class for rendering battles. It takes commands and state from a BattleControlle...
Definition: BattleView.hpp:29
view::PlayerMenu & menu()
Access the player's menu.
Definition: BattleView.cpp:110
void render(bl::rc::scene::CodeScene::RenderContext &ctx)
Renders the battle view.
Definition: BattleView.cpp:126
void init(bl::rc::scene::CodeScene *scene)
Initializes renderer data, loads resources, and adds entities to the scene.
Definition: BattleView.cpp:21
bool playerChoseToSetName() const
Returns whether or not the player chose to set a nickname on a new Peoplemon.
Definition: BattleView.cpp:114
bool playerChoseForgetMove() const
Returns whether or not the player chose to forget a move when prompted.
Definition: BattleView.cpp:112
void update(float dt)
Updates the view, including contained animations and printing text.
Definition: BattleView.cpp:118
void hideText()
Hides the battle text when the view is synced.
Definition: BattleView.cpp:47
void processCommand(const Command &command)
Processes a command and updates the view.
Definition: BattleView.cpp:49
const std::string & chosenNickname() const
Returns the nickname the player entered.
Definition: BattleView.cpp:116
bool actionsCompleted() const
Returns true if the view is done going through the queued commands and all components are synchronize...
Definition: BattleView.cpp:42
BattleView(bl::engine::Engine &engine, BattleState &state, bool canRun)
Construct a new Battle View.
Definition: BattleView.cpp:11
Emitted by the BattleFSM. All UI is handled via a queue of commands. Commands are resolved in the ord...
Definition: Command.hpp:22
Helper utility for printing battle messages.
Utility for rendering move animations.
Helper for rendering peoplemon in battle and animating them.
The player menu for battles.
Definition: PlayerMenu.hpp:29
Renders both the player and opponent stat boxes.
Definition: StatBoxes.hpp:21