Peoplemon  0.1.0
Peoplemon 3 game source documentation
Catchables.hpp
Go to the documentation of this file.
1 #ifndef EDITOR_PAGES_SUBPAGES_CATCHABLES_HPP
2 #define EDITOR_PAGES_SUBPAGES_CATCHABLES_HPP
3 
4 #include <BLIB/Interfaces/GUI.hpp>
7 
8 namespace editor
9 {
10 namespace component
11 {
12 class EditMap;
13 }
14 
15 namespace page
16 {
23 class Catchables {
24 public:
33 
38  void setGUI(bl::gui::GUI* gui);
39 
44  bl::gui::Element::Ptr getContent();
45 
50  std::uint8_t selected() const;
51 
56  static sf::Color getColor(std::uint8_t index);
57 
62  void refresh();
63 
64 private:
65  bl::gui::GUI* gui;
66  component::EditMap& map;
68  bl::gui::Box::Ptr content;
69  bl::gui::ScrollArea::Ptr scrollRegion;
70  bl::gui::RadioButton::Ptr noCatchBut;
71  std::vector<bl::gui::Box::Ptr> rows;
72  std::uint8_t active;
73  std::uint8_t editing;
74 
75  enum RowAction { Edit, Remove, Select };
76  using RowSelect = std::function<void(const bl::gui::Box*, RowAction)>;
77 
78  bl::gui::Box::Ptr createRow(const core::map::CatchRegion& region, const RowSelect& oscb,
79  bl::gui::RadioButton::Group* group);
80  void rowClicked(const bl::gui::Box* row, RowAction action);
81  void refreshColors();
82  void onEdit();
83 };
84 
85 } // namespace page
86 } // namespace editor
87 
88 #endif
All classes and functionality used for implementing the game editor.
Definition: Tile.hpp:11
Represents a class of catchable peoplemon.
Definition: CatchRegion.hpp:18
Window that opens to edit a catch region in maps.
Wrapper over the core::Map class that is directly usable in a bl::gui::GUI.
Definition: EditMap.hpp:28
Editor subpage for selecting catch tiles to place.
Definition: Catchables.hpp:23
void setGUI(bl::gui::GUI *gui)
Sets the parent GUI object.
Definition: Catchables.cpp:53
void refresh()
Refreshes GUI elements.
Definition: Catchables.cpp:63
Catchables(component::EditMap &map)
Construct a new Catchables GUI.
Definition: Catchables.cpp:27
static sf::Color getColor(std::uint8_t index)
Returns the color to use for the given catch region.
Definition: Catchables.cpp:59
std::uint8_t selected() const
Returns the currently selected catch type.
Definition: Catchables.cpp:57
bl::gui::Element::Ptr getContent()
Returns the GUI element to pack.
Definition: Catchables.cpp:55