Peoplemon  0.1.0
Peoplemon 3 game source documentation
Tileset.hpp
Go to the documentation of this file.
1 #ifndef EDITOR_PAGES_SUBPAGES_TILESET_HPP
2 #define EDITOR_PAGES_SUBPAGES_TILESET_HPP
3 
4 #include <BLIB/Interfaces/GUI.hpp>
6 #include <Core/Maps/Tileset.hpp>
11 
12 namespace editor
13 {
14 namespace component
15 {
16 class EditMap;
17 }
18 class MapArea;
19 
20 namespace page
21 {
27 class Tileset {
28 public:
30  using DeleteCb = std::function<void(core::map::Tile::IdType, bool)>;
31 
39  Tileset(bl::engine::Engine& engine, const DeleteCb& deleteCb, MapArea& map);
40 
47  bool loadTileset(const std::string& tileset);
48 
52  void setGUI(bl::gui::GUI* gui);
53 
57  bl::gui::Element::Ptr getContent();
58 
62  Active getActiveTool() const;
63 
68 
73 
78 
82  std::uint8_t getActiveCatch() const;
83 
87  std::uint8_t getActiveTown() const;
88 
93 
97  bool unsavedChanges() const;
98 
102  void markSaved();
103 
107  void refresh();
108 
109 private:
110  const DeleteCb deleteCb;
111  bl::resource::Ref<core::map::Tileset> tileset;
112 
113  bl::gui::Notebook::Ptr content;
114  bl::gui::Box::Ptr tilesBox;
115  bl::gui::Box::Ptr animsBox;
116 
117  Collisions collisions;
118  Catchables catchables;
119  Towns towns;
120  LevelTransitions levelTransitions;
121 
122  Active tool;
123  core::map::Tile::IdType activeTile;
124  core::map::Tile::IdType activeAnim;
125  bool dirty;
126 
127  void updateGui();
128 };
129 
130 } // namespace page
131 } // namespace editor
132 
133 #endif
Collision
The different types of collisions in maps.
Definition: Collision.hpp:16
LevelTransition
Represents a level transition in a map. Level transitions are applied when an entity moves either ont...
All classes and functionality used for implementing the game editor.
Definition: Tile.hpp:11
std::uint16_t IdType
Definition: Tile.hpp:33
Editor subpage for selecting catch tiles to place.
Definition: Catchables.hpp:23
Editor subpage for selecting collisions to apply.
Definition: Collisions.hpp:17
Subpage for selecting level transitions to place on the map.
Section of the map area with the map itself and related controls.
Definition: MapArea.hpp:16
Subpage for tileset editing and use. Used by the map editor page.
Definition: Tileset.hpp:27
void markSaved()
Marks the tileset clean.
Definition: Tileset.cpp:250
std::uint8_t getActiveCatch() const
Returns the active catch type.
Definition: Tileset.cpp:187
Tileset(bl::engine::Engine &engine, const DeleteCb &deleteCb, MapArea &map)
Creates the GUI elements.
Definition: Tileset.cpp:32
Active getActiveTool() const
Returns what is currently selected as the active edit type.
Definition: Tileset.cpp:179
bool unsavedChanges() const
Returns whether or not the tileset is in a dirty state.
Definition: Tileset.cpp:248
core::map::LevelTransition getActiveLevel() const
Returns the actively selected level transition type.
Definition: Tileset.cpp:191
bool loadTileset(const std::string &tileset)
Loads the given tileset and updates the GUI elements.
Definition: Tileset.cpp:193
void refresh()
Refreshes the GUI.
Definition: Tileset.cpp:252
void setGUI(bl::gui::GUI *gui)
Sets the parent GUI object.
Definition: Tileset.cpp:172
bl::gui::Element::Ptr getContent()
Returns the gui element to pack.
Definition: Tileset.cpp:177
core::map::Tile::IdType getActiveAnim() const
Returns the id of the active animation.
Definition: Tileset.cpp:183
core::map::Tile::IdType getActiveTile() const
Returns the id of the active tile.
Definition: Tileset.cpp:181
std::function< void(core::map::Tile::IdType, bool)> DeleteCb
Definition: Tileset.hpp:30
std::uint8_t getActiveTown() const
Returns the currently selected town.
Definition: Tileset.cpp:189
core::map::Collision getActiveCollision() const
Returns the active collision type.
Definition: Tileset.cpp:185
Subpage for creating, editing, deleting, and placing towns in maps.
Definition: Towns.hpp:21