Peoplemon  0.1.0
Peoplemon 3 game source documentation
EventEditor.hpp
Go to the documentation of this file.
1 #ifndef EDITOR_COMPONENTS_EVENTEDITOR_HPP
2 #define EDITOR_COMPONENTS_EVENTEDITOR_HPP
3 
4 #include <BLIB/Interfaces/GUI.hpp>
5 #include <Core/Maps/Map.hpp>
7 
8 namespace editor
9 {
10 namespace component
11 {
18 class EventEditor {
19 public:
21  using OnEdit = std::function<void(const core::map::Event*, const core::map::Event&)>;
22 
28  EventEditor(const OnEdit& onEdit);
29 
37  void open(bl::gui::GUI* parent, const core::map::Event* source,
38  const sf::Vector2i& pos);
39 
40 private:
41  const OnEdit onEdit;
42  const core::map::Event* orig;
43  bl::gui::GUI* parent;
44  bl::gui::Window::Ptr window;
45  bl::gui::Label::Ptr scriptLabel;
46  bl::gui::TextEntry::Ptr xInput;
47  bl::gui::TextEntry::Ptr yInput;
48  bl::gui::TextEntry::Ptr wInput;
49  bl::gui::TextEntry::Ptr hInput;
50  bl::gui::ComboBox::Ptr triggerSelect;
51 
52  ScriptSelector scriptSelector;
53  void onScriptChosen(const std::string& s);
54 
55  bool valid() const;
56  core::map::Event makeEvent() const;
57 };
58 
59 } // namespace component
60 } // namespace editor
61 
62 #endif
All classes and functionality used for implementing the game editor.
Definition: Tile.hpp:11
Represents an event in a Map. A script that is run on a trigger within a given region.
Definition: Event.hpp:19
Map event editor dialog.
Definition: EventEditor.hpp:18
std::function< void(const core::map::Event *, const core::map::Event &)> OnEdit
Callback called when an event is created or modified.
Definition: EventEditor.hpp:21
void open(bl::gui::GUI *parent, const core::map::Event *source, const sf::Vector2i &pos)
Opens the dialog window and optionally populates with event info.
Definition: EventEditor.cpp:84
EventEditor(const OnEdit &onEdit)
Construct a new Event Editor dialog.
Definition: EventEditor.cpp:9
GUI component for selecting or writing scripts. Performs syntax validation as well.