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 <string>
8#include "irr_v3d.h"
9
10class Client;
11class RenderingEngine;
12class InputHandler;
13class ISoundManager;
14class GUIFormSpecMenu;
15
16/*
17This object intend to contain the core fromspec functionality.
18It includes:
19 - methods to show specific formspec menus
20 - storing the opened fromspec
21 - handling fromspec related callbacks
22 */
24{
25 void init(Client *client, RenderingEngine *rendering_engine, InputHandler *input)
26 {
28 m_rendering_engine = rendering_engine;
29 m_input = input;
30 }
31
33
34 void showFormSpec(const std::string &formspec, const std::string &formname);
35 void showLocalFormSpec(const std::string &formspec, const std::string &formname);
36 void showNodeFormspec(const std::string &formspec, const v3s16 &nodepos);
39 void showPauseMenu();
40
41 void update();
42 void disableDebugView();
43
44 bool handleCallbacks();
45
46#ifdef __ANDROID__
47 // Returns false if no formspec open
48 bool handleAndroidUIInput();
49#endif
50
51private:
55
56 // Default: "". If other than "": Empty show_formspec packets will only
57 // close the formspec when the formname matches
58 std::string m_formname;
60
61 void deleteFormspec();
62};
Definition client.h:104
Definition guiFormSpecMenu.h:87
Definition sound.h:46
Definition inputhandler.h:222
Definition renderingengine.h:68
core::vector3d< s16 > v3s16
Definition irr_v3d.h:13
Definition activeobjectmgr.cpp:11
Definition game_formspec.h:24
void showNodeFormspec(const std::string &formspec, const v3s16 &nodepos)
Definition game_formspec.cpp:240
void disableDebugView()
Definition game_formspec.cpp:459
void showLocalFormSpec(const std::string &formspec, const std::string &formname)
Definition game_formspec.cpp:230
bool handleCallbacks()
Definition game_formspec.cpp:468
void init(Client *client, RenderingEngine *rendering_engine, InputHandler *input)
Definition game_formspec.h:25
GUIFormSpecMenu * m_formspec
Definition game_formspec.h:59
std::string m_formname
Definition game_formspec.h:58
~GameFormSpec()
Definition game_formspec.cpp:205
void showDeathFormspecLegacy()
Definition game_formspec.cpp:408
void showFormSpec(const std::string &formspec, const std::string &formname)
Definition game_formspec.cpp:211
void showPauseMenu()
Definition game_formspec.cpp:298
void showPlayerInventory()
Definition game_formspec.cpp:259
void update()
Definition game_formspec.cpp:430
RenderingEngine * m_rendering_engine
Definition game_formspec.h:53
void deleteFormspec()
Definition game_formspec.cpp:196
InputHandler * m_input
Definition game_formspec.h:54
Client * m_client
Definition game_formspec.h:52