1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Get rid of guiroot

The guienvironment already provides a root gui element, we don't need to add another one.
(For CGUIEnvironment, the env itself is the root element.)
This commit is contained in:
Desour 2023-08-09 02:21:29 +02:00 committed by sfan5
parent 7e7aceb8c1
commit 45e7a80057
5 changed files with 12 additions and 18 deletions

View file

@ -42,7 +42,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
/* mainmenumanager.h
*/
gui::IGUIEnvironment *guienv = nullptr;
gui::IGUIStaticText *guiroot = nullptr;
MainMenuManager g_menumgr;
bool isMenuActive()
@ -218,14 +217,6 @@ bool ClientLauncher::run(GameStartData &start_data, const Settings &cmd_args)
m_rendering_engine->get_gui_env()->clear();
/*
We need some kind of a root node to be able to add
custom gui elements directly on the screen.
Otherwise they won't be automatically drawn.
*/
guiroot = m_rendering_engine->get_gui_env()->addStaticText(L"",
core::rect<s32>(0, 0, 10000, 10000));
bool game_has_run = launch_game(error_message, reconnect_requested,
start_data, cmd_args);
@ -556,7 +547,8 @@ void ClientLauncher::main_menu(MainMenuData *menudata)
#endif
/* show main menu */
GUIEngine mymenu(&input->joystick, guiroot, m_rendering_engine, &g_menumgr, menudata, *kill);
GUIEngine mymenu(&input->joystick, m_rendering_engine->get_gui_env()->getRootGUIElement(),
m_rendering_engine, &g_menumgr, menudata, *kill);
/* leave scene manager in a clean state */
m_rendering_engine->get_scene_manager()->clear();