summaryrefslogtreecommitdiff
path: root/src/client/pauza.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/pauza.c')
-rw-r--r--src/client/pauza.c38
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);
}