From: Ingo Ruhnke Date: Mon, 18 Aug 2014 22:18:29 +0000 (+0200) Subject: Added cheat menu keyboard and joystick bindings, only visible in developer mode X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=cd105ddd05f7998e58ce545fc20e2b28606e1f1d;p=supertux.git Added cheat menu keyboard and joystick bindings, only visible in developer mode --- diff --git a/src/control/keyboard_config.cpp b/src/control/keyboard_config.cpp index a844e4072..dd2bf120f 100644 --- a/src/control/keyboard_config.cpp +++ b/src/control/keyboard_config.cpp @@ -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 diff --git a/src/supertux/menu/joystick_menu.cpp b/src/supertux/menu/joystick_menu.cpp index 96f8c7028..fa4545acb 100644 --- a/src/supertux/menu/joystick_menu.cpp +++ b/src/supertux/menu/joystick_menu.cpp @@ -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); } } diff --git a/src/supertux/menu/keyboard_menu.cpp b/src/supertux/menu/keyboard_menu.cpp index 6daef5421..9babe7a5f 100644 --- a/src/supertux/menu/keyboard_menu.cpp +++ b/src/supertux/menu/keyboard_menu.cpp @@ -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(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) {