diff options
| author | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-08-23 11:44:09 +0000 |
|---|---|---|
| committer | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-08-23 11:44:09 +0000 |
| commit | c30b18c500bd0abb3362df66448febda36ff80d0 (patch) | |
| tree | 10d762326878e5991eac9d7c788cde2f3b0d0fd2 /src/client/pauza.c | |
| parent | 9c72004fada0af13e4c9b4682c733056a777dc59 (diff) | |
- hotKey API
- screen-split sa da prepinat klavesou [F3]
- TCP pouziva v setsockopt parameter SO_REUSEADDR
git-svn-id: http://opensvn.csie.org/tuxanci_ng@243 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src/client/pauza.c')
| -rw-r--r-- | src/client/pauza.c | 38 |
1 files changed, 15 insertions, 23 deletions
diff --git a/src/client/pauza.c b/src/client/pauza.c index 97bade5..a4a9a4c 100644 --- a/src/client/pauza.c +++ b/src/client/pauza.c @@ -10,17 +10,10 @@ #include "interface.h" #include "image.h" #include "pauza.h" +#include "hotKey.h" static image_t *g_pauza; static bool_t activePauza; -static my_time_t lastActive; - -void initPauza() -{ - g_pauza = addImageData("pauza.png", IMAGE_ALPHA, "pauza", IMAGE_GROUP_USER); - activePauza = FALSE; - lastActive = getMyTime(); -} static void switchPauzed() { @@ -34,6 +27,19 @@ static void switchPauzed() } } +static void hotkey_pauze() +{ + switchPauzed(); +} + +void initPauza() +{ + g_pauza = addImageData("pauza.png", IMAGE_ALPHA, "pauza", IMAGE_GROUP_USER); + activePauza = FALSE; + + registerHotKey(SDLK_p, hotkey_pauze); +} + void drawPauza() { if( activePauza ) @@ -48,21 +54,6 @@ void drawPauza() void eventPauza() { - Uint8 *mapa; - mapa = SDL_GetKeyState(NULL); - - if( mapa[SDLK_p] == SDL_PRESSED ) - { - my_time_t currentTime; - - currentTime = getMyTime(); - - if( currentTime - lastActive > PAUZE_ACTIVE_TIME_INTERVAL ) - { - lastActive = currentTime; - switchPauzed(); - } - } } bool_t isPauzeActive() @@ -72,5 +63,6 @@ bool_t isPauzeActive() void quitPauza() { + unregisterHotKey(SDLK_p); } |