1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-20 03:35:18 +02:00

In-game settings menu using separate Lua environment (#15614)

This commit is contained in:
grorp
2025-01-19 13:07:04 -05:00
committed by GitHub
parent 3cb07d5fb6
commit eeb6cab4c4
48 changed files with 652 additions and 290 deletions

View File

@@ -4,8 +4,10 @@
#pragma once
#include <memory>
#include <string>
#include "irr_v3d.h"
#include "scripting_pause_menu.h"
class Client;
class RenderingEngine;
@@ -22,20 +24,19 @@ It includes:
*/
struct GameFormSpec
{
void init(Client *client, RenderingEngine *rendering_engine, InputHandler *input)
{
m_client = client;
m_rendering_engine = rendering_engine;
m_input = input;
}
void init(Client *client, RenderingEngine *rendering_engine, InputHandler *input);
~GameFormSpec();
void showFormSpec(const std::string &formspec, const std::string &formname);
void showLocalFormSpec(const std::string &formspec, const std::string &formname);
void showCSMFormSpec(const std::string &formspec, const std::string &formname);
// Used by the Lua pause menu environment to show formspecs.
// Currently only used for the in-game settings menu.
void showPauseMenuFormSpec(const std::string &formspec, const std::string &formname);
void showNodeFormspec(const std::string &formspec, const v3s16 &nodepos);
void showPlayerInventory();
void showDeathFormspecLegacy();
// Shows the hardcoded "main" pause menu.
void showPauseMenu();
void update();
@@ -52,11 +53,14 @@ private:
Client *m_client;
RenderingEngine *m_rendering_engine;
InputHandler *m_input;
std::unique_ptr<PauseMenuScripting> m_pause_script;
// Default: "". If other than "": Empty show_formspec packets will only
// close the formspec when the formname matches
std::string m_formname;
GUIFormSpecMenu *m_formspec = nullptr;
bool handleEmptyFormspec(const std::string &formspec, const std::string &formname);
void deleteFormspec();
};