feat: go back in menu on Escape pressed
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include "graphics/core/ImageData.hpp"
|
||||
#include "graphics/core/Shader.hpp"
|
||||
#include "graphics/ui/GUI.hpp"
|
||||
#include "graphics/ui/elements/Menu.hpp"
|
||||
#include "objects/rigging.hpp"
|
||||
#include "logic/EngineController.hpp"
|
||||
#include "logic/CommandsInterpreter.hpp"
|
||||
@@ -154,6 +155,14 @@ void Engine::initializeClient() {
|
||||
},
|
||||
true
|
||||
));
|
||||
|
||||
keepAlive(this->input->addKeyCallback(Keycode::ESCAPE, [this]() {
|
||||
auto& menu = *gui->getMenu();
|
||||
if (menu.hasOpenPage() && menu.back()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}));
|
||||
}
|
||||
|
||||
void Engine::initialize(CoreParameters coreParameters) {
|
||||
|
||||
@@ -57,7 +57,7 @@ DocumentNode get_document_node(lua::State* L, int idx) {
|
||||
static int l_menu_back(lua::State* L) {
|
||||
auto node = get_document_node(L);
|
||||
if (auto menu = dynamic_cast<Menu*>(node.node.get())) {
|
||||
menu->back();
|
||||
return lua::pushboolean(L, menu->back());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user