mirror of
https://github.com/minetest/minetest.git
synced 2024-12-25 07:32:24 +01:00
Revert "Get rid of guiroot"
This reverts commit 45e7a800575f6d96ea307d99f1945aeb6c22a4e1.
This commit is contained in:
parent
7e4dccb3b5
commit
f47b00426a
@ -42,6 +42,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
/* mainmenumanager.h
|
/* mainmenumanager.h
|
||||||
*/
|
*/
|
||||||
gui::IGUIEnvironment *guienv = nullptr;
|
gui::IGUIEnvironment *guienv = nullptr;
|
||||||
|
gui::IGUIStaticText *guiroot = nullptr;
|
||||||
MainMenuManager g_menumgr;
|
MainMenuManager g_menumgr;
|
||||||
|
|
||||||
bool isMenuActive()
|
bool isMenuActive()
|
||||||
@ -217,6 +218,14 @@ bool ClientLauncher::run(GameStartData &start_data, const Settings &cmd_args)
|
|||||||
|
|
||||||
m_rendering_engine->get_gui_env()->clear();
|
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,
|
bool game_has_run = launch_game(error_message, reconnect_requested,
|
||||||
start_data, cmd_args);
|
start_data, cmd_args);
|
||||||
|
|
||||||
@ -547,8 +556,7 @@ void ClientLauncher::main_menu(MainMenuData *menudata)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* show main menu */
|
/* show main menu */
|
||||||
GUIEngine mymenu(&input->joystick, m_rendering_engine->get_gui_env()->getRootGUIElement(),
|
GUIEngine mymenu(&input->joystick, guiroot, m_rendering_engine, &g_menumgr, menudata, *kill);
|
||||||
m_rendering_engine, &g_menumgr, menudata, *kill);
|
|
||||||
|
|
||||||
/* leave scene manager in a clean state */
|
/* leave scene manager in a clean state */
|
||||||
m_rendering_engine->get_scene_manager()->clear();
|
m_rendering_engine->get_scene_manager()->clear();
|
||||||
|
@ -1806,19 +1806,19 @@ inline bool Game::handleCallbacks()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (g_gamecallback->changepassword_requested) {
|
if (g_gamecallback->changepassword_requested) {
|
||||||
(new GUIPasswordChange(guienv, guienv->getRootGUIElement(), -1,
|
(new GUIPasswordChange(guienv, guiroot, -1,
|
||||||
&g_menumgr, client, texture_src))->drop();
|
&g_menumgr, client, texture_src))->drop();
|
||||||
g_gamecallback->changepassword_requested = false;
|
g_gamecallback->changepassword_requested = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_gamecallback->changevolume_requested) {
|
if (g_gamecallback->changevolume_requested) {
|
||||||
(new GUIVolumeChange(guienv, guienv->getRootGUIElement(), -1,
|
(new GUIVolumeChange(guienv, guiroot, -1,
|
||||||
&g_menumgr, texture_src))->drop();
|
&g_menumgr, texture_src))->drop();
|
||||||
g_gamecallback->changevolume_requested = false;
|
g_gamecallback->changevolume_requested = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_gamecallback->keyconfig_requested) {
|
if (g_gamecallback->keyconfig_requested) {
|
||||||
(new GUIKeyChangeMenu(guienv, guienv->getRootGUIElement(), -1,
|
(new GUIKeyChangeMenu(guienv, guiroot, -1,
|
||||||
&g_menumgr, texture_src))->drop();
|
&g_menumgr, texture_src))->drop();
|
||||||
g_gamecallback->keyconfig_requested = false;
|
g_gamecallback->keyconfig_requested = false;
|
||||||
}
|
}
|
||||||
@ -4150,7 +4150,7 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats, f32 dtime,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isMenuActive())
|
if (isMenuActive())
|
||||||
m_rendering_engine->get_gui_env()->getRootGUIElement()->bringToFront(formspec);
|
guiroot->bringToFront(formspec);
|
||||||
} while (false);
|
} while (false);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -53,8 +53,6 @@ GameUI::GameUI()
|
|||||||
}
|
}
|
||||||
void GameUI::init()
|
void GameUI::init()
|
||||||
{
|
{
|
||||||
IGUIElement *guiroot = guienv->getRootGUIElement();
|
|
||||||
|
|
||||||
// First line of debug text
|
// First line of debug text
|
||||||
m_guitext = gui::StaticText::add(guienv, utf8_to_wide(PROJECT_NAME_C).c_str(),
|
m_guitext = gui::StaticText::add(guienv, utf8_to_wide(PROJECT_NAME_C).c_str(),
|
||||||
core::rect<s32>(0, 0, 0, 0), false, true, guiroot);
|
core::rect<s32>(0, 0, 0, 0), false, true, guiroot);
|
||||||
|
@ -139,9 +139,9 @@ void GUIFormSpecMenu::create(GUIFormSpecMenu *&cur_formspec, Client *client,
|
|||||||
TextDest *txt_dest, const std::string &formspecPrepend, ISoundManager *sound_manager)
|
TextDest *txt_dest, const std::string &formspecPrepend, ISoundManager *sound_manager)
|
||||||
{
|
{
|
||||||
if (cur_formspec == nullptr) {
|
if (cur_formspec == nullptr) {
|
||||||
cur_formspec = new GUIFormSpecMenu(joystick, guienv->getRootGUIElement(),
|
cur_formspec = new GUIFormSpecMenu(joystick, guiroot, -1, &g_menumgr,
|
||||||
-1, &g_menumgr, client, guienv, client->getTextureSource(), sound_manager,
|
client, guienv, client->getTextureSource(), sound_manager, fs_src,
|
||||||
fs_src, txt_dest, formspecPrepend);
|
txt_dest, formspecPrepend);
|
||||||
cur_formspec->doPause = false;
|
cur_formspec->doPause = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -38,8 +38,8 @@ public:
|
|||||||
virtual void signalKeyConfigChange() = 0;
|
virtual void signalKeyConfigChange() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
// FIXME: do we really need this global variable?
|
|
||||||
extern gui::IGUIEnvironment *guienv;
|
extern gui::IGUIEnvironment *guienv;
|
||||||
|
extern gui::IGUIStaticText *guiroot;
|
||||||
|
|
||||||
// Handler for the modal menus
|
// Handler for the modal menus
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user