Peoplemon  0.1.0
Peoplemon 3 game source documentation
MapArea.hpp
Go to the documentation of this file.
1 #ifndef EDITOR_PAGES_SUBPAGES_MAPAREA_HPP
2 #define EDITOR_PAGES_SUBPAGES_MAPAREA_HPP
3 
6 
7 namespace editor
8 {
9 namespace page
10 {
16 class MapArea : public bl::event::Listener<event::MapRenderCompleted, event::MapRenderStarted> {
17 public:
26  const component::EditMap::ActionCb& syncCb, core::system::Systems& systems);
27 
32 
36  bl::gui::Element::Ptr getContent();
37 
41  void enableControls();
42 
46  void disableControls();
47 
48 private:
49  const component::EditMap::PositionCb onClick;
50  bl::gui::Box::Ptr content;
51  bl::gui::Label::Ptr positionLabel;
52  bl::gui::Button::Ptr undoBut;
53  bl::gui::Button::Ptr redoBut;
54  bl::gui::CheckButton::Ptr enableBut;
55  bl::gui::CheckButton::Ptr dragBut;
57  sf::Vector2i lastDragTile;
58 
59  void refreshButtons();
60  void onMouseOver(const sf::Vector2f& pixels, const sf::Vector2i& tiles);
61 
62  virtual void observe(const event::MapRenderStarted&) override;
63  virtual void observe(const event::MapRenderCompleted&) override;
64 };
65 
66 } // namespace page
67 } // namespace editor
68 
69 #endif
All classes and functionality used for implementing the game editor.
Definition: Tile.hpp:11
Owns all primary systems and a reference to the engine.
Definition: Systems.hpp:47
Wrapper over the core::Map class that is directly usable in a bl::gui::GUI.
Definition: EditMap.hpp:28
std::function< void(const sf::Vector2f &pixels, const sf::Vector2i &tiles)> PositionCb
Called when the map is clicked.
Definition: EditMap.hpp:34
std::function< void()> ActionCb
Called on various event types.
Definition: EditMap.hpp:37
std::shared_ptr< EditMap > Ptr
Pointer to an EditMap.
Definition: EditMap.hpp:31
Fired when a map rendering is started.
Definition: MapRender.hpp:19
Fired when a map rendering is complete.
Definition: MapRender.hpp:26
Section of the map area with the map itself and related controls.
Definition: MapArea.hpp:16
bl::gui::Element::Ptr getContent()
Returns the GUI element to pack.
Definition: MapArea.cpp:67
void enableControls()
Enables the map controls.
Definition: MapArea.cpp:102
MapArea(const component::EditMap::PositionCb &clickCb, const component::EditMap::ActionCb &syncCb, core::system::Systems &systems)
Construct a new Map Area.
Definition: MapArea.cpp:9
component::EditMap & editMap()
Returns the contained map.
Definition: MapArea.cpp:65
void disableControls()
Disables the map controls when a dialog is opened or the map tab is inactive.
Definition: MapArea.cpp:107