core.get_bindings
This commit is contained in:
@@ -66,9 +66,10 @@ static void create_controls_panel(Engine* engine) {
|
|||||||
panel->add(trackbar);
|
panel->add(trackbar);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto scrollPanel = std::make_shared<Panel>(glm::vec2(400, 200), glm::vec4(2.0f), 1.0f);
|
auto scrollPanel = std::dynamic_pointer_cast<Panel>(guiutil::create(
|
||||||
scrollPanel->setColor(glm::vec4(0.0f, 0.0f, 0.0f, 0.3f));
|
"<panel size='400,200' padding='2' interval='1' max-length='400' color='#0000004C'>"
|
||||||
scrollPanel->setMaxLength(400);
|
"</panel>"
|
||||||
|
));
|
||||||
for (auto& entry : Events::bindings){
|
for (auto& entry : Events::bindings){
|
||||||
std::string bindname = entry.first;
|
std::string bindname = entry.first;
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include "../../../frontend/menu/menu.h"
|
#include "../../../frontend/menu/menu.h"
|
||||||
#include "../../../frontend/screens.h"
|
#include "../../../frontend/screens.h"
|
||||||
#include "../../../logic/LevelController.h"
|
#include "../../../logic/LevelController.h"
|
||||||
|
#include "../../../window/Events.h"
|
||||||
#include "../../../window/Window.h"
|
#include "../../../window/Window.h"
|
||||||
#include "../scripting.h"
|
#include "../scripting.h"
|
||||||
|
|
||||||
@@ -52,6 +53,19 @@ static int l_delete_world(lua_State* L) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int l_get_bindings(lua_State* L) {
|
||||||
|
auto& bindings = Events::bindings;
|
||||||
|
lua_createtable(L, bindings.size(), 0);
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
for (auto& entry : bindings) {
|
||||||
|
lua_pushstring(L, entry.first.c_str());
|
||||||
|
lua_rawseti(L, -2, i + 1);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static int l_quit(lua_State* L) {
|
static int l_quit(lua_State* L) {
|
||||||
Window::setShouldClose(true);
|
Window::setShouldClose(true);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -62,6 +76,7 @@ const luaL_Reg corelib [] = {
|
|||||||
{"open_world", lua_wrap_errors<l_open_world>},
|
{"open_world", lua_wrap_errors<l_open_world>},
|
||||||
{"close_world", lua_wrap_errors<l_close_world>},
|
{"close_world", lua_wrap_errors<l_close_world>},
|
||||||
{"delete_world", lua_wrap_errors<l_delete_world>},
|
{"delete_world", lua_wrap_errors<l_delete_world>},
|
||||||
|
{"get_bindings", lua_wrap_errors<l_get_bindings>},
|
||||||
{"quit", lua_wrap_errors<l_quit>},
|
{"quit", lua_wrap_errors<l_quit>},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user