From: Tobias Gläßer Date: Sat, 21 Feb 2004 15:33:58 +0000 (+0000) Subject: Fixed EventPoll bug. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=a5987347e5cc8f4265d02b2e44f0ecce121ecb5b;p=supertux.git Fixed EventPoll bug. SVN-Revision: 142 --- diff --git a/src/gameloop.c b/src/gameloop.c index 4f83369e7..28a995659 100644 --- a/src/gameloop.c +++ b/src/gameloop.c @@ -146,6 +146,7 @@ void game_event(void) quit = 1; else if(show_menu) { + menu_set_current(&game_menu); show_menu = 0; st_pause_ticks_stop(); } @@ -589,6 +590,9 @@ int gameloop(char * subset, int levelnb, int mode) timer_init(&frame_timer); fps_cnt = 0; + while (SDL_PollEvent(&event)) + {} + game_draw(); do { diff --git a/src/menu.c b/src/menu.c index bcbbbcbb5..245995db7 100644 --- a/src/menu.c +++ b/src/menu.c @@ -37,7 +37,7 @@ int show_menu; int menu_change; texture_type checkbox, checkbox_checked, back; -menu_type main_menu, game_menu, options_menu, leveleditor_menu, highscore_menu, load_game_menu; +menu_type main_menu, game_menu, options_menu, leveleditor_menu, highscore_menu, load_game_menu, save_game_menu; menu_type* current_menu, * last_menu; /* input implementation variables */ @@ -242,7 +242,7 @@ void menu_draw(menu_type* pmenu) else if(pmenu->item[i].kind == MN_LABEL) { text_drawf(&gold_text,pmenu->item[i].text,0,(i)*24 - menu_height/2 + 10,A_HMIDDLE, A_VMIDDLE,2,NO_UPDATE); - fillrect(screen->w/2 - menu_width/2,(i)*24 - menu_height/2 + 28,menu_width,2,150,150,150,100); + fillrect(screen->w/2 - menu_width/2,(i)*24 - menu_height/2 + 20 + screen->h /2,menu_width,2,190,190,190,100); } else if(pmenu->item[i].kind == MN_TEXTFIELD) { diff --git a/src/menu.h b/src/menu.h index ecb86c70c..64adf9854 100644 --- a/src/menu.h +++ b/src/menu.h @@ -69,7 +69,7 @@ extern int show_menu; extern int menu_change; extern texture_type checkbox, checkbox_checked, back; -extern menu_type main_menu, game_menu, options_menu, leveleditor_menu, highscore_menu, load_game_menu; +extern menu_type main_menu, game_menu, options_menu, leveleditor_menu, highscore_menu, load_game_menu, save_game_menu;; extern menu_type* current_menu, * last_menu; /* input implementation variables */ diff --git a/src/setup.c b/src/setup.c index d3d54c93f..8e299f382 100644 --- a/src/setup.c +++ b/src/setup.c @@ -252,9 +252,12 @@ void st_menu(void) menu_init(&load_game_menu); menu_additem(&load_game_menu,menu_item_create(MN_LABEL,"Load Game",0,0)); + menu_init(&save_game_menu); + menu_additem(&save_game_menu,menu_item_create(MN_LABEL,"Save Game",0,0)); + menu_init(&game_menu); menu_additem(&game_menu,menu_item_create(MN_ACTION,"Return To Game",0,0)); - menu_additem(&game_menu,menu_item_create(MN_ACTION,"Save Game",0,0)); + menu_additem(&game_menu,menu_item_create(MN_ACTION,"Save Game",0,&save_game_menu)); menu_additem(&game_menu,menu_item_create(MN_GOTO,"Load Game",0,&load_game_menu)); menu_additem(&game_menu,menu_item_create(MN_GOTO,"Options",0,&options_menu)); menu_additem(&game_menu,menu_item_create(MN_ACTION,"Quit Game",0,0));