From 5c734fe66e9ace93c03937adc2fc56336fb474fb Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 23 Feb 2008 17:10:35 +0000 Subject: client chatbox and message notifications --- src/client/input.cc | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'src/client/input.cc') 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: -- cgit v1.2.3