18 : State(
bl::engine::StateMask::Editor)
21 , variousEditorsPage(s)
27 , currentPage(&mapPage) {
28 gui = bl::gui::GUI::create(
30 s.
engine().renderer().getObserver(),
31 bl::gui::LinePacker::create(bl::gui::LinePacker::Vertical, 4, bl::gui::LinePacker::Compact),
34 static_cast<float>(s.engine().window().getSfWindow().getSize().x),
35 static_cast<float>(s.engine().window().getSfWindow().getSize().y)});
47 notebook = bl::gui::Notebook::create();
48 notebook->setOutlineThickness(0.f);
50 notebook->addPage(
"maps",
"Maps", mapPage.
getContent(), [
this]() { currentPage = &mapPage; });
51 notebook->addPage(
"editors",
"Various Editors", variousEditorsPage.
getContent(), [
this]() {
52 currentPage = &variousEditorsPage;
55 "script",
"Scripts", scriptPage.
getContent(), [
this]() { currentPage = &scriptPage; });
56 notebook->addPage(
"peoplemon",
"Peoplemon DB", peoplemonPage.
getContent(), [
this]() {
57 currentPage = &peoplemonPage;
60 "moves",
"Move DB", movesPage.
getContent(), [
this]() { currentPage = &movesPage; });
62 "items",
"Item DB", itemsPage.
getContent(), [
this]() { currentPage = &itemsPage; });
64 "credits",
"Credits", creditsPage.
getContent(), [
this]() { currentPage = &creditsPage; });
66 gui->pack(notebook,
true,
true);
72 engine.renderer().getObserver().pushScene<bl::rc::Overlay>();
73 engine.renderer().getObserver().setClearColor(bl::sfcol(sf::Color{90, 90, 90}));
75 bl::event::Dispatcher::subscribe(
this);
79 gui->removeFromScene();
80 engine.renderer().getObserver().popScene();
81 bl::event::Dispatcher::unsubscribe(
this);
89 void MainEditor::observe(
const sf::Event& event) {
90 if (event.type == sf::Event::Resized) {
93 static_cast<float>(
event.size.width),
94 static_cast<float>(event.size.height)});
99 using namespace component;
100 auto& table = bl::gui::rdr::FactoryTable::getDefaultTable();
102 table.registerFactoryForElement<HighlightRadioButton, rdr::HighlightRadioButtonComponent>();
103 table.registerFactoryForElement<ConversationTree, rdr::ConversationTreeComponent>();
104 table.registerFactoryForElement<EditMap, rdr::EditMapComponent>();
All classes and functionality used for implementing the game editor.
Owns all primary systems and a reference to the engine.
const bl::engine::Engine & engine() const
Const accessor for the Engine.
void syncGui()
Updates the GUI elements to sync with the data.
virtual void update(float dt)=0
Any custom page update logic outside of event callbacks goes here.
bl::gui::Box::Ptr getContent()
Returns the content to put in the editor.
void registerGui(bl::gui::GUI *parent)
Registers the parent GUI.
The primary state of the editor. Owns the GUI and all tabs.
virtual void deactivate(bl::engine::Engine &) override
Unsubscribes the gui from window events.
virtual void update(bl::engine::Engine &, float dt, float) override
Updates the gui and the current page.
virtual const char * name() const override
Returns "MainEditor".
virtual void activate(bl::engine::Engine &) override
Subscribes the gui to window events.
static Ptr create(core::system::Systems &systems)
Construct a new Main Editor state.
static void registerCustomGuiComponents()
Registers renderer components for custom GUI elements.