diff options
Diffstat (limited to 'src/client/input.cc')
-rw-r--r-- | src/client/input.cc | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/client/input.cc b/src/client/input.cc index c9c2514..b339574 100644 --- a/src/client/input.cc +++ b/src/client/input.cc @@ -7,6 +7,7 @@ #include "core/core.h" #include "client/client.h" #include "client/input.h" +#include "client/chat.h" #include "client/console.h" #include "client/camera.h" #include "client/keyboard.h" @@ -115,12 +116,29 @@ void frame(float seconds) case SDL_KEYDOWN: if (event.key.keysym.sym == '`' || event.key.keysym.sym == '~') { console::toggle(); + setkeyboardmode(console::visible()); + if (console::visible() && chat::visible()) + chat::toggle(); } else if (console::visible()) { // send key events to the console console::keypressed(translate_keysym(event.key.keysym)); - } else if (core::application()->connected() && core::localcontrol()) { - // send key events to the game world - keypressed(event.key.keysym); + + } else if (chat::visible()) { + if(event.key.keysym.sym == SDLK_ESCAPE) { + chat::toggle(); + setkeyboardmode(chat::visible()); + } else { + // send key events to the chatbox + chat::keypressed(translate_keysym(event.key.keysym)); + } + } else if(core::application()->connected()) { + if ((event.key.keysym.sym == 't') || (event.key.keysym.sym == 'T')) { + chat::toggle(); + setkeyboardmode(chat::visible()); + } else if (core::localcontrol()) { + // send key events to the game world + keypressed(event.key.keysym); + } } break; case SDL_QUIT: |