1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-01 17:38:41 +00:00

Move keybinding settings to (Lua-based) setting menu (#15791)

This commit is contained in:
y5nw 2025-04-20 20:20:49 +02:00 committed by GitHub
parent c1d2124102
commit 23bfb2db72
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 591 additions and 782 deletions

View file

@ -9,7 +9,6 @@
#include "scripting_mainmenu.h"
#include "gui/guiEngine.h"
#include "gui/guiMainMenu.h"
#include "gui/guiKeyChangeMenu.h"
#include "gui/guiPathSelectMenu.h"
#include "gui/touchscreeneditor.h"
#include "version.h"
@ -538,22 +537,6 @@ int ModApiMainMenu::l_get_content_translation(lua_State *L)
return 1;
}
/******************************************************************************/
int ModApiMainMenu::l_show_keys_menu(lua_State *L)
{
GUIEngine *engine = getGuiEngine(L);
sanity_check(engine != NULL);
GUIKeyChangeMenu *kmenu = new GUIKeyChangeMenu(
engine->m_rendering_engine->get_gui_env(),
engine->m_parent,
-1,
engine->m_menumanager,
engine->m_texture_source.get());
kmenu->drop();
return 0;
}
/******************************************************************************/
int ModApiMainMenu::l_show_touchscreen_layout(lua_State *L)
{
@ -1070,7 +1053,6 @@ void ModApiMainMenu::Initialize(lua_State *L, int top)
API_FCT(get_content_translation);
API_FCT(start);
API_FCT(close);
API_FCT(show_keys_menu);
API_FCT(show_touchscreen_layout);
API_FCT(create_world);
API_FCT(delete_world);

View file

@ -65,8 +65,6 @@ private:
//gui
static int l_show_keys_menu(lua_State *L);
static int l_show_touchscreen_layout(lua_State *L);
static int l_show_path_select_dialog(lua_State *L);

View file

@ -35,11 +35,21 @@ int ModApiMenuCommon::l_irrlicht_device_supports_touch(lua_State *L)
}
int ModApiMenuCommon::l_are_keycodes_equal(lua_State *L)
{
auto k1 = luaL_checkstring(L, 1);
auto k2 = luaL_checkstring(L, 2);
lua_pushboolean(L, KeyPress(k1) == KeyPress(k2));
return 1;
}
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);
}

View file

@ -13,6 +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);
public:
static void Initialize(lua_State *L, int top);

View file

@ -3,18 +3,12 @@
// Copyright (C) 2025 grorp
#include "l_pause_menu.h"
#include "client/keycode.h"
#include "gui/mainmenumanager.h"
#include "lua_api/l_internal.h"
#include "client/client.h"
int ModApiPauseMenu::l_show_keys_menu(lua_State *L)
{
g_gamecallback->keyConfig();
return 0;
}
int ModApiPauseMenu::l_show_touchscreen_layout(lua_State *L)
{
g_gamecallback->touchscreenLayout();
@ -31,7 +25,6 @@ int ModApiPauseMenu::l_is_internal_server(lua_State *L)
void ModApiPauseMenu::Initialize(lua_State *L, int top)
{
API_FCT(show_keys_menu);
API_FCT(show_touchscreen_layout);
API_FCT(is_internal_server);
}

View file

@ -9,7 +9,6 @@
class ModApiPauseMenu: public ModApiBase
{
private:
static int l_show_keys_menu(lua_State *L);
static int l_show_touchscreen_layout(lua_State *L);
static int l_is_internal_server(lua_State *L);