Peoplemon  0.1.0
Peoplemon 3 game source documentation
Towns.hpp
Go to the documentation of this file.
1 #ifndef EDITOR_PAGES_SUBPAGES_TOWNS_HPP
2 #define EDITOR_PAGES_SUBPAGES_TOWNS_HPP
3 
4 #include <BLIB/Interfaces/GUI.hpp>
5 #include <Core/Maps/Town.hpp>
9 
10 namespace editor
11 {
12 namespace page
13 {
14 class MapArea;
15 
21 class Towns {
22 public:
29  Towns(bl::engine::Engine& engine, MapArea& map);
30 
34  bl::gui::Element::Ptr getContent();
35 
41  void setGUI(bl::gui::GUI* gui);
42 
46  std::uint8_t selected() const;
47 
51  static sf::Color getColor(std::uint8_t index);
52 
56  void refresh();
57 
58 private:
59  bl::engine::Engine& engine;
60  bl::gui::GUI* gui;
61  MapArea& mapArea;
62  component::EditMap& map;
63 
64  bl::gui::Box::Ptr content;
65  bl::gui::ScrollArea::Ptr scrollRegion;
66  bl::gui::RadioButton::Ptr noTownBut;
67  std::uint8_t active;
68  std::uint8_t editing;
69 
70  bl::gui::Window::Ptr window;
71  bl::gui::TextEntry::Ptr nameEntry;
72  bl::gui::TextEntry::Ptr descEntry;
73  bl::gui::Label::Ptr playlistLabel;
74  component::PlaylistEditorWindow playlistWindow;
75  component::WeatherSelect::Ptr weatherSelect;
76  bl::gui::ComboBox::Ptr spawnSelect;
77 
78  bl::rc::SceneRef scene;
79  bl::rc::res::TextureRef flymapTxtr;
80  bl::gfx::Sprite flyMap;
81  bl::gfx::Circle townCircle;
82  bl::gui::Canvas::Ptr mapPosCanvas;
83  sf::Vector2i mapPos;
84 
85  void refreshSpawns(std::uint16_t spawn);
86  void onPlaylistPick(const std::string& plst);
87  void takeFocus();
88  void closeWindow();
89 
90  void newTown();
91  void editTown(std::uint8_t i);
92  void onTownEdit();
93  void removeTown(std::uint8_t i);
94  bl::gui::Box::Ptr makeRow(std::uint8_t i, const std::string& town);
95 
96  void setMapPos(const bl::gui::Event& click);
97  void refreshFlymapCanvas();
98 };
99 
100 } // namespace page
101 } // namespace editor
102 
103 #endif
All classes and functionality used for implementing the game editor.
Definition: Tile.hpp:11
Wrapper over the core::Map class that is directly usable in a bl::gui::GUI.
Definition: EditMap.hpp:28
The playlist editor and chooser.
std::shared_ptr< WeatherSelect > Ptr
Pointer to the weather selector.
Section of the map area with the map itself and related controls.
Definition: MapArea.hpp:16
Subpage for creating, editing, deleting, and placing towns in maps.
Definition: Towns.hpp:21
bl::gui::Element::Ptr getContent()
Returns the GUI element to pack.
Definition: Towns.cpp:117
void refresh()
Refreshes the list of towns in the page.
Definition: Towns.cpp:125
void setGUI(bl::gui::GUI *gui)
Set the primary GUI object.
Definition: Towns.cpp:121
static sf::Color getColor(std::uint8_t index)
Returns the color to use for the given town.
Definition: Towns.cpp:123
std::uint8_t selected() const
Returns the currently selected town index.
Definition: Towns.cpp:119
Towns(bl::engine::Engine &engine, MapArea &map)
Creates the towns subpage and GUI elements.
Definition: Towns.cpp:19