Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
game_formspec.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2024 cx384
4
5#pragma once
6
7#include <memory>
8#include <string>
9#include "irr_v3d.h"
11
12class Client;
13class RenderingEngine;
14class InputHandler;
15class ISoundManager;
16class GUIFormSpecMenu;
17
18/*
19This object intend to contain the core fromspec functionality.
20It includes:
21 - methods to show specific formspec menus
22 - storing the opened fromspec
23 - handling fromspec related callbacks
24 */
26{
27 void init(Client *client, RenderingEngine *rendering_engine, InputHandler *input);
28
30
31 void showFormSpec(const std::string &formspec, const std::string &formname);
32 void showCSMFormSpec(const std::string &formspec, const std::string &formname);
33 // Used by the Lua pause menu environment to show formspecs.
34 // Currently only used for the in-game settings menu.
35 void showPauseMenuFormSpec(const std::string &formspec, const std::string &formname);
36 void showNodeFormspec(const std::string &formspec, const v3s16 &nodepos);
39 // Shows the hardcoded "main" pause menu.
40 void showPauseMenu();
41
42 void update();
43 void disableDebugView();
44
45 bool handleCallbacks();
46
47#ifdef __ANDROID__
48 // Returns false if no formspec open
49 bool handleAndroidUIInput();
50#endif
51
52private:
56 std::unique_ptr<PauseMenuScripting> m_pause_script;
57
58 // Default: "". If other than "": Empty show_formspec packets will only
59 // close the formspec when the formname matches
60 std::string m_formname;
62
63 bool handleEmptyFormspec(const std::string &formspec, const std::string &formname);
64
65 void deleteFormspec();
66};
Definition client.h:104
Definition guiFormSpecMenu.h:87
Definition sound.h:46
Definition inputhandler.h:223
Definition renderingengine.h:68
core::vector3d< s16 > v3s16
Definition irr_v3d.h:13
Definition activeobjectmgr.cpp:11
Definition game_formspec.h:26
void showNodeFormspec(const std::string &formspec, const v3s16 &nodepos)
Definition game_formspec.cpp:291
void showCSMFormSpec(const std::string &formspec, const std::string &formname)
Definition game_formspec.cpp:252
void disableDebugView()
Definition game_formspec.cpp:505
bool handleCallbacks()
Definition game_formspec.cpp:514
void init(Client *client, RenderingEngine *rendering_engine, InputHandler *input)
Definition game_formspec.cpp:201
bool handleEmptyFormspec(const std::string &formspec, const std::string &formname)
Definition game_formspec.cpp:225
GUIFormSpecMenu * m_formspec
Definition game_formspec.h:61
std::string m_formname
Definition game_formspec.h:60
~GameFormSpec()
Definition game_formspec.cpp:219
void showDeathFormspecLegacy()
Definition game_formspec.cpp:454
void showFormSpec(const std::string &formspec, const std::string &formname)
Definition game_formspec.cpp:236
void showPauseMenu()
Definition game_formspec.cpp:349
void showPlayerInventory()
Definition game_formspec.cpp:310
std::unique_ptr< PauseMenuScripting > m_pause_script
Definition game_formspec.h:56
void showPauseMenuFormSpec(const std::string &formspec, const std::string &formname)
Definition game_formspec.cpp:267
void update()
Definition game_formspec.cpp:476
RenderingEngine * m_rendering_engine
Definition game_formspec.h:54
void deleteFormspec()
Definition game_formspec.cpp:210
InputHandler * m_input
Definition game_formspec.h:55
Client * m_client
Definition game_formspec.h:53