diff options
author | Loic Blot <loic.blot@unix-experience.fr> | 2018-01-13 10:34:56 +0100 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2018-01-20 16:38:38 +0100 |
commit | 64fe79b53b03b80b5a3636dfe0d3a2d325306301 (patch) | |
tree | d64d955f7a9b566f2aefd739b779a2ce314c264e /src/gui/guiFormSpecMenu.cpp | |
parent | 362323cdc209956a3d35d8ec7ea03ec31b580d88 (diff) | |
download | minetest-64fe79b53b03b80b5a3636dfe0d3a2d325306301.tar.gz minetest-64fe79b53b03b80b5a3636dfe0d3a2d325306301.tar.bz2 minetest-64fe79b53b03b80b5a3636dfe0d3a2d325306301.zip |
Game refactor [2/X]: Various moves (profilergraph, nodePlacementPrediction, create_formspec_menu)
* Move profilergraph to dedicated files
* Move nodePlacementPrediction to Game class
* Rename create_formspec_menu to GUIFormSpecMenu::create
Diffstat (limited to 'src/gui/guiFormSpecMenu.cpp')
-rw-r--r-- | src/gui/guiFormSpecMenu.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/gui/guiFormSpecMenu.cpp b/src/gui/guiFormSpecMenu.cpp index a59143f77..4acc4b94a 100644 --- a/src/gui/guiFormSpecMenu.cpp +++ b/src/gui/guiFormSpecMenu.cpp @@ -57,6 +57,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #if USE_FREETYPE && IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 9 #include "intlGUIEditBox.h" +#include "mainmenumanager.h" + #endif #define MY_CHECKPOS(a,b) \ @@ -129,6 +131,28 @@ GUIFormSpecMenu::~GUIFormSpecMenu() delete m_text_dst; } +void GUIFormSpecMenu::create(GUIFormSpecMenu **cur_formspec, Client *client, + JoystickController *joystick, IFormSource *fs_src, TextDest *txt_dest) +{ + if (*cur_formspec == 0) { + *cur_formspec = new GUIFormSpecMenu(joystick, guiroot, -1, &g_menumgr, + client, client->getTextureSource(), fs_src, txt_dest); + (*cur_formspec)->doPause = false; + + /* + Caution: do not call (*cur_formspec)->drop() here -- + the reference might outlive the menu, so we will + periodically check if *cur_formspec is the only + remaining reference (i.e. the menu was removed) + and delete it in that case. + */ + + } else { + (*cur_formspec)->setFormSource(fs_src); + (*cur_formspec)->setTextDest(txt_dest); + } +} + void GUIFormSpecMenu::removeChildren() { const core::list<gui::IGUIElement*> &children = getChildren(); |