summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/interface.c35
-rw-r--r--src/client/interface.h1
-rw-r--r--src/client/screen.c12
3 files changed, 44 insertions, 4 deletions
diff --git a/src/client/interface.c b/src/client/interface.c
index d2f99fb..75efca9 100644
--- a/src/client/interface.c
+++ b/src/client/interface.c
@@ -23,6 +23,7 @@ static bool_t isInterfaceInit = FALSE;
// flag, kterym se ridi zarazovani klaves do bufferu
bool_t keyboardBufferEnabled = FALSE;
+bool_t isSlowHack;
bool_t isInterfaceInicialized()
{
@@ -116,6 +117,7 @@ int initSDL()
srand((unsigned) time(NULL));
isInterfaceInit = TRUE;
+ isSlowHack = FALSE;
return 0;
}
@@ -192,6 +194,33 @@ static void action_esc()
}
*/
+void activeSlowHack()
+{
+ isSlowHack = TRUE;
+}
+
+static void slowHackRoutine()
+{
+ static time_t lastTime = 0;
+
+ if( lastTime == 0 )
+ {
+ lastTime = getMyTime();
+ return;
+ }
+
+ if( getMyTime() - lastTime >= 50 )
+ {
+ lastTime = 0;
+ isSlowHack = FALSE;
+ return;
+ }
+
+ //printf("SLOW HACK : %d\n", (getMyTime() - lastTime));
+
+ lastTime = getMyTime();
+}
+
int eventAction()
{
SDL_Event event;
@@ -223,6 +252,12 @@ int eventAction()
case SDL_USEREVENT:
switch (event.user.code) {
case USR_EVT_TIMER:
+ if( isSlowHack )
+ {
+ slowHackRoutine();
+ break;
+ }
+
drawScreen();
eventScreen();
eventHotKey();
diff --git a/src/client/interface.h b/src/client/interface.h
index b5df62a..daf1275 100644
--- a/src/client/interface.h
+++ b/src/client/interface.h
@@ -33,6 +33,7 @@ extern bool_t isInterfaceInicialized();
extern void enableKeyboardBuffer();
extern void disableKeyboardBuffer();
extern int initSDL();
+extern void activeSlowHack();
extern SDL_Surface *getSDL_Screen();
extern void getMousePosition(int *x, int *y);
extern int isMouseClicked();
diff --git a/src/client/screen.c b/src/client/screen.c
index b5264bd..9f21f6d 100644
--- a/src/client/screen.c
+++ b/src/client/screen.c
@@ -164,13 +164,17 @@ void drawScreen()
void eventScreen()
{
assert(currentScreen != NULL);
+#if 0
+ static my_time_t last = 0;
-#ifdef DEBUG_TIME_EVENT
- my_time_t prev;
+ if( last == 0 )
+ {
+ last = getMyTime();
+ }
- prev = getMyTimeMicro();
+ printf("%d\n", getMyTime()-last);
+ last = getMyTime();
#endif
-
currentScreen->fce_event();
#ifdef DEBUG_TIME_EVENT