Luanti 5.15.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 GUIFormSpecMenu;
16
17/*
18This object intend to contain the core fromspec functionality.
19It includes:
20 - methods to show specific formspec menus
21 - storing the opened fromspec
22 - handling fromspec related callbacks
23 */
25{
26 void init(Client *client, RenderingEngine *rendering_engine, InputHandler *input);
27
29
30 void showFormSpec(const std::string &formspec, const std::string &formname);
31 void showCSMFormSpec(const std::string &formspec, const std::string &formname);
32 // Used by the Lua pause menu environment to show formspecs.
33 // Currently only used for the in-game settings menu.
34 void showPauseMenuFormSpec(const std::string &formspec, const std::string &formname);
35 void showNodeFormspec(const std::string &formspec, const v3s16 &nodepos);
38 void showPlayerInventory(const std::string *fs_override);
40 // Shows the hardcoded "main" pause menu.
41 void showPauseMenu();
42
43 void update();
44 void disableDebugView();
45
46 bool handleCallbacks();
47 void reset();
48
49#ifdef __ANDROID__
50 // Returns false if no formspec open
51 bool handleAndroidUIInput();
52#endif
53
54private:
58 std::unique_ptr<PauseMenuScripting> m_pause_script;
59
64
65 bool handleEmptyFormspec(const std::string &formspec, const std::string &formname);
66
67 void deleteFormspec();
68};
Definition client.h:106
Definition guiFormSpecMenu.h:86
Definition inputhandler.h:137
Definition renderingengine.h:64
core::vector3d< s16 > v3s16
Definition irr_v3d.h:13
Definition activeobjectmgr.cpp:11
Definition game_formspec.h:25
void reset()
Definition game_formspec.cpp:215
void showNodeFormspec(const std::string &formspec, const v3s16 &nodepos)
Definition game_formspec.cpp:294
void showCSMFormSpec(const std::string &formspec, const std::string &formname)
Definition game_formspec.cpp:252
void disableDebugView()
Definition game_formspec.cpp:514
bool handleCallbacks()
Definition game_formspec.cpp:523
void init(Client *client, RenderingEngine *rendering_engine, InputHandler *input)
Definition game_formspec.cpp:195
bool handleEmptyFormspec(const std::string &formspec, const std::string &formname)
Definition game_formspec.cpp:222
GUIFormSpecMenu * m_formspec
The currently open formspec that is not a submenu of the pause menu FIXME: Layering is already manage...
Definition game_formspec.h:63
~GameFormSpec()
Definition game_formspec.h:28
void showDeathFormspecLegacy()
Definition game_formspec.cpp:463
void showFormSpec(const std::string &formspec, const std::string &formname)
Definition game_formspec.cpp:235
void showPauseMenu()
Definition game_formspec.cpp:358
std::unique_ptr< PauseMenuScripting > m_pause_script
Definition game_formspec.h:58
void showPauseMenuFormSpec(const std::string &formspec, const std::string &formname)
Definition game_formspec.cpp:267
void showPlayerInventory(const std::string *fs_override)
If !fs_override: Uses player->inventory_formspec.
Definition game_formspec.cpp:312
void update()
Definition game_formspec.cpp:485
RenderingEngine * m_rendering_engine
Definition game_formspec.h:56
void deleteFormspec()
Definition game_formspec.cpp:207
InputHandler * m_input
Definition game_formspec.h:57
Client * m_client
Definition game_formspec.h:55