diff --git a/src/engine.cpp b/src/engine.cpp index 0b6e979b..a387cdb2 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -214,7 +214,7 @@ void Engine::setScreen(std::shared_ptr screen) { void Engine::setLanguage(std::string locale) { settings.ui.language = locale; langs::setup(paths->getResources(), locale, contentPacks); - menus::create_menus(this, gui->getMenu()); + menus::create_menus(this); } gui::GUI* Engine::getGUI() { diff --git a/src/frontend/gui/GUI.cpp b/src/frontend/gui/GUI.cpp index 114693d3..2007d5c7 100644 --- a/src/frontend/gui/GUI.cpp +++ b/src/frontend/gui/GUI.cpp @@ -26,7 +26,7 @@ GUI::GUI() { uicamera->perspective = false; uicamera->flipped = true; - menu = new PagesControl(); + menu = std::make_shared(); container->add(menu); container->scrollable(false); } @@ -36,7 +36,7 @@ GUI::~GUI() { delete container; } -PagesControl* GUI::getMenu() { +std::shared_ptr GUI::getMenu() { return menu; } diff --git a/src/frontend/gui/GUI.h b/src/frontend/gui/GUI.h index 6b8876f9..4cd272ef 100644 --- a/src/frontend/gui/GUI.h +++ b/src/frontend/gui/GUI.h @@ -59,13 +59,13 @@ namespace gui { std::unordered_map> storage; Camera* uicamera; - PagesControl* menu; + std::shared_ptr menu; void actMouse(float delta); public: GUI(); ~GUI(); - PagesControl* getMenu(); + std::shared_ptr getMenu(); std::shared_ptr getFocused() const; bool isFocusCaught() const; diff --git a/src/frontend/gui/controls.cpp b/src/frontend/gui/controls.cpp index b5fc5b65..2810cedd 100644 --- a/src/frontend/gui/controls.cpp +++ b/src/frontend/gui/controls.cpp @@ -20,6 +20,7 @@ Label::Label(std::string text, std::string fontName) : UINode(vec2(), vec2(text.length() * 8, 15)), text(util::str2wstr_utf8(text)), fontName_(fontName) { + setInteractive(false); } @@ -27,6 +28,7 @@ Label::Label(std::wstring text, std::string fontName) : UINode(vec2(), vec2(text.length() * 8, 15)), text(text), fontName_(fontName) { + setInteractive(false); } void Label::setText(std::wstring text) { @@ -314,7 +316,7 @@ void TextBox::text(std::wstring value) { InputBindBox::InputBindBox(Binding& binding, vec4 padding) : Panel(vec2(100,32), padding, 0, false), binding(binding) { - label = new Label(L""); + label = std::make_shared