From c30b18c500bd0abb3362df66448febda36ff80d0 Mon Sep 17 00:00:00 2001 From: oroborus Date: Sat, 23 Aug 2008 11:44:09 +0000 Subject: - 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 --- src/screen/screen_world.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'src/screen') diff --git a/src/screen/screen_world.c b/src/screen/screen_world.c index cbfca38..8019c86 100644 --- a/src/screen/screen_world.c +++ b/src/screen/screen_world.c @@ -22,6 +22,8 @@ #include "layer.h" #include "image.h" #include "font.h" + +#include "hotKey.h" #include "panel.h" #include "radar.h" #include "chat.h" @@ -371,18 +373,6 @@ static void control_keyboard_left(tux_t *tux) } } -static void eventEsc() -{ - Uint8 *mapa; - mapa = SDL_GetKeyState(NULL); - - if( mapa[(SDLKey)SDLK_ESCAPE] == SDL_PRESSED ) - { - setWorldEnd(); - return; - } -} - static void eventEnd() { if( isEndWorld == TRUE ) @@ -459,7 +449,6 @@ void eventWorld() { eventNetMultiplayer(); eventEnd(); - eventEsc(); return; } @@ -494,7 +483,11 @@ void eventWorld() eventTerm(); eventSaveDialog(); - eventEsc(); +} + +static void hotkey_escape() +{ + setWorldEnd(); } void startWorld() @@ -502,6 +495,8 @@ void startWorld() arena = NULL; isEndWorld = FALSE; + registerHotKey(SDLK_ESCAPE, hotkey_escape); + initArena(); initListID(); initRadar(); initPauza(); @@ -560,6 +555,9 @@ void stoptWorld() setAnalyze(); } + unregisterHotKey(SDLK_ESCAPE); + quitArena(); + quitNetMultiplayer(); if( arena != NULL ) -- cgit v1.2.3