aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/mainmenu.lua4
-rw-r--r--builtin/modmgr.lua2
-rw-r--r--builtin/modstore.lua4
-rw-r--r--doc/lua_api.txt13
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/game.cpp227
-rw-r--r--src/guiFormSpecMenu.cpp127
-rw-r--r--src/guiFormSpecMenu.h18
-rw-r--r--src/guiMessageMenu.cpp173
-rw-r--r--src/guiMessageMenu.h60
-rw-r--r--src/guiPauseMenu.cpp280
-rw-r--r--src/guiPauseMenu.h63
-rw-r--r--src/main.cpp1
-rw-r--r--src/mainmenumanager.h10
14 files changed, 273 insertions, 711 deletions
diff --git a/builtin/mainmenu.lua b/builtin/mainmenu.lua
index f2649443b..ad8b37ee0 100644
--- a/builtin/mainmenu.lua
+++ b/builtin/mainmenu.lua
@@ -176,7 +176,7 @@ function update_menu()
-- handle errors
if gamedata.errormessage ~= nil then
- formspec = "size[12,5.2]" ..
+ formspec = "size[12,5.2,true]" ..
"textarea[1,2;10,2;;ERROR: " ..
engine.formspec_escape(gamedata.errormessage) ..
";]"..
@@ -365,7 +365,7 @@ end
function tabbuilder.gettab()
local tsize = tabbuilder.tabsizes[tabbuilder.current_tab] or {width=12, height=5.2}
- local retval = "size[" .. tsize.width .. "," .. tsize.height .. "]"
+ local retval = "size[" .. tsize.width .. "," .. tsize.height .. ",true]"
if tabbuilder.show_buttons then
retval = retval .. tabbuilder.tab_header()
diff --git a/builtin/modmgr.lua b/builtin/modmgr.lua
index 11434ab3c..eeb65add1 100644
--- a/builtin/modmgr.lua
+++ b/builtin/modmgr.lua
@@ -422,7 +422,7 @@ function modmgr.dialog_configure_world()
local mod = filterlist.get_list(modmgr.modlist)[modmgr.world_config_selected_mod]
local retval =
- "size[11,6.5]" ..
+ "size[11,6.5,true]" ..
"label[0.5,-0.25;" .. fgettext("World:") .. "]" ..
"label[1.75,-0.25;" .. worldspec.name .. "]"
diff --git a/builtin/modstore.lua b/builtin/modstore.lua
index 43d8d7e29..ef7fd0165 100644
--- a/builtin/modstore.lua
+++ b/builtin/modstore.lua
@@ -98,7 +98,7 @@ end
-- @function [parent=#modstore] getsuccessfuldialog
function modstore.getsuccessfuldialog()
local retval = ""
- retval = retval .. "size[6,2]"
+ retval = retval .. "size[6,2,true]"
if modstore.lastmodentry ~= nil then
retval = retval .. "label[0,0.25;" .. fgettext("Successfully installed:") .. "]"
retval = retval .. "label[3,0.25;" .. modstore.lastmodentry.moddetails.title .. "]"
@@ -152,7 +152,7 @@ end
--------------------------------------------------------------------------------
-- @function [parent=#modstore] tabheader
function modstore.tabheader(tabname)
- local retval = "size[12,10.25]"
+ local retval = "size[12,10.25,true]"
retval = retval .. "tabheader[-0.3,-0.99;modstore_tab;" ..
"Unsorted,Search;" ..
modstore.nametoindex(tabname) .. ";true;false]" ..
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index f54684940..713800752 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -849,7 +849,7 @@ Example stuff:
local meta = minetest.get_meta(pos)
meta:set_string("formspec",
- "invsize[8,9;]"..
+ "size[8,9]"..
"list[context;main;0,0;8,4;]"..
"list[current_player;main;0,5;8,4;]")
meta:set_string("infotext", "Chest");
@@ -861,7 +861,7 @@ meta:from_table({
main = {[1] = "default:dirt", [2] = "", [3] = "", [4] = "", [5] = "", [6] = "", [7] = "", [8] = "", [9] = "", [10] = "", [11] = "", [12] = "", [13] = "", [14] = "default:cobble", [15] = "", [16] = "", [17] = "", [18] = "", [19] = "", [20] = "default:cobble", [21] = "", [22] = "", [23] = "", [24] = "", [25] = "", [26] = "", [27] = "", [28] = "", [29] = "", [30] = "", [31] = "", [32] = ""}
},
fields = {
- formspec = "invsize[8,9;]list[context;main;0,0;8,4;]list[current_player;main;0,5;8,4;]",
+ formspec = "size[8,9]list[context;main;0,0;8,4;]list[current_player;main;0,5;8,4;]",
infotext = "Chest"
}
})
@@ -876,17 +876,17 @@ examples.
Examples:
- Chest:
- invsize[8,9;]
+ size[8,9]
list[context;main;0,0;8,4;]
list[current_player;main;0,5;8,4;]
- Furnace:
- invsize[8,9;]
+ size[8,9]
list[context;fuel;2,3;1,1;]
list[context;src;2,1;1,1;]
list[context;dst;5,1;2,2;]
list[current_player;main;0,5;8,4;]
- Minecraft-like player inventory
- invsize[8,7.5;]
+ size[8,7.5]
image[1,0.6;1,2;player.png]
list[current_player;main;0,3.5;8,4;]
list[current_player;craft;3,0;3,3;]
@@ -894,8 +894,9 @@ Examples:
Elements:
-size[<W>,<H>]
+size[<W>,<H>,<fixed_size>]
^ Define the size of the menu in inventory slots
+^ fixed_size true/false (optional)
^ deprecated: invsize[<W>,<H>;]
list[<inventory location>;<list name>;<X>,<Y>;<W>,<H>;]
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 562306e10..149fe4a44 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -424,11 +424,9 @@ set(minetest_SRCS
chat.cpp
hud.cpp
guiKeyChangeMenu.cpp
- guiMessageMenu.cpp
guiTextInputMenu.cpp
guiFormSpecMenu.cpp
guiTable.cpp
- guiPauseMenu.cpp
guiPasswordChange.cpp
guiVolumeChange.cpp
guiDeathScreen.cpp
diff --git a/src/game.cpp b/src/game.cpp
index 18e69c132..64e2ffcc7 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -28,7 +28,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "IMeshCache.h"
#include "client.h"
#include "server.h"
-#include "guiPauseMenu.h"
#include "guiPasswordChange.h"
#include "guiVolumeChange.h"
#include "guiFormSpecMenu.h"
@@ -75,24 +74,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
Text input system
*/
-struct TextDestChat : public TextDest
-{
- TextDestChat(Client *client)
- {
- m_client = client;
- }
- void gotText(std::wstring text)
- {
- m_client->typeChatMessage(text);
- }
- void gotText(std::map<std::string, std::string> fields)
- {
- m_client->typeChatMessage(narrow_to_wide(fields["text"]));
- }
-
- Client *m_client;
-};
-
struct TextDestNodeMetadata : public TextDest
{
TextDestNodeMetadata(v3s16 p, Client *client)
@@ -136,12 +117,76 @@ struct TextDestPlayerInventory : public TextDest
m_client->sendInventoryFields(m_formname, fields);
}
- void setFormName(std::string formname) {
+ Client *m_client;
+};
+
+struct LocalFormspecHandler : public TextDest
+{
+ LocalFormspecHandler();
+ LocalFormspecHandler(std::string formname) {
m_formname = formname;
}
+ LocalFormspecHandler(std::string formname,Client *client) {
+ m_formname = formname;
+ m_client = client;
+ }
+
+ void gotText(std::string message) {
+ errorstream << "LocalFormspecHandler::gotText old style message received" << std::endl;
+ }
+
+ void gotText(std::map<std::string, std::string> fields)
+ {
+ if (m_formname == "MT_PAUSE_MENU") {
+ if (fields.find("btn_sound") != fields.end()) {
+ g_gamecallback->changeVolume();
+ return;
+ }
+
+ if (fields.find("btn_exit_menu") != fields.end()) {
+ g_gamecallback->disconnect();
+ return;
+ }
+
+ if (fields.find("btn_exit_os") != fields.end()) {
+ g_gamecallback->exitToOS();
+ return;
+ }
+
+ if (fields.find("quit") != fields.end()) {
+ return;
+ }
+
+ if (fields.find("btn_continue") != fields.end()) {
+ return;
+ }
+ }
+ if (m_formname == "MT_CHAT_MENU") {
+ if ((fields.find("btn_send") != fields.end()) ||
+ (fields.find("quit") != fields.end())) {
+ if (fields.find("f_text") != fields.end()) {
+ if (m_client != 0) {
+ m_client->typeChatMessage(narrow_to_wide(fields["f_text"]));
+ }
+ else {
+ errorstream << "LocalFormspecHandler::gotText received chat message but m_client is NULL" << std::endl;
+ }
+ }
+ return;
+ }
+ }
+
+ errorstream << "LocalFormspecHandler::gotText unhandled >" << m_formname << "< event" << std::endl;
+ int i = 0;
+ for (std::map<std::string,std::string>::iterator iter = fields.begin();
+ iter != fields.end(); iter++) {
+ errorstream << "\t"<< i << ": " << iter->first << "=" << iter->second << std::endl;
+ i++;
+ }
+ }
+
Client *m_client;
- std::string m_formname;
};
/* Respawn menu callback */
@@ -224,13 +269,9 @@ inline bool isPointableNode(const MapNode& n,
Find what the player is pointing at
*/
PointedThing getPointedThing(Client *client, v3f player_position,
- v3f camera_direction, v3f camera_position,
- core::line3d<f32> shootline, f32 d,
- bool liquids_pointable,
- bool look_for_object,
- v3s16 camera_offset,
- std::vector<aabb3f> &hilightboxes,
- ClientActiveObject *&selected_object)
+ v3f camera_direction, v3f camera_position, core::line3d<f32> shootline,
+ f32 d, bool liquids_pointable, bool look_for_object, v3s16 camera_offset,
+ std::vector<aabb3f> &hilightboxes, ClientActiveObject *&selected_object)
{
PointedThing result;
@@ -379,9 +420,8 @@ PointedThing getPointedThing(Client *client, v3f player_position,
Additionally, a progressbar can be drawn when percent is set between 0 and 100.
*/
/*gui::IGUIStaticText **/
-void draw_load_screen(const std::wstring &text,
- IrrlichtDevice* device, gui::IGUIFont* font,
- float dtime=0 ,int percent=0, bool clouds=true)
+void draw_load_screen(const std::wstring &text, IrrlichtDevice* device,
+ gui::IGUIFont* font, float dtime=0 ,int percent=0, bool clouds=true)
{
video::IVideoDriver* driver = device->getVideoDriver();
v2u32 screensize = driver->getScreenSize();
@@ -430,8 +470,8 @@ void draw_load_screen(const std::wstring &text,
/* Profiler display */
void update_profiler_gui(gui::IGUIStaticText *guitext_profiler,
- gui::IGUIFont *font, u32 text_height,
- u32 show_profiler, u32 show_profiler_max)
+ gui::IGUIFont *font, u32 text_height, u32 show_profiler,
+ u32 show_profiler_max)
{
if(show_profiler == 0)
{
@@ -833,8 +873,7 @@ public:
};
bool nodePlacementPrediction(Client &client,
- const ItemDefinition &playeritem_def,
- v3s16 nodepos, v3s16 neighbourpos)
+ const ItemDefinition &playeritem_def, v3s16 nodepos, v3s16 neighbourpos)
{
std::string prediction = playeritem_def.node_placement_prediction;
INodeDefManager *nodedef = client.ndef();
@@ -930,26 +969,86 @@ bool nodePlacementPrediction(Client &client,
return false;
}
+static void show_chat_menu(FormspecFormSource* current_formspec,
+ TextDest* current_textdest, IWritableTextureSource* tsrc,
+ IrrlichtDevice * device, Client* client, std::string text)
+{
+ std::string formspec =
+ "size[11,5.5,true]"
+ "field[3,2.35;6,0.5;f_text;;" + text + "]"
+ "button_exit[4,3;3,0.5;btn_send;" + std::string(gettext("Proceed")) + "]"
+ ;
+
+ /* Create menu */
+ /* Note: FormspecFormSource and LocalFormspecHandler
+ * are deleted by guiFormSpecMenu */
+ current_formspec = new FormspecFormSource(formspec,&current_formspec);
+ current_textdest = new LocalFormspecHandler("MT_CHAT_MENU",client);
+ GUIFormSpecMenu *menu =
+ new GUIFormSpecMenu(device, guiroot, -1,
+ &g_menumgr,
+ NULL, NULL, tsrc);
+ menu->setFormSource(current_formspec);
+ menu->setTextDest(current_textdest);
+ menu->drop();
+}
+
+/******************************************************************************/
+static void show_pause_menu(FormspecFormSource* current_formspec,
+ TextDest* current_textdest, IWritableTextureSource* tsrc,
+ IrrlichtDevice * device)
+{
+ const char* control_text = gettext("Default Controls:\n"
+ "- WASD: move\n"
+ "- Space: jump/climb\n"
+ "- Shift: sneak/go down\n"
+ "- Q: drop item\n"
+ "- I: inventory\n"
+ "- Mouse: turn/look\n"
+ "- Mouse left: dig/punch\n"
+ "- Mouse right: place/use\n"
+ "- Mouse wheel: select item\n"
+ "- T: chat\n"
+ );
+
+ std::ostringstream os;
+ os<<"Minetest\n";
+ os<<minetest_build_info<<"\n";
+ os<<"path_user = "<<wrap_rows(porting::path_user, 20)<<"\n";
+
+ std::string formspec =
+ "size[11,5.5,true]"
+ "button_exit[4,1;3,0.5;btn_continue;" + std::string(gettext("Continue"))+ "]"
+ "button[4,2;3,0.5;btn_sound;" + std::string(gettext("Sound Volume")) + "]"
+ "button[4,3;3,0.5;btn_exit_menu;" + std::string(gettext("Exit to Menu")) + "]"
+ "button[4,4;3,0.5;btn_exit_os;" + std::string(gettext("Exit to OS")) + "]"
+ "textarea[7.5,0.25;3.75,6;;" + std::string(control_text) + ";]"
+ "textarea[0.4,0.25;3.5,6;;" + os.str() + ";]"
+ ;
+
+ /* Create menu */
+ /* Note: FormspecFormSource and LocalFormspecHandler *
+ * are deleted by guiFormSpecMenu */
+ current_formspec = new FormspecFormSource(formspec,&current_formspec);
+ current_textdest = new LocalFormspecHandler("MT_PAUSE_MENU");
+ GUIFormSpecMenu *menu =
+ new GUIFormSpecMenu(device, guiroot, -1, &g_menumgr, NULL, NULL, tsrc);
+ menu->setFormSource(current_formspec);
+ menu->setTextDest(current_textdest);
+ menu->drop();
+}
-void the_game(
- bool &kill,
- bool random_input,
- InputHandler *input,
- IrrlichtDevice *device,
- gui::IGUIFont* font,
- std::string map_dir,
- std::string playername,
- std::string password,
- std::string address, // If "", local server is used
- u16 port,
- std::wstring &error_message,
- ChatBackend &chat_backend,
- const SubgameSpec &gamespec, // Used for local game,
- bool simple_singleplayer_mode
-)
+/******************************************************************************/
+void the_game(bool &kill, bool random_input, InputHandler *input,
+ IrrlichtDevice *device, gui::IGUIFont* font, std::string map_dir,
+ std::string playername, std::string password,
+ std::string address /* If "", local server is used */,
+ u16 port, std::wstring &error_message, ChatBackend &chat_backend,
+ const SubgameSpec &gamespec /* Used for local game */,
+ bool simple_singleplayer_mode)
{
FormspecFormSource* current_formspec = 0;
- TextDestPlayerInventory* current_textdest = 0;
+ TextDest* current_textdest = 0;
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
@@ -1788,33 +1887,15 @@ void the_game(
}
else if(input->wasKeyDown(EscapeKey))
{
- infostream<<"the_game: "
- <<"Launching pause menu"<<std::endl;
- // It will delete itself by itself
- (new GUIPauseMenu(guienv, guiroot, -1, g_gamecallback,
- &g_menumgr, simple_singleplayer_mode))->drop();
-
- // Move mouse cursor on top of the disconnect button
- if(simple_singleplayer_mode)
- input->setMousePos(displaycenter.X, displaycenter.Y+0);
- else
- input->setMousePos(displaycenter.X, displaycenter.Y+25);
+ show_pause_menu(current_formspec, current_textdest, tsrc, device);
}
else if(input->wasKeyDown(getKeySetting("keymap_chat")))
{
- TextDest *dest = new TextDestChat(&client);
-
- (new GUITextInputMenu(guienv, guiroot, -1,
- &g_menumgr, dest,
- L""))->drop();
+ show_chat_menu(current_formspec, current_textdest, tsrc, device, &client,"");
}
else if(input->wasKeyDown(getKeySetting("keymap_cmd")))
{
- TextDest *dest = new TextDestChat(&client);
-
- (new GUITextInputMenu(guienv, guiroot, -1,
- &g_menumgr, dest,
- L"/"))->drop();
+ show_chat_menu(current_formspec, current_textdest, tsrc, device, &client,"/");
}
else if(input->wasKeyDown(getKeySetting("keymap_console")))
{
diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp
index 628ea3548..95a090c6f 100644
--- a/src/guiFormSpecMenu.cpp
+++ b/src/guiFormSpecMenu.cpp
@@ -66,12 +66,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/
GUIFormSpecMenu::GUIFormSpecMenu(irr::IrrlichtDevice* dev,
- gui::IGUIElement* parent, s32 id,
- IMenuManager *menumgr,
- InventoryManager *invmgr,
- IGameDef *gamedef,
- ISimpleTextureSource *tsrc
-):
+ gui::IGUIElement* parent, s32 id, IMenuManager *menumgr,
+ InventoryManager *invmgr, IGameDef *gamedef,
+ ISimpleTextureSource *tsrc) :
GUIModalMenu(dev->getGUIEnvironment(), parent, id, menumgr),
m_device(dev),
m_invmgr(invmgr),
@@ -248,10 +245,11 @@ std::vector<std::string> split(const std::string &s, char delim) {
return tokens;
}
-void GUIFormSpecMenu::parseSize(parserData* data,std::string element) {
+void GUIFormSpecMenu::parseSize(parserData* data,std::string element)
+{
std::vector<std::string> parts = split(element,',');
- if (parts.size() == 2) {
+ if ((parts.size() == 2) || parts.size() == 3) {
v2f invsize;
if (parts[1].find(';') != std::string::npos)
@@ -260,6 +258,13 @@ void GUIFormSpecMenu::parseSize(parserData* data,std::string element) {
invsize.X = stof(parts[0]);
invsize.Y = stof(parts[1]);
+ lockSize(false);
+ if (parts.size() == 3) {
+ if (parts[2] == "true") {
+ lockSize(true,v2u32(800,600));
+ }
+ }
+
if (m_lock) {
v2u32 current_screensize = m_device->getVideoDriver()->getScreenSize();
v2u32 delta = current_screensize - m_lockscreensize;
@@ -305,8 +310,8 @@ void GUIFormSpecMenu::parseSize(parserData* data,std::string element) {
errorstream<< "Invalid size element (" << parts.size() << "): '" << element << "'" << std::endl;
}
-void GUIFormSpecMenu::parseList(parserData* data,std::string element) {
-
+void GUIFormSpecMenu::parseList(parserData* data,std::string element)
+{
if (m_gamedef == 0) {
errorstream<<"WARNING: invalid use of 'list' with m_gamedef==0"<<std::endl;
return;
@@ -358,7 +363,8 @@ void GUIFormSpecMenu::parseList(parserData* data,std::string element) {
errorstream<< "Invalid list element(" << parts.size() << "): '" << element << "'" << std::endl;
}
-void GUIFormSpecMenu::parseCheckbox(parserData* data,std::string element) {
+void GUIFormSpecMenu::parseCheckbox(parserData* data,std::string element)
+{
std::vector<std::string> parts = split(element,';');
if ((parts.size() == 3) || (parts.size() == 4)) {
@@ -408,7 +414,8 @@ void GUIFormSpecMenu::parseCheckbox(parserData* data,std::string element) {
errorstream<< "Invalid checkbox element(" << parts.size() << "): '" << element << "'" << std::endl;
}
-void GUIFormSpecMenu::parseImage(parserData* data,std::string element) {
+void GUIFormSpecMenu::parseImage(parserData* data,std::string element)
+{
std::vector<std::string> parts = split(element,';');
if (parts.size() == 3) {
@@ -451,7 +458,8 @@ void GUIFormSpecMenu::parseImage(parserData* data,std::string element) {
errorstream<< "Invalid image element(" << parts.size() << "): '" << element << "'" << std::endl;
}
-void GUIFormSpecMenu::parseItemImage(parserData* data,std::string element) {
+void GUIFormSpecMenu::parseItemImage(parserData* data,std::string element)
+{
std::vector<std::string> parts = split(element,';');
if (parts.size() == 3) {
@@ -478,7 +486,9 @@ void GUIFormSpecMenu::parseItemImage(parserData* data,std::string element) {
errorstream<< "Invalid ItemImage element(" << parts.size() << "): '" << element << "'" << std::endl;
}
-void GUIFormSpecMenu::parseButton(parserData* data,std::string element,std::string type) {
+void GUIFormSpecMenu::parseButton(parserData* data,std::string element,
+ std::string type)
+{
std::vector<std::string> parts = split(element,';');
if (parts.size() == 4) {
@@ -530,7 +540,8 @@ void GUIFormSpecMenu::parseButton(parserData* data,std::string element,std::stri
errorstream<< "Invalid button element(" << parts.size() << "): '" << element << "'" << std::endl;
}
-void GUIFormSpecMenu::parseBackground(parserData* data,std::string element) {
+void GUIFormSpecMenu::parseBackground(parserData* data,std::string element)
+{
std::vector<std::string> parts = split(element,';');
if ((parts.size() == 3) || (parts.size() == 4)) {
@@ -565,7 +576,8 @@ void GUIFormSpecMenu::parseBackground(parserData* data,std::string element) {
errorstream<< "Invalid background element(" << parts.size() << "): '" << element << "'" << std::endl;
}
-void GUIFormSpecMenu::parseTableOptions(parserData* data,std::string element) {
+void GUIFormSpecMenu::parseTableOptions(parserData* data,std::string element)
+{
std::vector<std::string> parts = split(element,';');
data->table_options.clear();
@@ -576,7 +588,8 @@ void GUIFormSpecMenu::parseTableOptions(parserData* data,std::string element) {
}
}
-void GUIFormSpecMenu::parseTableColumns(parserData* data,std::string element) {
+void GUIFormSpecMenu::parseTableColumns(parserData* data,std::string element)
+{
std::vector<std::string> parts = split(element,';');
data->table_columns.clear();
@@ -595,7 +608,8 @@ void GUIFormSpecMenu::parseTableColumns(parserData* data,std::string element) {
}
}
-void GUIFormSpecMenu::parseTable(parserData* data,std::string element) {
+void GUIFormSpecMenu::parseTable(parserData* data,std::string element)
+{
std::vector<std::string> parts = split(element,';');
if ((parts.size() == 4) || (parts.size() == 5)) {
@@ -664,7 +678,8 @@ void GUIFormSpecMenu::parseTable(parserData* data,std::string element) {
errorstream<< "Invalid table element(" << parts.size() << "): '" << element << "'" << std::endl;
}
-void GUIFormSpecMenu::parseTextList(parserData* data,std::string element) {
+void GUIFormSpecMenu::parseTextList(parserData* data,std::string element)
+{
std::vector<std::string> parts = split(element,';');
if ((parts.size() == 4) || (parts.size() == 5) || (parts.size() == 6)) {
@@ -737,7 +752,8 @@ void GUIFormSpecMenu::parseTextList(parserData* data,std::string element) {
}
-void GUIFormSpecMenu::parseDropDown(parserData* data,std::string element) {
+void GUIFormSpecMenu::parseDropDown(parserData* data,std::string element)
+{
std::vector<std::string> parts = split(element,';');
if (parts.size() == 5) {
@@ -790,7 +806,8 @@ void GUIFormSpecMenu::parseDropDown(parserData* data,std::string element) {
<< element << "'" << std::endl;
}
-void GUIFormSpecMenu::parsePwdField(parserData* data,std::string element) {
+void GUIFormSpecMenu::parsePwdField(parserData* data,std::string element)
+{
std::vector<std::string> parts = split(element,';');
if (parts.size() == 4) {
@@ -856,7 +873,9 @@ void GUIFormSpecMenu::parsePwdField(parserData* data,std::string element) {
errorstream<< "Invalid pwdfield element(" << parts.size() << "): '" << element << "'" << std::endl;
}
-void GUIFormSpecMenu::parseSimpleField(parserData* data,std::vector<std::string> &parts) {
+void GUIFormSpecMenu::parseSimpleField(parserData* data,
+ std::vector<std::string> &parts)
+{
std::string name = parts[0];
std::string label = parts[1];
std::string default_val = parts[2];
@@ -935,7 +954,9 @@ void GUIFormSpecMenu::parseSimpleField(parserData* data,std::vector<std::string>
m_fields.push_back(spec);
}
-void GUIFormSpecMenu::parseTextArea(parserData* data,std::vector<std::string>& parts,std::string type) {
+void GUIFormSpecMenu::parseTextArea(parserData* data,
+ std::vector<std::string>& parts,std::string type)
+{
std::vector<std::string> v_pos = split(parts[0],',');
std::vector<std::string> v_geom = split(parts[1],',');
@@ -1026,7 +1047,9 @@ void GUIFormSpecMenu::parseTextArea(parserData* data,std::vector<std::string>& p
m_fields.push_back(spec);
}
-void GUIFormSpecMenu::parseField(parserData* data,std::string element,std::string type) {
+void GUIFormSpecMenu::parseField(parserData* data,std::string element,
+ std::string type)
+{
std::vector<std::string> parts = split(element,';');
if (parts.size() == 3) {
@@ -1041,7 +1064,8 @@ void GUIFormSpecMenu::parseField(parserData* data,std::string element,std::strin
errorstream<< "Invalid field element(" << parts.size() << "): '" << element << "'" << std::endl;
}
-void GUIFormSpecMenu::parseLabel(parserData* data,std::string element) {
+void GUIFormSpecMenu::parseLabel(parserData* data,std::string element)
+{
std::vector<std::string> parts = split(element,';');
if (parts.size() == 2) {
@@ -1076,7 +1100,8 @@ void GUIFormSpecMenu::parseLabel(parserData* data,std::string element) {
errorstream<< "Invalid label element(" << parts.size() << "): '" << element << "'" << std::endl;
}
-void GUIFormSpecMenu::parseVertLabel(parserData* data,std::string element) {
+void GUIFormSpecMenu::parseVertLabel(parserData* data,std::string element)
+{
std::vector<std::string> parts = split(element,';');
if (parts.size() == 2) {
@@ -1116,7 +1141,9 @@ void GUIFormSpecMenu::parseVertLabel(parserData* data,std::string element) {
errorstream<< "Invalid vertlabel element(" << parts.size() << "): '" << element << "'" << std::endl;
}
-void GUIFormSpecMenu::parseImageButton(parserData* data,std::string element,std::string type) {
+void GUIFormSpecMenu::parseImageButton(parserData* data,std::string element,
+ std::string type)
+{
std::vector<std::string> parts = split(element,';');
if ((parts.size() == 5) || (parts.size() == 7) || (parts.size() == 8)) {
@@ -1202,7 +1229,8 @@ void GUIFormSpecMenu::parseImageButton(parserData* data,std::string element,std:
errorstream<< "Invalid imagebutton element(" << parts.size() << "): '" << element << "'" << std::endl;
}
-void GUIFormSpecMenu::parseTabHeader(parserData* data,std::string element) {
+void GUIFormSpecMenu::parseTabHeader(parserData* data,std::string element)
+{
std::vector<std::string> parts = split(element,';');
if ((parts.size() == 4) || (parts.size() == 6)) {
@@ -1269,7 +1297,8 @@ void GUIFormSpecMenu::parseTabHeader(parserData* data,std::string element) {
errorstream<< "Invalid TabHeader element(" << parts.size() << "): '" << element << "'" << std::endl;
}
-void GUIFormSpecMenu::parseItemImageButton(parserData* data,std::string element) {
+void GUIFormSpecMenu::parseItemImageButton(parserData* data,std::string element)
+{
if (m_gamedef == 0) {
errorstream<<"WARNING: invalid use of item_image_button with m_gamedef==0"<<std::endl;
@@ -1335,7 +1364,8 @@ void GUIFormSpecMenu::parseItemImageButton(parserData* data,std::string element)
errorstream<< "Invalid ItemImagebutton element(" << parts.size() << "): '" << element << "'" << std::endl;
}
-void GUIFormSpecMenu::parseBox(parserData* data,std::string element) {
+void GUIFormSpecMenu::parseBox(parserData* data,std::string element)
+{
std::vector<std::string> parts = split(element,';');
if (parts.size() == 3) {
@@ -1368,7 +1398,8 @@ void GUIFormSpecMenu::parseBox(parserData* data,std::string element) {
errorstream<< "Invalid Box element(" << parts.size() << "): '" << element << "'" << std::endl;
}
-void GUIFormSpecMenu::parseBackgroundColor(parserData* data,std::string element) {
+void GUIFormSpecMenu::parseBackgroundColor(parserData* data,std::string element)
+{
std::vector<std::string> parts = split(element,';');
if ((parts.size() == 1) || (parts.size() == 2)) {
@@ -1383,7 +1414,8 @@ void GUIFormSpecMenu::parseBackgroundColor(parserData* data,std::string element)
errorstream<< "Invalid bgcolor element(" << parts.size() << "): '" << element << "'" << std::endl;
}
-void GUIFormSpecMenu::parseListColors(parserData* data,std::string element) {
+void GUIFormSpecMenu::parseListColors(parserData* data,std::string element)
+{
std::vector<std::string> parts = split(element,';');
if ((parts.size() == 2) || (parts.size() == 3) || (parts.size() == 5)) {
@@ -1408,8 +1440,8 @@ void GUIFormSpecMenu::parseListColors(parserData* data,std::string element) {
errorstream<< "Invalid listcolors element(" << parts.size() << "): '" << element << "'" << std::endl;
}
-void GUIFormSpecMenu::parseElement(parserData* data,std::string element) {
-
+void GUIFormSpecMenu::parseElement(parserData* data,std::string element)
+{
//some prechecks
if (element == "")
return;
@@ -2132,16 +2164,22 @@ ItemStack GUIFormSpecMenu::verifySelectedItem()
return ItemStack();
}
-void GUIFormSpecMenu::acceptInput(bool quit=false)
+void GUIFormSpecMenu::acceptInput(FormspecQuitMode quitmode=quit_mode_no)
{
if(m_text_dst)
{
std::map<std::string, std::string> fields;
- if (quit) {
+ if (quitmode == quit_mode_accept) {
fields["quit"] = "true";
}
+ if (quitmode == quit_mode_cancel) {
+ fields["quit"] = "true";
+ m_text_dst->gotText(fields);
+ return;
+ }
+
if (current_keys_pending.key_down) {
fields["key_down"] = "true";
current_keys_pending.key_down = false;
@@ -2281,10 +2319,10 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
if (event.KeyInput.PressedDown && (kp == EscapeKey ||
kp == getKeySetting("keymap_inventory")))
{
- if (m_allowclose) {
- acceptInput(true);
+ if (m_allowclose){
+ acceptInput(quit_mode_cancel);
quitMenu();
- } else {
+ } else {
m_text_dst->gotText(narrow_to_wide("MenuQuit"));
}
return true;
@@ -2313,7 +2351,7 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
break;
}
if (current_keys_pending.key_enter && m_allowclose) {
- acceptInput(true);
+ acceptInput(quit_mode_accept);
quitMenu();
}
else {
@@ -2643,7 +2681,7 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
if (btn_id == 257) {
if (m_allowclose) {
- acceptInput(true);
+ acceptInput(quit_mode_accept);
quitMenu();
} else {
acceptInput();
@@ -2666,7 +2704,7 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
acceptInput();
if(s.is_exit){
if (m_allowclose) {
- acceptInput(true);
+ acceptInput(quit_mode_accept);
quitMenu();
} else {
m_text_dst->gotText(narrow_to_wide("ExitButton"));
@@ -2685,7 +2723,7 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
{
if (m_allowclose) {
- acceptInput(true);
+ acceptInput(quit_mode_accept);
quitMenu();
}
else {
@@ -2723,7 +2761,8 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
return Parent ? Parent->OnEvent(event) : false;
}
-bool GUIFormSpecMenu::parseColor(const std::string &value, video::SColor &color, bool quiet)
+bool GUIFormSpecMenu::parseColor(const std::string &value, video::SColor &color,
+ bool quiet)
{
const char *hexpattern = NULL;
if (value[0] == '#') {
diff --git a/src/guiFormSpecMenu.h b/src/guiFormSpecMenu.h
index 1946f88eb..858894e5c 100644
--- a/src/guiFormSpecMenu.h
+++ b/src/guiFormSpecMenu.h
@@ -42,12 +42,22 @@ typedef enum {
f_Unknown
} FormspecFieldType;
+typedef enum {
+ quit_mode_no,
+ quit_mode_accept,
+ quit_mode_cancel
+} FormspecQuitMode;
+
struct TextDest
{
virtual ~TextDest() {};
// This is deprecated I guess? -celeron55
virtual void gotText(std::wstring text){}
virtual void gotText(std::map<std::string, std::string> fields) = 0;
+ virtual void setFormName(std::string formname)
+ { m_formname = formname;};
+
+ std::string m_formname;
};
class IFormSource
@@ -139,7 +149,8 @@ class GUIFormSpecMenu : public GUIModalMenu
FieldSpec()
{
}
- FieldSpec(const std::wstring name, const std::wstring label, const std::wstring fdeflt, int id):
+ FieldSpec(const std::wstring name, const std::wstring label,
+ const std::wstring fdeflt, int id) :
fname(name),
flabel(label),
fdefault(fdeflt),
@@ -228,7 +239,7 @@ public:
void updateSelectedItem();
ItemStack verifySelectedItem();
- void acceptInput(bool quit);
+ void acceptInput(FormspecQuitMode quitmode);
bool preprocessEvent(const SEvent& event);
bool OnEvent(const SEvent& event);
@@ -332,7 +343,8 @@ private:
void parsePwdField(parserData* data,std::string element);
void parseField(parserData* data,std::string element,std::string type);
void parseSimpleField(parserData* data,std::vector<std::string> &parts);
- void parseTextArea(parserData* data,std::vector<std::string>& parts,std::string type);
+ void parseTextArea(parserData* data,std::vector<std::string>& parts,
+ std::string type);
void parseLabel(parserData* data,std::string element);
void parseVertLabel(parserData* data,std::string element);
void parseImageButton(parserData* data,std::string element,std::string type);
diff --git a/src/guiMessageMenu.cpp b/src/guiMessageMenu.cpp
deleted file mode 100644
index dd9c0a261..000000000
--- a/src/guiMessageMenu.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
-Minetest
-Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation; either version 2.1 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along
-with this program; if not, write to the Free Software Foundation, Inc.,
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
-
-#include "guiMessageMenu.h"
-#include "debug.h"
-#include "serialization.h"
-#include <string>
-#include <IGUICheckBox.h>
-#include <IGUIEditBox.h>
-#include <IGUIButton.h>
-#include <IGUIStaticText.h>
-#include <IGUIFont.h>
-
-#include "gettext.h"
-
-GUIMessageMenu::GUIMessageMenu(gui::IGUIEnvironment* env,
- gui::IGUIElement* parent, s32 id,
- IMenuManager *menumgr,
- std::wstring message_text
-):
- GUIModalMenu(env, parent, id, menumgr),
- m_message_text(message_text),
- m_status(false)
-{
-}
-
-GUIMessageMenu::~GUIMessageMenu()
-{
- removeChildren();
-}
-
-void GUIMessageMenu::removeChildren()
-{
- {
- gui::IGUIElement *e = getElementFromId(256);
- if(e != NULL)
- e->remove();
- }
- {
- gui::IGUIElement *e = getElementFromId(257);
- if(e != NULL)
- e->remove();
- }
-}
-
-void GUIMessageMenu::regenerateGui(v2u32 screensize)
-{
- /*
- Remove stuff
- */
- removeChildren();
-
- /*
- Calculate new sizes and positions
- */
- core::rect<s32> rect(
- screensize.X/2 - 580/2,
- screensize.Y/2 - 300/2,
- screensize.X/2 + 580/2,
- screensize.Y/2 + 300/2
- );
-
- DesiredRect = rect;
- recalculateAbsolutePosition(false);
-
- v2s32 size = rect.getSize();
-
- gui::IGUISkin *skin = Environment->getSkin();
- gui::IGUIFont *font = skin->getFont();
- s32 msg_h = font->getDimension(m_message_text.c_str()).Height;
- s32 msg_w = font->getDimension(m_message_text.c_str()).Width;
- if(msg_h > 200)
- msg_h = 200;
- if(msg_w > 540)
- msg_w = 540;
-
- /*
- Add stuff
- */
- {
- core::rect<s32> rect(0, 0, msg_w, msg_h);
- rect += v2s32(size.X/2-msg_w/2, size.Y/2-30/2 - msg_h/2);
- Environment->addStaticText(m_message_text.c_str(),
- rect, false, true, this, -1);
- }
-
- int bw = 140;
- {
- core::rect<s32> rect(0, 0, bw, 30);
- rect = rect + v2s32(size.X/2-bw/2, size.Y/2-30/2+5 + msg_h/2);
- wchar_t* text = wgettext("Proceed");
- gui::IGUIElement *e =
- Environment->addButton(rect, this, 257,
- text);
- Environment->setFocus(e);
- delete[] text;
- }
-}
-
-void GUIMessageMenu::drawMenu()
-{
- gui::IGUISkin* skin = Environment->getSkin();
- if (!skin)
- return;
- video::IVideoDriver* driver = Environment->getVideoDriver();
-
- video::SColor bgcolor(140,0,0,0);
- driver->draw2DRectangle(bgcolor, AbsoluteRect, &AbsoluteClippingRect);
-
- gui::IGUIElement::draw();
-}
-
-bool GUIMessageMenu::OnEvent(const SEvent& event)
-{
- if(event.EventType==EET_KEY_INPUT_EVENT)
- {
- if(event.KeyInput.Key==KEY_ESCAPE && event.KeyInput.PressedDown)
- {
- m_status = true;
- quitMenu();
- return true;
- }
- if(event.KeyInput.Key==KEY_RETURN && event.KeyInput.PressedDown)
- {
- m_status = true;
- quitMenu();
- return true;
- }
- }
- if(event.EventType==EET_GUI_EVENT)
- {
- if(event.GUIEvent.EventType==gui::EGET_ELEMENT_FOCUS_LOST
- && isVisible())
- {
- if(!canTakeFocus(event.GUIEvent.Element))
- {
- dstream<<"GUIMessageMenu: Not allowing focus change."
- <<std::endl;
- // Returning true disables focus change
- return true;
- }
- }
- if(event.GUIEvent.EventType==gui::EGET_BUTTON_CLICKED)
- {
- switch(event.GUIEvent.Caller->getID())
- {
- case 257:
- m_status = true;
- quitMenu();
- return true;
- }
- }
- }
-
- return Parent ? Parent->OnEvent(event) : false;
-}
-
diff --git a/src/guiMessageMenu.h b/src/guiMessageMenu.h
deleted file mode 100644
index 8ec8e4a41..000000000
--- a/src/guiMessageMenu.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-Minetest
-Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation; either version 2.1 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along
-with this program; if not, write to the Free Software Foundation, Inc.,
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
-
-#ifndef GUIMESSAGEMENU_HEADER
-#define GUIMESSAGEMENU_HEADER
-
-#include "irrlichttypes_extrabloated.h"
-#include "modalMenu.h"
-#include <string>
-
-class GUIMessageMenu : public GUIModalMenu
-{
-public:
- GUIMessageMenu(gui::IGUIEnvironment* env,
- gui::IGUIElement* parent, s32 id,
- IMenuManager *menumgr,
- std::wstring message_text);
- ~GUIMessageMenu();
-
- void removeChildren();
- /*
- Remove and re-add (or reposition) stuff
- */
- void regenerateGui(v2u32 screensize);
-
- void drawMenu();
-
- bool OnEvent(const SEvent& event);
-
- /*
- true = ok'd
- */
- bool getStatus()
- {
- return m_status;
- }
-
-private:
- std::wstring m_message_text;
- bool m_status;
-};
-
-#endif
-
diff --git a/src/guiPauseMenu.cpp b/src/guiPauseMenu.cpp
deleted file mode 100644
index 4d5070c9b..000000000
--- a/src/guiPauseMenu.cpp
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
-Minetest
-Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation; either version 2.1 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along
-with this program; if not, write to the Free Software Foundation, Inc.,
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
-
-#include "guiPauseMenu.h"
-#include "debug.h"
-#include "serialization.h"
-#include "porting.h"
-#include "config.h"
-#include "version.h"
-#include "main.h"
-#include <IGUICheckBox.h>
-#include <IGUIEditBox.h>
-#include <IGUIButton.h>
-#include <IGUIStaticText.h>
-#include <IGUIFont.h>
-#include "gettext.h"
-#include "util/string.h"
-
-GUIPauseMenu::GUIPauseMenu(gui::IGUIEnvironment* env,
- gui::IGUIElement* parent, s32 id,
- IGameCallback *gamecallback,
- IMenuManager *menumgr,
- bool simple_singleplayer_mode):
- GUIModalMenu(env, parent, id, menumgr),
- m_gamecallback(gamecallback),
- m_simple_singleplayer_mode(simple_singleplayer_mode)
-{
-}
-
-GUIPauseMenu::~GUIPauseMenu()
-{
- removeChildren();
-}
-
-void GUIPauseMenu::removeChildren()
-{
- {
- gui::IGUIElement *e = getElementFromId(256);
- if(e != NULL)
- e->remove();
- }
- {
- gui::IGUIElement *e = getElementFromId(257);
- if(e != NULL)
- e->remove();
- }
- {
- gui::IGUIElement *e = getElementFromId(258);
- if(e != NULL)
- e->remove();
- }
- {
- gui::IGUIElement *e = getElementFromId(259);
- if(e != NULL)
- e->remove();
- }
- {
- gui::IGUIElement *e = getElementFromId(260);
- if(e != NULL)
- e->remove();
- }
- {
- gui::IGUIElement *e = getElementFromId(261);
- if(e != NULL)
- e->remove();
- }
- {
- gui::IGUIElement *e = getElementFromId(262);
- if(e != NULL)
- e->remove();
- }
-}
-
-void GUIPauseMenu::regenerateGui(v2u32 screensize)
-{
- /*
- Remove stuff
- */
- removeChildren();
-
- /*
- Calculate new sizes and positions
- */
- core::rect<s32> rect(
- screensize.X/2 - 580/2,
- screensize.Y/2 - 300/2,
- screensize.X/2 + 580/2,
- screensize.Y/2 + 300/2
- );
-
- DesiredRect = rect;
- recalculateAbsolutePosition(false);
-
- v2s32 size = rect.getSize();
-
- /*
- Add stuff
- */
- const s32 btn_height = 30;
- const s32 btn_gap = 20;
- const s32 btn_num = m_simple_singleplayer_mode ? 4 : 5;
- s32 btn_y = size.Y/2-((btn_num*btn_height+(btn_num-1)*btn_gap))/2;
- {
- core::rect<s32> rect(0, 0, 140, btn_height);
- rect = rect + v2s32(size.X/2-140/2, btn_y);
- wchar_t* text = wgettext("Continue");
- Environment->addButton(rect, this, 256,
- text);
- delete[] text;
- }
- btn_y += btn_height + btn_gap;
- if(!m_simple_singleplayer_mode)
- {
- {
- core::rect<s32> rect(0, 0, 140, btn_height);
- rect = rect + v2s32(size.X/2-140/2, btn_y);
- wchar_t* text = wgettext("Change Password");
- Environment->addButton(rect, this, 261,
- text);
- delete[] text;
- }
- btn_y += btn_height + btn_gap;
- }
- {
- core::rect<s32> rect(0, 0, 140, btn_height);
- rect = rect + v2s32(size.X/2-140/2, btn_y);
- wchar_t* text = wgettext("Sound Volume");
- Environment->addButton(rect, this, 262,
- text);
- delete[] text;
- }
- btn_y += btn_height + btn_gap;
- {
- core::rect<s32> rect(0, 0, 140, btn_height);
- rect = rect + v2s32(size.X/2-140/2, btn_y);
- wchar_t* text = wgettext("Exit to Menu");
- Environment->addButton(rect, this, 260,
- text);
- delete[] text;
- }
- btn_y += btn_height + btn_gap;
- {
- core::rect<s32> rect(0, 0, 140, btn_height);
- rect = rect + v2s32(size.X/2-140/2, btn_y);
- wchar_t* text = wgettext("Exit to OS");
- Environment->addButton(rect, this, 257,
- text);
- delete[] text;
- }
-
- {
- core::rect<s32> rect(0, 0, 180, 240);
- rect = rect + v2s32(size.X/2 + 90, size.Y/2-rect.getHeight()/2);
- wchar_t* text = wgettext("Default Controls:\n"
- "- WASD: move\n"
- "- Space: jump/climb\n"
- "- Shift: sneak/go down\n"
- "- Q: drop item\n"
- "- I: inventory\n"
- "- Mouse: turn/look\n"
- "- Mouse left: dig/punch\n"
- "- Mouse right: place/use\n"
- "- Mouse wheel: select item\n"
- "- T: chat\n"
- );
- Environment->addStaticText(text, rect, false, true, this, 258);
- delete[] text;
-
- }
- {
- core::rect<s32> rect(0, 0, 180, 220);
- rect = rect + v2s32(size.X/2 - 90 - rect.getWidth(), size.Y/2-rect.getHeight()/2);
-
- v2u32 max_texture_size;
- {
- video::IVideoDriver* driver = Environment->getVideoDriver();
- max_texture_size = driver->getMaxTextureSize();
- }
-
- std::ostringstream os;
- os<<"Minetest\n";
- os<<minetest_build_info<<"\n";
- os<<"path_user = "<<wrap_rows(porting::path_user, 20)<<"\n";
-
- Environment->addStaticText(narrow_to_wide(os.str()).c_str(), rect, false, true, this, 259);
- }
-}
-
-void GUIPauseMenu::drawMenu()
-{
- gui::IGUISkin* skin = Environment->getSkin();
- if (!skin)
- return;
- video::IVideoDriver* driver = Environment->getVideoDriver();
-
- video::SColor bgcolor(140,0,0,0);
- driver->draw2DRectangle(bgcolor, AbsoluteRect, &AbsoluteClippingRect);
-
- gui::IGUIElement::draw();
-}
-
-bool GUIPauseMenu::OnEvent(const SEvent& event)
-{
-
- if(event.EventType==EET_KEY_INPUT_EVENT)
- {
- if(event.KeyInput.PressedDown)
- {
- if(event.KeyInput.Key==KEY_ESCAPE)
- {
- quitMenu();
- return true;
- }
- else if(event.KeyInput.Key==KEY_RETURN)
- {
- quitMenu();
- return true;
- }
- }
- }
- if(event.EventType==EET_GUI_EVENT)
- {
- if(event.GUIEvent.EventType==gui::EGET_ELEMENT_FOCUS_LOST
- && isVisible())
- {
- if(!canTakeFocus(event.GUIEvent.Element))
- {
- dstream<<"GUIPauseMenu: Not allowing focus change."
- <<std::endl;
- // Returning true disables focus change
- return true;
- }
- }
- if(event.GUIEvent.EventType==gui::EGET_BUTTON_CLICKED)
- {
- switch(event.GUIEvent.Caller->getID())
- {
- case 256: // continue
- quitMenu();
- // ALWAYS return immediately after quitMenu()
- return true;
- case 261:
- m_gamecallback->changePassword();
- quitMenu();
- return true;
- case 262:
- m_gamecallback->changeVolume();
- quitMenu();
- return true;
- case 260: // disconnect
- m_gamecallback->disconnect();
- quitMenu();
- return true;
- case 257: // exit
- m_gamecallback->exitToOS();
- quitMenu();
- return true;
- }
- }
- }
-
- return Parent ? Parent->OnEvent(event) : false;
-}
-
diff --git a/src/guiPauseMenu.h b/src/guiPauseMenu.h
deleted file mode 100644
index 2808c93b1..000000000
--- a/src/guiPauseMenu.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
-Minetest
-Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation; either version 2.1 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along
-with this program; if not, write to the Free Software Foundation, Inc.,
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
-
-#ifndef GUIPAUSEMENU_HEADER
-#define GUIPAUSEMENU_HEADER
-
-#include "irrlichttypes_extrabloated.h"
-#include "modalMenu.h"
-
-class IGameCallback
-{
-public:
- virtual void exitToOS() = 0;
- virtual void disconnect() = 0;
- virtual void changePassword() = 0;
- virtual void changeVolume() = 0;
-};
-
-class GUIPauseMenu : public GUIModalMenu
-{
-public:
- GUIPauseMenu(gui::IGUIEnvironment* env,
- gui::IGUIElement* parent, s32 id,
- IGameCallback *gamecallback,
- IMenuManager *menumgr,
- bool simple_singleplayer_mode);
- ~GUIPauseMenu();
-
- void removeChildren();
- /*
- Remove and re-add (or reposition) stuff
- */
- void regenerateGui(v2u32 screensize);
-
- void drawMenu();
-
- bool OnEvent(const SEvent& event);
-
- bool pausesGame(){ return true; }
-
-private:
- IGameCallback *m_gamecallback;
- bool m_simple_singleplayer_mode;
-};
-
-#endif
-
diff --git a/src/main.cpp b/src/main.cpp
index 583127944..e52002772 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -55,7 +55,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "constants.h"
#include "porting.h"
#include "gettime.h"
-#include "guiMessageMenu.h"
#include "filesys.h"
#include "config.h"
#include "version.h"
diff --git a/src/mainmenumanager.h b/src/mainmenumanager.h
index ecfb89fd3..78ae1fcfa 100644
--- a/src/mainmenumanager.h
+++ b/src/mainmenumanager.h
@@ -25,9 +25,17 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/
#include "debug.h" // assert
#include "modalMenu.h"
-#include "guiPauseMenu.h" //For IGameCallback
#include <list>
+class IGameCallback
+{
+public:
+ virtual void exitToOS() = 0;
+ virtual void disconnect() = 0;
+ virtual void changePassword() = 0;
+ virtual void changeVolume() = 0;
+};
+
extern gui::IGUIEnvironment* guienv;
extern gui::IGUIStaticText *guiroot;