1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-21 03:55:21 +02: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
25 changed files with 591 additions and 782 deletions

View File

@@ -12,6 +12,8 @@
#include <set>
#include <unordered_map>
#include "keycode.h"
#include "settings.h"
#include "util/string.h"
class InputHandler;
@@ -132,6 +134,13 @@ private:
class InputHandler
{
public:
InputHandler()
{
for (const auto &name: Settings::getLayer(SL_DEFAULTS)->getNames())
if (str_starts_with(name, "keymap_"))
g_settings->registerChangedCallback(name, &settingChangedCallback, this);
}
virtual ~InputHandler() = default;
virtual bool isRandom() const
@@ -163,6 +172,11 @@ public:
virtual void clear() {}
virtual void releaseAllKeys() {}
static void settingChangedCallback(const std::string &name, void *data)
{
static_cast<InputHandler *>(data)->reloadKeybindings();
}
JoystickController joystick;
};