aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMushiden <mushiden@hotmail.com>2014-09-21 00:21:11 -0300
committerShadowNinja <shadowninja@minetest.net>2014-10-07 17:24:09 -0400
commit7b548cd2b53a6ce834c869f818fb74a5b96680a5 (patch)
tree1646dc5ed5b01f715db6be62e2d7af78610ff39c
parentb98e8d6da8bf8c9295462ba7a9604170455454d1 (diff)
downloadminetest-7b548cd2b53a6ce834c869f818fb74a5b96680a5.tar.gz
minetest-7b548cd2b53a6ce834c869f818fb74a5b96680a5.tar.bz2
minetest-7b548cd2b53a6ce834c869f818fb74a5b96680a5.zip
Add in-game key change menu
-rw-r--r--src/game.cpp16
-rw-r--r--src/mainmenumanager.h9
2 files changed, 25 insertions, 0 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 12bc695a6..774d8f03e 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -30,6 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "server.h"
#include "guiPasswordChange.h"
#include "guiVolumeChange.h"
+#include "guiKeyChangeMenu.h"
#include "guiFormSpecMenu.h"
#include "tool.h"
#include "guiChatConsole.h"
@@ -151,6 +152,11 @@ struct LocalFormspecHandler : public TextDest
return;
}
+ if (fields.find("btn_key_config") != fields.end()) {
+ g_gamecallback->keyConfig();
+ return;
+ }
+
if (fields.find("btn_exit_menu") != fields.end()) {
g_gamecallback->disconnect();
return;
@@ -1044,6 +1050,8 @@ static void show_pause_menu(GUIFormSpecMenu** cur_formspec,
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_sound;"
<< wide_to_narrow(wstrgettext("Sound Volume")) << "]";
+ os << "button_exit[4," << (ypos++) << ";3,0.5;btn_key_config;"
+ << wide_to_narrow(wstrgettext("Change Keys")) << "]";
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_exit_menu;"
<< wide_to_narrow(wstrgettext("Exit to Menu")) << "]";
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_exit_os;"
@@ -1877,6 +1885,14 @@ void the_game(bool &kill, bool random_input, InputHandler *input,
g_gamecallback->changevolume_requested = false;
}
+ if(g_gamecallback->keyconfig_requested)
+ {
+ (new GUIKeyChangeMenu(guienv, guiroot, -1,
+ &g_menumgr))->drop();
+ g_gamecallback->keyconfig_requested = false;
+ }
+
+
/* Process TextureSource's queue */
tsrc->processQueue();
diff --git a/src/mainmenumanager.h b/src/mainmenumanager.h
index 28fe1ac11..56ba40129 100644
--- a/src/mainmenumanager.h
+++ b/src/mainmenumanager.h
@@ -31,6 +31,7 @@ class IGameCallback
{
public:
virtual void exitToOS() = 0;
+ virtual void keyConfig() = 0;
virtual void disconnect() = 0;
virtual void changePassword() = 0;
virtual void changeVolume() = 0;
@@ -124,6 +125,7 @@ public:
disconnect_requested(false),
changepassword_requested(false),
changevolume_requested(false),
+ keyconfig_requested(false),
shutdown_requested(false),
device(a_device)
{
@@ -151,10 +153,17 @@ public:
{
changevolume_requested = true;
}
+
+ virtual void keyConfig()
+ {
+ keyconfig_requested = true;
+ }
+
bool disconnect_requested;
bool changepassword_requested;
bool changevolume_requested;
+ bool keyconfig_requested;
bool shutdown_requested;
IrrlichtDevice *device;
};