@@ -50,6 +50,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
50
50
#include " gui/guiPasswordChange.h"
51
51
#include " gui/guiVolumeChange.h"
52
52
#include " gui/mainmenumanager.h"
53
+ #include " gui/manager.h"
53
54
#include " gui/profilergraph.h"
54
55
#include " mapblock.h"
55
56
#include " minimap.h"
@@ -956,6 +957,7 @@ class Game {
956
957
957
958
std::unique_ptr<GameUI> m_game_ui;
958
959
GUIChatConsole *gui_chat_console = nullptr ; // Free using ->Drop()
960
+ ui::GUIManagerElem *gui_manager_elem = nullptr ; // Free using ->Drop()
959
961
MapDrawControl *draw_control = nullptr ;
960
962
Camera *camera = nullptr ;
961
963
Clouds *clouds = nullptr ; // Free using ->Drop()
@@ -1311,6 +1313,8 @@ void Game::shutdown()
1311
1313
if (formspec)
1312
1314
formspec->quitMenu ();
1313
1315
1316
+ ui::g_manager.reset ();
1317
+
1314
1318
// Clear text when exiting.
1315
1319
m_game_ui->clearText ();
1316
1320
@@ -1325,6 +1329,8 @@ void Game::shutdown()
1325
1329
1326
1330
if (gui_chat_console)
1327
1331
gui_chat_console->drop ();
1332
+ if (gui_manager_elem)
1333
+ gui_manager_elem->drop ();
1328
1334
1329
1335
if (sky)
1330
1336
sky->drop ();
@@ -1560,6 +1566,8 @@ bool Game::createClient(const GameStartData &start_data)
1560
1566
if (mapper && client->modsLoaded ())
1561
1567
client->getScript ()->on_minimap_ready (mapper);
1562
1568
1569
+ ui::g_manager.setClient (client);
1570
+
1563
1571
return true ;
1564
1572
}
1565
1573
@@ -1577,6 +1585,9 @@ bool Game::initGui()
1577
1585
gui_chat_console = new GUIChatConsole (guienv, guienv->getRootGUIElement (),
1578
1586
-1 , chat_backend, client, &g_menumgr);
1579
1587
1588
+ // Thingy to draw UI manager after chat but before formspecs.
1589
+ gui_manager_elem = new ui::GUIManagerElem (guienv, guiroot, -1 );
1590
+
1580
1591
#ifdef HAVE_TOUCHSCREENGUI
1581
1592
if (g_touchscreengui)
1582
1593
g_touchscreengui->init (texture_src);
@@ -2890,7 +2901,10 @@ void Game::handleClientEvent_Deathscreen(ClientEvent *event, CameraOrientation *
2890
2901
2891
2902
void Game::handleClientEvent_ShowFormSpec (ClientEvent *event, CameraOrientation *cam)
2892
2903
{
2893
- if (event->show_formspec .formspec ->empty ()) {
2904
+ if (*event->show_formspec .formname == " __ui__" ) {
2905
+ std::istringstream is (*event->show_formspec .formspec , std::ios_base::binary);
2906
+ ui::g_manager.read (is);
2907
+ } else if (event->show_formspec .formspec ->empty ()) {
2894
2908
auto formspec = m_game_ui->getFormspecGUI ();
2895
2909
if (formspec && (event->show_formspec .formname ->empty ()
2896
2910
|| *(event->show_formspec .formname ) == m_game_ui->getFormspecName ())) {
@@ -4301,7 +4315,8 @@ void Game::drawScene(ProfilerGraph *graph, RunStats *stats)
4301
4315
draw_crosshair = false ;
4302
4316
#endif
4303
4317
this ->m_rendering_engine ->draw_scene (sky_color, this ->m_game_ui ->m_flags .show_hud ,
4304
- this ->m_game_ui ->m_flags .show_minimap , draw_wield_tool, draw_crosshair);
4318
+ this ->m_game_ui ->m_flags .show_chat , this ->m_game_ui ->m_flags .show_minimap ,
4319
+ draw_wield_tool, draw_crosshair);
4305
4320
4306
4321
/*
4307
4322
Profiler graph
0 commit comments