@@ -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"
@@ -908,6 +909,7 @@ class Game {
908
909
void handleClientEvent_Deathscreen (ClientEvent *event, CameraOrientation *cam);
909
910
void handleClientEvent_ShowFormSpec (ClientEvent *event, CameraOrientation *cam);
910
911
void handleClientEvent_ShowLocalFormSpec (ClientEvent *event, CameraOrientation *cam);
912
+ void handleClientEvent_UiMessage (ClientEvent *event, CameraOrientation *cam);
911
913
void handleClientEvent_HandleParticleEvent (ClientEvent *event,
912
914
CameraOrientation *cam);
913
915
void handleClientEvent_HudAdd (ClientEvent *event, CameraOrientation *cam);
@@ -956,6 +958,7 @@ class Game {
956
958
957
959
std::unique_ptr<GameUI> m_game_ui;
958
960
GUIChatConsole *gui_chat_console = nullptr ; // Free using ->Drop()
961
+ ui::GUIManagerElem *gui_manager_elem = nullptr ; // Free using ->Drop()
959
962
MapDrawControl *draw_control = nullptr ;
960
963
Camera *camera = nullptr ;
961
964
Clouds *clouds = nullptr ; // Free using ->Drop()
@@ -1311,6 +1314,8 @@ void Game::shutdown()
1311
1314
if (formspec)
1312
1315
formspec->quitMenu ();
1313
1316
1317
+ ui::g_manager.reset ();
1318
+
1314
1319
// Clear text when exiting.
1315
1320
m_game_ui->clearText ();
1316
1321
@@ -1325,6 +1330,8 @@ void Game::shutdown()
1325
1330
1326
1331
if (gui_chat_console)
1327
1332
gui_chat_console->drop ();
1333
+ if (gui_manager_elem)
1334
+ gui_manager_elem->drop ();
1328
1335
1329
1336
if (sky)
1330
1337
sky->drop ();
@@ -1560,6 +1567,8 @@ bool Game::createClient(const GameStartData &start_data)
1560
1567
if (mapper && client->modsLoaded ())
1561
1568
client->getScript ()->on_minimap_ready (mapper);
1562
1569
1570
+ ui::g_manager.setClient (client);
1571
+
1563
1572
return true ;
1564
1573
}
1565
1574
@@ -1577,6 +1586,9 @@ bool Game::initGui()
1577
1586
gui_chat_console = new GUIChatConsole (guienv, guienv->getRootGUIElement (),
1578
1587
-1 , chat_backend, client, &g_menumgr);
1579
1588
1589
+ // Thingy to draw UI manager after chat but before formspecs.
1590
+ gui_manager_elem = new ui::GUIManagerElem (guienv, guiroot, -1 );
1591
+
1580
1592
#ifdef HAVE_TOUCHSCREENGUI
1581
1593
if (g_touchscreengui)
1582
1594
g_touchscreengui->init (texture_src);
@@ -2819,6 +2831,7 @@ const ClientEventHandler Game::clientEventHandler[CLIENTEVENT_MAX] = {
2819
2831
{&Game::handleClientEvent_Deathscreen},
2820
2832
{&Game::handleClientEvent_ShowFormSpec},
2821
2833
{&Game::handleClientEvent_ShowLocalFormSpec},
2834
+ {&Game::handleClientEvent_UiMessage},
2822
2835
{&Game::handleClientEvent_HandleParticleEvent},
2823
2836
{&Game::handleClientEvent_HandleParticleEvent},
2824
2837
{&Game::handleClientEvent_HandleParticleEvent},
@@ -2924,6 +2937,14 @@ void Game::handleClientEvent_ShowLocalFormSpec(ClientEvent *event, CameraOrienta
2924
2937
delete event->show_formspec .formname ;
2925
2938
}
2926
2939
2940
+ void Game::handleClientEvent_UiMessage (ClientEvent *event, CameraOrientation *cam)
2941
+ {
2942
+ std::istringstream is (*event->ui_message .data , std::ios_base::binary);
2943
+ ui::g_manager.read (is);
2944
+
2945
+ delete event->ui_message .data ;
2946
+ }
2947
+
2927
2948
void Game::handleClientEvent_HandleParticleEvent (ClientEvent *event,
2928
2949
CameraOrientation *cam)
2929
2950
{
@@ -4301,7 +4322,8 @@ void Game::drawScene(ProfilerGraph *graph, RunStats *stats)
4301
4322
draw_crosshair = false ;
4302
4323
#endif
4303
4324
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);
4325
+ this ->m_game_ui ->m_flags .show_chat , this ->m_game_ui ->m_flags .show_minimap ,
4326
+ draw_wield_tool, draw_crosshair);
4305
4327
4306
4328
/*
4307
4329
Profiler graph
0 commit comments