Implement keychange/touchscreenlayout, don't implement filepicker
This commit is contained in:
parent
277acd59dc
commit
4f8784c789
@ -249,8 +249,10 @@ local function make_path(setting)
|
||||
}
|
||||
end
|
||||
|
||||
if PLATFORM == "Android" then
|
||||
if PLATFORM == "Android" or INIT == "pause_menu" then
|
||||
-- The Irrlicht file picker doesn't work on Android.
|
||||
-- Access to the Irrlicht file picker isn't implemented in the pause menu
|
||||
-- since we want to delete it anyway, so any time spent on it would be wasted.
|
||||
make.path = make.string
|
||||
make.filepath = make.string
|
||||
else
|
||||
|
@ -37,5 +37,6 @@ set(client_SCRIPT_LUA_API_SRCS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/l_menu_common.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/l_minimap.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/l_particles_local.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/l_pause_menu.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/l_storage.cpp
|
||||
PARENT_SCOPE)
|
||||
|
28
src/script/lua_api/l_pause_menu.cpp
Normal file
28
src/script/lua_api/l_pause_menu.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
// Luanti
|
||||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
// Copyright (C) 2025 grorp
|
||||
|
||||
#include "l_pause_menu.h"
|
||||
#include "gui/mainmenumanager.h"
|
||||
#include "lua_api/l_internal.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();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void ModApiPauseMenu::Initialize(lua_State *L, int top)
|
||||
{
|
||||
API_FCT(show_keys_menu);
|
||||
API_FCT(show_touchscreen_layout);
|
||||
}
|
17
src/script/lua_api/l_pause_menu.h
Normal file
17
src/script/lua_api/l_pause_menu.h
Normal file
@ -0,0 +1,17 @@
|
||||
// Luanti
|
||||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
// Copyright (C) 2025 grorp
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "l_base.h"
|
||||
|
||||
class ModApiPauseMenu: public ModApiBase
|
||||
{
|
||||
private:
|
||||
static int l_show_keys_menu(lua_State *L);
|
||||
static int l_show_touchscreen_layout(lua_State *L);
|
||||
|
||||
public:
|
||||
static void Initialize(lua_State *L, int top);
|
||||
};
|
@ -31,6 +31,7 @@ static inline int checkSettingSecurity(lua_State* L, const std::string &name)
|
||||
{
|
||||
#if CHECK_CLIENT_BUILD()
|
||||
// Main menu is allowed everything
|
||||
// TODO: also permit pause menu
|
||||
if (ModApiBase::getGuiEngine(L) != nullptr)
|
||||
return 0;
|
||||
#endif
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "filesys.h"
|
||||
#include "lua_api/l_client_common.h"
|
||||
#include "lua_api/l_menu_common.h"
|
||||
#include "lua_api/l_pause_menu.h"
|
||||
#include "lua_api/l_settings.h"
|
||||
#include "lua_api/l_util.h"
|
||||
#include "porting.h"
|
||||
@ -41,6 +42,7 @@ void PauseMenuScripting::initializeModApi(lua_State *L, int top)
|
||||
LuaSettings::Register(L);
|
||||
|
||||
// Initialize mod API modules
|
||||
ModApiPauseMenu::Initialize(L, top);
|
||||
ModApiMenuCommon::Initialize(L, top);
|
||||
ModApiClientCommon::Initialize(L, top);
|
||||
ModApiUtil::Initialize(L, top);
|
||||
|
Loading…
Reference in New Issue
Block a user