mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
Migrate existing keycode-based keybindings (#16049)
Co-authored-by: grorp <gregor.parzefall@posteo.de> Co-authored-by: sfan5 <sfan5@live.de>
This commit is contained in:
parent
600763dffc
commit
57c1ab905c
13 changed files with 140 additions and 13 deletions
|
@ -1089,6 +1089,9 @@ void ModApiMainMenu::Initialize(lua_State *L, int top)
|
|||
API_FCT(open_dir);
|
||||
API_FCT(share_file);
|
||||
API_FCT(do_async_callback);
|
||||
|
||||
lua_pushboolean(L, g_first_run);
|
||||
lua_setfield(L, top, "is_first_run");
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
|
|
@ -35,11 +35,10 @@ int ModApiMenuCommon::l_irrlicht_device_supports_touch(lua_State *L)
|
|||
}
|
||||
|
||||
|
||||
int ModApiMenuCommon::l_are_keycodes_equal(lua_State *L)
|
||||
int ModApiMenuCommon::l_normalize_keycode(lua_State *L)
|
||||
{
|
||||
auto k1 = luaL_checkstring(L, 1);
|
||||
auto k2 = luaL_checkstring(L, 2);
|
||||
lua_pushboolean(L, KeyPress(k1) == KeyPress(k2));
|
||||
auto keystr = luaL_checkstring(L, 1);
|
||||
lua_pushstring(L, KeyPress(keystr).sym().c_str());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -49,7 +48,7 @@ void ModApiMenuCommon::Initialize(lua_State *L, int top)
|
|||
API_FCT(gettext);
|
||||
API_FCT(get_active_driver);
|
||||
API_FCT(irrlicht_device_supports_touch);
|
||||
API_FCT(are_keycodes_equal);
|
||||
API_FCT(normalize_keycode);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ private:
|
|||
static int l_gettext(lua_State *L);
|
||||
static int l_get_active_driver(lua_State *L);
|
||||
static int l_irrlicht_device_supports_touch(lua_State *L);
|
||||
static int l_are_keycodes_equal(lua_State *L);
|
||||
static int l_normalize_keycode(lua_State *L);
|
||||
|
||||
public:
|
||||
static void Initialize(lua_State *L, int top);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue