Definition at line 12 of file StateInput.h.
Public Member Functions | |
StateInput (GameState *state) | |
Create state input handler. | |
~StateInput () | |
virtual void | keyEvent (const KeyStroke &stroke) |
Inspects keystroke and call:
| |
Protected Member Functions | |
virtual void | quitState () |
virtual void | enableConsole () |
virtual void | enableHelp () |
virtual void | enableMenu () |
virtual void | enableSubtitles () |
virtual void | specStroke (const KeyStroke &) |
virtual void | specKey (int keyIndex) |
void | toggleParam (const std::string ¶m) |
Protected Attributes | |
Keymap * | m_keymap |
GameState * | m_state |
Static Protected Attributes | |
static const int | KEY_QUIT = 1 |
static const int | KEY_CONSOLE = 2 |
static const int | KEY_HELP = 3 |
static const int | KEY_MENU = 4 |
static const int | KEY_SUBTITLES = 5 |
|
Create state input handler.
Definition at line 24 of file StateInput.cpp. 00025 { 00026 m_state = state; 00027 m_keymap = new Keymap(); 00028 KeyDesc key_quit(KEY_QUIT, "quit"); 00029 KeyDesc key_console(KEY_CONSOLE, "debug console"); 00030 KeyDesc key_help(KEY_HELP, "help screen"); 00031 KeyDesc key_menu(KEY_MENU, "game menu"); 00032 m_keymap->registerKey(KeyStroke(SDLK_ESCAPE, KMOD_NONE), key_quit); 00033 m_keymap->registerKey(KeyStroke(SDLK_BACKQUOTE, KMOD_NONE), key_console); 00034 m_keymap->registerKey(KeyStroke(SDLK_F1, KMOD_NONE), key_help); 00035 m_keymap->registerKey(KeyStroke(SDLK_F10, KMOD_NONE), key_menu); 00036 m_keymap->registerKey(KeyStroke(SDLK_F6, KMOD_NONE), 00037 KeyDesc(KEY_SUBTITLES, "enable subtitles")); 00038 }
|
|
Definition at line 40 of file StateInput.cpp. 00041 { 00042 delete m_keymap; 00043 }
|
|
Reimplemented in ConsoleInput. Definition at line 94 of file StateInput.cpp. 00095 { 00096 m_state->pushState(new KeyConsole()); 00097 }
|
|
Reimplemented in PedoInput, WorldInput, HelpInput, DemoInput, and GameInput. Definition at line 24 of file StateInput.h. 00024 {};
|
|
Reimplemented in HelpInput, OptionsInput, and GameInput. Definition at line 25 of file StateInput.h. 00025 {};
|
|
Reimplemented in PedoInput, WorldInput, and ConsoleInput. Definition at line 100 of file StateInput.cpp. 00101 { 00102 toggleParam("subtitles"); 00103 }
|
|
Inspects keystroke and call:
Reimplemented from InputHandler. Definition at line 52 of file StateInput.cpp. 00053 { 00054 int index = m_keymap->indexPressed(stroke); 00055 switch (index) { 00056 case KEY_QUIT: 00057 quitState(); 00058 break; 00059 case KEY_CONSOLE: 00060 enableConsole(); 00061 break; 00062 case KEY_HELP: 00063 enableHelp(); 00064 break; 00065 case KEY_MENU: 00066 enableMenu(); 00067 break; 00068 case KEY_SUBTITLES: 00069 enableSubtitles(); 00070 break; 00071 case -1: 00072 specStroke(stroke); 00073 break; 00074 default: 00075 specKey(index); 00076 break; 00077 } 00078 }
|
|
Definition at line 88 of file StateInput.cpp.
|
|
Reimplemented in LevelInput, and ConsoleInput. Definition at line 81 of file StateInput.cpp. 00082 { 00083 LOG_WARNING(ExInfo("unknown key") 00084 .addInfo("keyIndex", keyIndex)); 00085 }
|
|
Reimplemented in LevelInput, HelpInput, and ConsoleInput. Definition at line 27 of file StateInput.h. 00027 {}
|
|
Definition at line 106 of file StateInput.cpp. 00107 { 00108 OptionAgent *option = OptionAgent::agent(); 00109 bool enable = option->getAsBool(param); 00110 00111 option->setPersistent(param, !enable); 00112 }
|
|
Definition at line 15 of file StateInput.h. |
|
Definition at line 16 of file StateInput.h. |
|
Definition at line 17 of file StateInput.h. |
|
Definition at line 14 of file StateInput.h. |
|
Definition at line 18 of file StateInput.h. |
|
Definition at line 19 of file StateInput.h. |
|
Definition at line 20 of file StateInput.h. |