diff --git a/data/modules/mainmenu/menustate.lua b/data/modules/mainmenu/menustate.lua index 830df232..2fbc9a26 100644 --- a/data/modules/mainmenu/menustate.lua +++ b/data/modules/mainmenu/menustate.lua @@ -16,6 +16,6 @@ end -- here is where everything starts if not initialStateLoaded then onEnterMenuState() - App.setOnClose(onApplicationClose) + App.onClose = onApplicationClose initialStateLoaded = true end diff --git a/data/modules/messagebox/messagebox.lua b/data/modules/messagebox/messagebox.lua index 44540e8b..307384c6 100644 --- a/data/modules/messagebox/messagebox.lua +++ b/data/modules/messagebox/messagebox.lua @@ -1,9 +1,11 @@ +function autoDestroyParent() + self.parent:destroy() +end + function messageBox(title, text) - local msgbox = UI.load("modules/messagebox/messagebox.yml") - local label = msgbox:getChildById("messageBoxLabel") - local okButton = msgbox:getChildById("messageBoxOkButton") - msgbox.locked = true - msgbox.title = title - label.text = text - okButton.onClick = function() msgbox:destroy() end + local msgBox = UI.load("modules/messagebox/messagebox.yml") + msgBox.locked = true + msgBox.title = title + msgBox:child("textLabel").text = text + msgBox:child("okButton").onClick = autoDestroyParent end diff --git a/data/modules/messagebox/messagebox.yml b/data/modules/messagebox/messagebox.yml index 640f9bd3..81a04e47 100644 --- a/data/modules/messagebox/messagebox.yml +++ b/data/modules/messagebox/messagebox.yml @@ -4,12 +4,12 @@ window#messageBoxWindow: anchors.verticalCenter: parent.verticalCenter - label#messageBoxLabel: + label#textLabel: anchors.horizontalCenter: parent.horizontalCenter anchors.top: parent.top margin.top: 27 - button#messageBoxOkButton: + button#okButton: text: Ok size: [43, 20] anchors.right: parent.right diff --git a/src/framework/core/configs.h b/src/framework/core/configs.h index 7d592883..ea27b3c3 100644 --- a/src/framework/core/configs.h +++ b/src/framework/core/configs.h @@ -44,7 +44,7 @@ public: void setValue(const std::string &key, bool value); void setValue(const std::string &key, int value); - const std::string &getString(const std::string &key) const; + const std::string& getString(const std::string &key) const; float getFloat(const std::string &key) const; bool getBoolean(const std::string &key) const; int getInteger(const std::string &key) const; diff --git a/src/framework/core/engine.cpp b/src/framework/core/engine.cpp index 0befc46d..f6b4dae0 100644 --- a/src/framework/core/engine.cpp +++ b/src/framework/core/engine.cpp @@ -30,6 +30,7 @@ #include #include #include +#include