From 8b93dd8dac51e28bb25ad341f594d21a955c3adb Mon Sep 17 00:00:00 2001 From: oroborus Date: Fri, 18 Jul 2008 19:19:10 +0000 Subject: - bezpecnejsie prepiannie screenov ( uz sa to nedeje v event() daneho screenu aj ked to on vyvolal ) - do laveho horneho rohu s nevypisuju blbiny - moduly pouzivaju funkcie actionSpace a actionSpaceFromLocation - dane funkcie sa pouzivaju aj pri vykreslovani objektov - btw. je jedno kolko zeru tuxanci top, na kerneli-2.6.25.* to zralo X a na kerneli 2.6.26 to zere 2*X git-svn-id: http://opensvn.csie.org/tuxanci_ng@159 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e --- src/client/screen.c | 67 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 24 deletions(-) (limited to 'src/client/screen.c') diff --git a/src/client/screen.c b/src/client/screen.c index a96dd9e..f08d89a 100644 --- a/src/client/screen.c +++ b/src/client/screen.c @@ -13,6 +13,8 @@ //#define DEBUG_TIME_DRAW static screen_t *currentScreen; +static screen_t *futureScreen; + static list_t *listScreen; static bool_t isScreenInit = FALSE; @@ -63,24 +65,17 @@ void registerScreen(screen_t *p) void initScreen() { listScreen = newList(); + currentScreen = NULL; + futureScreen = NULL; + isScreenInit = TRUE; } -void setScreen(char *name) +static screen_t* findScreen(char *name) { - int i; screen_t *this; - - assert( name != NULL ); - - if( currentScreen != NULL && - strcmp(currentScreen->name, name) == 0 ) - { - return; - } - - printf("switch screen %s..\n", name); + int i; for( i = 0 ; i < listScreen->count ; i++ ) { @@ -89,23 +84,47 @@ void setScreen(char *name) if( strcmp(name, this->name) == 0 ) { - flushLayer(); + return this; + } + } + + return NULL; +} + +void setScreen(char *name) +{ + futureScreen = findScreen(name); + assert( futureScreen != NULL ); +} - if( currentScreen != NULL ) - { - printf("stop screen %s..\n", currentScreen->name); - currentScreen->fce_stop(); - } +void switchScreen() +{ + if( futureScreen == NULL ) + { + return; + } - currentScreen = this; - printf("start screen %s..\n", currentScreen->name); - currentScreen->fce_start(); + flushLayer(); - return; - } + if( currentScreen != NULL ) + { + printf("stop screen %s..\n", currentScreen->name); + currentScreen->fce_stop(); } - assert( ! "screen sa nenasiel !" ); + currentScreen = futureScreen; + futureScreen = NULL; + + //printf("switch screen %s..\n", currentScreen->name); + + printf("start screen %s..\n", currentScreen->name); + currentScreen->fce_start(); +} + +void startScreen(char *name) +{ + setScreen(name); + switchScreen(); } char* getScreen() -- cgit v1.2.3