diff options
| author | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-08-03 18:46:22 +0000 |
|---|---|---|
| committer | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-08-03 18:46:22 +0000 |
| commit | b5723cbd822b2359850c121ca69e682a607d91bd (patch) | |
| tree | c731a5c07d6188b1bdce6e90b5ac02e35800716d /src/client/interface.c | |
| parent | 00c9cebac684c42741e924d11038d5591e87dacd (diff) | |
- 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
Diffstat (limited to 'src/client/interface.c')
| -rwxr-xr-x | src/client/interface.c | 22 |
1 files changed, 21 insertions, 1 deletions
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; } |