]> git.lizzy.rs Git - minetest.git/blobdiff - src/guiPauseMenu.cpp
Allow the LUA API to set animations to meshes as well as the animation speed. Also...
[minetest.git] / src / guiPauseMenu.cpp
index d32d1a10b375024d48fd9de457c695ef3956b110..96fd7d67676b3b10fd517f9f9928119384d53db5 100644 (file)
@@ -3,16 +3,16 @@ Minetest-c55
 Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>\r
 \r
 This program is free software; you can redistribute it and/or modify\r
-it under the terms of the GNU General Public License as published by\r
-the Free Software Foundation; either version 2 of the License, or\r
+it under the terms of the GNU Lesser General Public License as published by\r
+the Free Software Foundation; either version 2.1 of the License, or\r
 (at your option) any later version.\r
 \r
 This program is distributed in the hope that it will be useful,\r
 but WITHOUT ANY WARRANTY; without even the implied warranty of\r
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-GNU General Public License for more details.\r
+GNU Lesser General Public License for more details.\r
 \r
-You should have received a copy of the GNU General Public License along\r
+You should have received a copy of the GNU Lesser General Public License along\r
 with this program; if not, write to the Free Software Foundation, Inc.,\r
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
 */\r
@@ -23,14 +23,23 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "porting.h"\r
 #include "config.h"\r
 #include "main.h"\r
+#include <IGUICheckBox.h>\r
+#include <IGUIEditBox.h>\r
+#include <IGUIButton.h>\r
+#include <IGUIStaticText.h>\r
+#include <IGUIFont.h>\r
+#include "gettext.h"\r
+#include "util/string.h"\r
 \r
 GUIPauseMenu::GUIPauseMenu(gui::IGUIEnvironment* env,\r
                gui::IGUIElement* parent, s32 id,\r
                IGameCallback *gamecallback,\r
-               IMenuManager *menumgr):\r
-       GUIModalMenu(env, parent, id, menumgr)\r
+               IMenuManager *menumgr,\r
+               bool simple_singleplayer_mode):\r
+       GUIModalMenu(env, parent, id, menumgr),\r
+       m_gamecallback(gamecallback),\r
+       m_simple_singleplayer_mode(simple_singleplayer_mode)\r
 {\r
-       m_gamecallback = gamecallback;\r
 }\r
 \r
 GUIPauseMenu::~GUIPauseMenu()\r
@@ -99,48 +108,56 @@ void GUIPauseMenu::regenerateGui(v2u32 screensize)
        */\r
        const s32 btn_height = 30;\r
        const s32 btn_gap = 20;\r
-       const s32 btn_num = 4;\r
+       const s32 btn_num = m_simple_singleplayer_mode ? 3 : 4;\r
        s32 btn_y = size.Y/2-((btn_num*btn_height+(btn_num-1)*btn_gap))/2;\r
+       changeCtype("");\r
        {\r
                core::rect<s32> rect(0, 0, 140, btn_height);\r
                rect = rect + v2s32(size.X/2-140/2, btn_y);\r
-               Environment->addButton(rect, this, 256, L"Continue");\r
+               Environment->addButton(rect, this, 256,\r
+                       wgettext("Continue"));\r
        }\r
        btn_y += btn_height + btn_gap;\r
+       if(!m_simple_singleplayer_mode)\r
        {\r
-               core::rect<s32> rect(0, 0, 140, btn_height);\r
-               rect = rect + v2s32(size.X/2-140/2, btn_y);\r
-               Environment->addButton(rect, this, 261, L"Change Password");\r
+               {\r
+                       core::rect<s32> rect(0, 0, 140, btn_height);\r
+                       rect = rect + v2s32(size.X/2-140/2, btn_y);\r
+                       Environment->addButton(rect, this, 261,\r
+                               wgettext("Change Password"));\r
+               }\r
+               btn_y += btn_height + btn_gap;\r
        }\r
-       btn_y += btn_height + btn_gap;\r
        {\r
                core::rect<s32> rect(0, 0, 140, btn_height);\r
                rect = rect + v2s32(size.X/2-140/2, btn_y);\r
-               Environment->addButton(rect, this, 260, L"Disconnect");\r
+               Environment->addButton(rect, this, 260,\r
+                       wgettext("Exit to Menu"));\r
        }\r
        btn_y += btn_height + btn_gap;\r
        {\r
                core::rect<s32> rect(0, 0, 140, btn_height);\r
                rect = rect + v2s32(size.X/2-140/2, btn_y);\r
-               Environment->addButton(rect, this, 257, L"Exit to OS");\r
+               Environment->addButton(rect, this, 257,\r
+                       wgettext("Exit to OS"));\r
        }\r
 \r
        {\r
                core::rect<s32> rect(0, 0, 180, 240);\r
                rect = rect + v2s32(size.X/2 + 90, size.Y/2-rect.getHeight()/2);\r
-               const wchar_t *text =\r
-               L"Keys:\n"\r
-               L"- WASD: Walk\n"\r
-               L"- Mouse left: dig blocks\n"\r
-               L"- Mouse right: place blocks\n"\r
-               L"- Mouse wheel: select item\n"\r
-               L"- 0...9: select item\n"\r
-               L"- Shift: sneak\n"\r
-               L"- R: Toggle viewing all loaded chunks\n"\r
-               L"- I: Inventory menu\n"\r
-               L"- ESC: This menu\n"\r
-               L"- T: Chat\n";\r
-               Environment->addStaticText(text, rect, false, true, this, 258);\r
+               Environment->addStaticText(chartowchar_t(gettext(\r
+               "Default Controls:\n"\r
+               "- WASD: Walk\n"\r
+               "- Mouse left: dig/hit\n"\r
+               "- Mouse right: place/use\n"\r
+               "- Mouse wheel: select item\n"\r
+               "- 0...9: select item\n"\r
+               "- Shift: sneak\n"\r
+               "- R: Toggle viewing all loaded chunks\n"\r
+               "- I: Inventory menu\n"\r
+               "- ESC: This menu\n"\r
+               "- T: Chat\n"\r
+               )), rect, false, true, this, 258);\r
        }\r
        {\r
                core::rect<s32> rect(0, 0, 180, 220);\r
@@ -162,18 +179,19 @@ void GUIPauseMenu::regenerateGui(v2u32 screensize)
                                SWPRINTF_CHARSTRING\r
                                ,\r
                                BUILD_INFO,\r
-                               porting::path_userdata.c_str()\r
+                               porting::path_user.c_str()\r
                );*/\r
 \r
                std::ostringstream os;\r
-               os<<"Minetest-c55\n";\r
-               os<<"by Perttu Ahola\n";\r
+               os<<"Minetest\n";\r
+               os<<"by Perttu Ahola and contributors\n";\r
                os<<"celeron55@gmail.com\n";\r
                os<<BUILD_INFO<<"\n";\r
-               os<<"ud_path = "<<wrap_rows(porting::path_userdata, 20)<<"\n";\r
+               os<<"path_user = "<<wrap_rows(porting::path_user, 20)<<"\n";\r
        \r
                Environment->addStaticText(narrow_to_wide(os.str()).c_str(), rect, false, true, this, 259);\r
        }\r
+       changeCtype("C");\r
 }\r
 \r
 void GUIPauseMenu::drawMenu()\r