From b5723cbd822b2359850c121ca69e682a607d91bd Mon Sep 17 00:00:00 2001 From: oroborus Date: Sun, 3 Aug 2008 18:46:22 +0000 Subject: - pridany kapov patch na klavesy - widget na nastavovanie klaves sa rozsvieti, ked je aktivny git-svn-id: http://opensvn.csie.org/tuxanci_ng@189 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e --- src/client/interface.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'src/client/interface.c') diff --git a/src/client/interface.c b/src/client/interface.c index 2c45110..37aa361 100755 --- a/src/client/interface.c +++ b/src/client/interface.c @@ -6,6 +6,7 @@ #include "interface.h" #include "screen.h" +#include "keyboardBuffer.h" // window surface static SDL_Surface *screen; @@ -19,6 +20,9 @@ static Uint32 g_win_flags = SDL_HWSURFACE|SDL_DOUBLEBUF; static bool_t isInterfaceInit = FALSE; +// flag, kterym se ridi zarazovani klaves do bufferu +bool_t keyboardBufferEnabled = FALSE; + bool_t isInterfaceInicialized() { return isInterfaceInit; @@ -37,6 +41,14 @@ static Uint32 TimerCallback(Uint32 interval, void *param) return interval; } +void enableKeyboardBuffer(){ + keyboardBufferEnabled=TRUE; +} + +void disableKeyboardBuffer(){ + keyboardBufferEnabled=FALSE; +} + int initSDL() { printf("init SDL..\n"); @@ -70,9 +82,11 @@ int initSDL() SDL_WM_SetCaption(WINDOW_TITLE, NULL); //SDL_ShowCursor(0); - SDL_EnableKeyRepeat(1,1); + SDL_EnableKeyRepeat(0,1); timer = SDL_AddTimer(INTERVAL, TimerCallback, NULL); + initKeyboardBuffer(KEYBOARD_BUFFER_SIZE); + srand((unsigned)time(NULL)); isInterfaceInit = TRUE; @@ -199,6 +213,9 @@ int eventAction() break; default: + //neni potreba vyuzivat frontu stale + if (keyboardBufferEnabled==TRUE) + pushKeyToKeyboardBuffer(event.key.keysym); break; } break; @@ -252,6 +269,9 @@ void eventSDL() void quitSDL() { printf("quit SDL..\n"); + quitKeyboardBuffer(); + SDL_Quit(); + isInterfaceInit = FALSE; } -- cgit v1.2.3