Created
August 18, 2013 12:55
-
-
Save kahrl/6261515 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/game.cpp b/src/game.cpp | |
index 650b5e2..8b3ebd6 100644 | |
--- a/src/game.cpp | |
+++ b/src/game.cpp | |
@@ -1324,6 +1324,9 @@ void the_game( | |
Add some gui stuff | |
*/ | |
+ // An actual root element that is not NULL - modal menus require this | |
+ gui::IGUIElement *guiroot = guienv->getRootGUIElement(); | |
+ | |
// First line of debug text | |
gui::IGUIStaticText *guitext = guienv->addStaticText( | |
L"Minetest", | |
diff --git a/src/main.cpp b/src/main.cpp | |
index 7450593..65b96b1 100644 | |
--- a/src/main.cpp | |
+++ b/src/main.cpp | |
@@ -118,7 +118,6 @@ | |
/* mainmenumanager.h */ | |
gui::IGUIEnvironment* guienv = NULL; | |
-gui::IGUIStaticText *guiroot = NULL; | |
MainMenuManager g_menumgr; | |
bool noMenuActive() | |
@@ -1479,14 +1478,6 @@ int main(int argc, char *argv[]) | |
*/ | |
guienv->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 = guienv->addStaticText(L"", | |
- core::rect<s32>(0, 0, 10000, 10000)); | |
- | |
SubgameSpec gamespec; | |
WorldSpec worldspec; | |
bool simple_singleplayer_mode = false; | |
@@ -1565,7 +1556,9 @@ int main(int argc, char *argv[]) | |
} | |
infostream<<"Waited for other menus"<<std::endl; | |
- GUIEngine* temp = new GUIEngine(device, guiroot, &g_menumgr,smgr,&menudata); | |
+ GUIEngine* temp = new GUIEngine(device, | |
+ guienv->getRootGUIElement(), | |
+ &g_menumgr,smgr,&menudata); | |
delete temp; | |
//once finished you'll never end up here | |
diff --git a/src/mainmenumanager.h b/src/mainmenumanager.h | |
index a313368..cb8fed1 100644 | |
--- a/src/mainmenumanager.h | |
+++ b/src/mainmenumanager.h | |
@@ -29,7 +29,6 @@ | |
#include <list> | |
extern gui::IGUIEnvironment* guienv; | |
-extern gui::IGUIStaticText *guiroot; | |
// Handler for the modal menus | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment