summaryrefslogtreecommitdiff
path: root/src/client/saveDialog.c
diff options
context:
space:
mode:
authororoborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-08-23 11:44:09 +0000
committeroroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-08-23 11:44:09 +0000
commitc30b18c500bd0abb3362df66448febda36ff80d0 (patch)
tree10d762326878e5991eac9d7c788cde2f3b0d0fd2 /src/client/saveDialog.c
parent9c72004fada0af13e4c9b4682c733056a777dc59 (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/saveDialog.c')
-rw-r--r--src/client/saveDialog.c34
1 files changed, 10 insertions, 24 deletions
diff --git a/src/client/saveDialog.c b/src/client/saveDialog.c
index 462c219..37a3d8f 100644
--- a/src/client/saveDialog.c
+++ b/src/client/saveDialog.c
@@ -4,7 +4,6 @@
#include "main.h"
#include "list.h"
-#include "myTimer.h"
#include "tux.h"
#include "space.h"
#include "arena.h"
@@ -15,6 +14,7 @@
#include "image.h"
#include "font.h"
#include "saveLoad.h"
+#include "hotKey.h"
#include "widget.h"
#include "widget_label.h"
@@ -23,7 +23,6 @@
static image_t *g_background;
static bool_t activeSaveDialog;
-static my_time_t lastActive;
static widget_t *widgetLabelMsg;
static widget_t *widgetTextFieldName;
@@ -61,10 +60,14 @@ static void eventWidget(void *p)
}
}
+static void hotkey_saveDialog()
+{
+ switchTerm();
+}
+
void initSaveDialog()
{
activeSaveDialog = FALSE;
- lastActive = getMyTime();
g_background = getImage(IMAGE_GROUP_BASE, "screen_main");
@@ -91,6 +94,8 @@ void initSaveDialog()
SAVE_DIALOG_LOCATIN_X+20+WIDGET_BUTTON_WIDTH+20,
SAVE_DIALOG_LOCATIN_Y+60,
eventWidget);
+
+ registerHotKey(SDLK_F2, hotkey_saveDialog);
}
bool_t isSaveDialogActive()
@@ -120,27 +125,6 @@ void drawSaveDialog()
void eventSaveDialog()
{
- my_time_t currentTime;
- Uint8 *mapa;
-
- if( getNetTypeGame() != NET_GAME_TYPE_NONE )
- {
- return;
- }
-
- mapa = SDL_GetKeyState(NULL);
-
- currentTime = getMyTime();
-
- if( mapa[SDLK_F2] == SDL_PRESSED )
- {
- if( currentTime - lastActive > SAVEDIALOG_ACTIVE_TIME_INTERVAL )
- {
- lastActive = currentTime;
- switchTerm();
- }
- }
-
if( activeSaveDialog == FALSE )
{
return;
@@ -154,6 +138,8 @@ void eventSaveDialog()
void quitSaveDialog()
{
+ unregisterHotKey(SDLK_F2);
+
destroyWidgetLabel(widgetLabelMsg);
destroyWidgetTextfield(widgetTextFieldName);
destroyWidgetButton(widgetButtonSave);