Added cheat menu keyboard and joystick bindings, only visible in developer mode
authorIngo Ruhnke <grumbel@gmail.com>
Mon, 18 Aug 2014 22:18:29 +0000 (00:18 +0200)
committerIngo Ruhnke <grumbel@gmail.com>
Tue, 19 Aug 2014 00:35:17 +0000 (02:35 +0200)
src/control/keyboard_config.cpp
src/supertux/menu/joystick_menu.cpp
src/supertux/menu/keyboard_menu.cpp

index a844e40..dd2bf12 100644 (file)
@@ -41,7 +41,7 @@ KeyboardConfig::KeyboardConfig() :
   keymap[SDLK_PAGEDOWN] = Controller::PEEK_RIGHT;
   keymap[SDLK_HOME]     = Controller::PEEK_UP;
   keymap[SDLK_END]      = Controller::PEEK_DOWN;
-  keymap[SDLK_TAB]      = Controller::CHEAT_MENU;
+  keymap[SDLK_F1]       = Controller::CHEAT_MENU;
 }
 
 void
index 96f8c70..fa4545a 100644 (file)
@@ -75,7 +75,12 @@ JoystickMenu::recreate_menu()
       add_controlfield(Controller::PEEK_RIGHT,  _("Peek Right"));
       add_controlfield(Controller::PEEK_UP,     _("Peek Up"));
       add_controlfield(Controller::PEEK_DOWN,   _("Peek Down"));
-
+      if (g_config->developer_mode || g_config->console_enabled) {
+        add_controlfield(Controller::CONSOLE, _("Console"));
+      }
+      if (g_config->developer_mode) {
+        add_controlfield(Controller::CHEAT_MENU, _("Cheat Menu"));
+      }
       add_toggle(MNID_JUMP_WITH_UP, _("Jump with Up"), g_config->joystick_config.jump_with_up_joy);
     }
     else
@@ -219,6 +224,7 @@ JoystickMenu::refresh()
     refresh_menu_item(Controller::PEEK_RIGHT);
     refresh_menu_item(Controller::PEEK_UP);
     refresh_menu_item(Controller::PEEK_DOWN);
+    refresh_menu_item(Controller::CHEAT_MENU);
   }
 }
 
index 6daef54..9babe7a 100644 (file)
@@ -37,9 +37,12 @@ KeyboardMenu::KeyboardMenu(InputManager& input_manager) :
   add_controlfield(Controller::PEEK_RIGHT, _("Peek Right"));
   add_controlfield(Controller::PEEK_UP,    _("Peek Up"));
   add_controlfield(Controller::PEEK_DOWN,  _("Peek Down"));
-  if (g_config->console_enabled) {
+  if (g_config->developer_mode || g_config->console_enabled) {
     add_controlfield(Controller::CONSOLE, _("Console"));
   }
+  if (g_config->developer_mode) {
+    add_controlfield(Controller::CHEAT_MENU, _("Cheat Menu"));
+  }
   add_toggle(Controller::CONTROLCOUNT, _("Jump with Up"), g_config->keyboard_config.jump_with_up_kbd);
   add_hl();
   add_back(_("Back"));
@@ -84,7 +87,7 @@ KeyboardMenu::get_key_name(SDL_Keycode key)
     case SDLK_LGUI:
       return _("Left Command");
     default:
-      return SDL_GetKeyName((SDL_Keycode) key);
+      return SDL_GetKeyName(static_cast<SDL_Keycode>(key));
   }
 }
 
@@ -124,6 +127,8 @@ KeyboardMenu::refresh()
     .change_input(get_key_name(kbd_cfg.reversemap_key(Controller::PEEK_UP)));
   get_item_by_id((int) Controller::PEEK_DOWN)
     .change_input(get_key_name(kbd_cfg.reversemap_key(Controller::PEEK_DOWN)));
+  get_item_by_id((int) Controller::CHEAT_MENU)
+    .change_input(get_key_name(kbd_cfg.reversemap_key(Controller::CHEAT_MENU)));
 
   if (g_config->console_enabled)
   {