mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
scripting.h fix + input library
This commit is contained in:
parent
f9dd865bee
commit
f02edcf15a
12 changed files with 121 additions and 34 deletions
26
src/logic/scripting/lua/libinput.cpp
Normal file
26
src/logic/scripting/lua/libinput.cpp
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#include "api_lua.h"
|
||||
#include "lua_commons.h"
|
||||
#include "../scripting.h"
|
||||
|
||||
#include "../../../window/input.h"
|
||||
#include "../../../window/Events.h"
|
||||
#include "../../../frontend/screens/Screen.hpp"
|
||||
#include "../../../engine.h"
|
||||
|
||||
#include "LuaState.h"
|
||||
|
||||
namespace scripting {
|
||||
extern lua::LuaState* state;
|
||||
}
|
||||
|
||||
static int l_keycode(lua_State* L) {
|
||||
const char* name = lua_tostring(L, 1);
|
||||
lua_pushinteger(L, static_cast<int>(input_util::keycode_from(name)));
|
||||
return 1;
|
||||
}
|
||||
|
||||
const luaL_Reg inputlib [] = {
|
||||
{"keycode", lua_wrap_errors<l_keycode>},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue