Peoplemon  0.1.0
Peoplemon 3 game source documentation
Map.hpp
Go to the documentation of this file.
1 #ifndef EDITOR_PAGES_MAP_HPP
2 #define EDITOR_PAGES_MAP_HPP
3 
13 #include <Editor/Pages/Page.hpp>
19 
20 namespace editor
21 {
22 namespace page
23 {
29 class Map : public Page {
30 public:
37 
41  virtual ~Map() = default;
42 
48  virtual void update(float dt) override;
49 
53  void syncGui();
54 
55 private:
56  bl::gui::ComboBox::Ptr layerSelect;
57  bl::gui::ComboBox::Ptr levelSelect;
58 
59  bl::gui::TextEntry::Ptr nameEntry;
60  component::WeatherSelect::Ptr weatherEntry;
61  bl::gui::Label::Ptr playlistLabel;
62  bl::gui::Button::Ptr saveMapBut;
63 
64  bl::gui::CheckButton::Ptr sunlightBut;
65  component::LightSlider::Ptr minLightSlider;
66  component::LightSlider::Ptr maxLightSlider;
67  bl::gui::Button::Ptr lightingSetBut;
68 
69  bl::gui::Notebook::Ptr objectBook;
70  bl::gui::ComboBox::Ptr spawnDirEntry;
71  bl::gui::TextEntry::Ptr lightRadiusEntry;
72  bl::gui::RadioButton::Ptr lightCreateOrEdit;
73  bl::gui::RadioButton::Ptr lightRemove;
74  component::ItemSelector::Ptr itemSelector;
75 
76  bl::gui::RadioButton::Ptr createEventRadio;
77  bl::gui::RadioButton::Ptr editEventRadio;
78  bl::gui::RadioButton::Ptr deleteEventRadio;
79 
80  bl::gui::RadioButton::Ptr spawnCreate;
81  bl::gui::RadioButton::Ptr spawnRotate;
82  bl::gui::RadioButton::Ptr spawnDelete;
83 
84  bl::gui::RadioButton::Ptr npcSpawn;
85  bl::gui::RadioButton::Ptr npcEdit;
86  bl::gui::RadioButton::Ptr npcDelete;
87 
88  bl::gui::RadioButton::Ptr itemSpawn;
89  bl::gui::RadioButton::Ptr itemRead;
90  bl::gui::RadioButton::Ptr itemDelete;
91  bl::gui::CheckButton::Ptr itemHidden;
92 
93  bl::gui::Label::Ptr onEnterLabel;
94  bl::gui::Label::Ptr onExitLabel;
95 
96  component::WeatherSelect::Ptr tempWeatherEntry;
97  bl::gui::ComboBox::Ptr timeSetEntry;
98 
99  MapArea mapArea;
100  Tileset tileset;
101  Levels levelPage;
102  Layers layerPage;
103 
104  page::GameTesting testingTab;
105 
106  enum struct Tool { Metadata, MapEdit, Events, Spawns, NPCs, Items, Lights, Testing } activeTool;
107  enum struct Subtool { Set, Fill, Select, Clear, Add, Edit, Remove, None } activeSubtool;
108 
109  sf::IntRect selection;
110  enum SelectionState { NoSelection, Selecting, SelectionMade } selectionState;
111  void setSelectionState(SelectionState newState);
112 
113  bl::gui::FilePicker mapPicker;
114  bool makingNewMap;
115  void doLoadMap(const std::string& file);
116 
117  component::NewMapDialog newMapWindow;
118  void makeNewMap(const std::string& file, const std::string& name, const std::string& tileset,
119  unsigned int w, unsigned int h);
120 
121  component::PlaylistEditorWindow playlistEditor;
122  void onChoosePlaylist(const std::string& file);
123 
124  void syncLighting();
125  void onLightingChange();
126  void onLightingSave();
127  void onLightingReset();
128  void setLightingDefault();
129 
130  component::ScriptSelector scriptSelector;
131  bool choosingOnloadScript;
132  void onChooseScript(const std::string& script);
133 
134  component::EventEditor eventEditor;
135  void onEventEdit(const core::map::Event* orig, const core::map::Event& event);
136 
137  void onMapClick(const sf::Vector2f& pixels, const sf::Vector2i& tiles);
138  void onLevelChange(unsigned int level);
139 
140  component::CharacterSpawnWindow characterEditor;
141  void onCharacterEdit(const core::map::CharacterSpawn* orig,
142  const core::map::CharacterSpawn& spawn);
143 
144  component::RenderMapWindow renderMapWindow;
145  void startMapRender();
146  void doMapRender();
147 
148  bool checkUnsaved();
149 };
150 
151 } // namespace page
152 } // namespace editor
153 
154 #endif
All classes and functionality used for implementing the game editor.
Definition: Tile.hpp:11
Represents a character to be spawned into a map on load.
Represents an event in a Map. A script that is run on a trigger within a given region.
Definition: Event.hpp:19
Owns all primary systems and a reference to the engine.
Definition: Systems.hpp:47
std::shared_ptr< ItemSelector > Ptr
Pointer to this component.
std::shared_ptr< LightSlider > Ptr
Definition: LightSlider.hpp:19
std::shared_ptr< WeatherSelect > Ptr
Pointer to the weather selector.
Page for editing item names, descriptions, and values.
Definition: Items.hpp:19
Page for map editing. Tiles, levels, events, NPC's, weather, lighting, everything.
Definition: Map.hpp:29
Map(core::system::Systems &systems)
Construct a new Map page.
Definition: Map.cpp:21
virtual ~Map()=default
Destroy the Page.
void syncGui()
Updates the GUI elements to sync with the data.
Definition: Map.cpp:871
virtual void update(float dt) override
Updates the game world and systems.
Definition: Map.cpp:467
Base class for all editor pages.
Definition: Page.hpp:32
core::system::Systems & systems
Definition: Page.hpp:68
Subpage in the map editor for creating and testing game saves.
Definition: GameTesting.hpp:19
Provides controls to add, move, remove, and toggle visibility for layers.
Definition: Layers.hpp:17
Provides controls to add, move, remove, and toggle visibility for levels.
Definition: Levels.hpp:16
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