From 059ada52d0784c31ec34e651b846e78134f93f61 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Fri, 3 Dec 2004 07:36:11 +0000 Subject: Make sure the time is updated before blocking in button_get() git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5477 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/snake2.c | 50 +++++++++++++++++----------------- apps/plugins/stopwatch.c | 70 ++++++++++++++++++++++++------------------------ 2 files changed, 60 insertions(+), 60 deletions(-) (limited to 'apps') diff --git a/apps/plugins/snake2.c b/apps/plugins/snake2.c index 3f32ff360c..b0b9e6424a 100644 --- a/apps/plugins/snake2.c +++ b/apps/plugins/snake2.c @@ -911,6 +911,31 @@ void game_init(void) while (1) { + rb->lcd_clear_display(); + redraw(); + /*TODO: CENTER ALL TEXT!!!!*/ + rb->snprintf(plevel,sizeof(plevel),"Speed - %d",level); + rb->lcd_putsxy(LCD_WIDTH/2 - 30,5, plevel); +#if CONFIG_KEYPAD == RECORDER_PAD + rb->snprintf(plevel,sizeof(plevel),"F1 - Maze %d",level_from_file); + rb->lcd_putsxy(18, 20, plevel); + if(game_type==0) + rb->lcd_putsxy(18, 30, "F3 - Game A"); + else + rb->lcd_putsxy(18, 30, "F3 - Game B"); +#elif CONFIG_KEYPAD == ONDIO_PAD + rb->snprintf(plevel,sizeof(plevel),"Left - Maze %d",level_from_file); + rb->lcd_putsxy(18, 20, plevel); + if(game_type==0) + rb->lcd_putsxy(12, 30, "Right - Game A"); + else + rb->lcd_putsxy(12, 30, "Right - Game B"); +#endif + + rb->snprintf(phscore,sizeof(phscore),"Hi Score: %d",hiscore); + rb->lcd_putsxy(LCD_WIDTH/2 - 37,50, phscore); + rb->lcd_update(); + button=rb->button_get(true); switch (button) { @@ -957,31 +982,6 @@ void game_init(void) } break; } - - rb->lcd_clear_display(); - redraw(); - /*TODO: CENTER ALL TEXT!!!!*/ - rb->snprintf(plevel,sizeof(plevel),"Speed - %d",level); - rb->lcd_putsxy(LCD_WIDTH/2 - 30,5, plevel); -#if CONFIG_KEYPAD == RECORDER_PAD - rb->snprintf(plevel,sizeof(plevel),"F1 - Maze %d",level_from_file); - rb->lcd_putsxy(18, 20, plevel); - if(game_type==0) - rb->lcd_putsxy(18, 30, "F3 - Game A"); - else - rb->lcd_putsxy(18, 30, "F3 - Game B"); -#elif CONFIG_KEYPAD == ONDIO_PAD - rb->snprintf(plevel,sizeof(plevel),"Left - Maze %d",level_from_file); - rb->lcd_putsxy(18, 20, plevel); - if(game_type==0) - rb->lcd_putsxy(12, 30, "Right - Game A"); - else - rb->lcd_putsxy(12, 30, "Right - Game B"); -#endif - - rb->snprintf(phscore,sizeof(phscore),"Hi Score: %d",hiscore); - rb->lcd_putsxy(LCD_WIDTH/2 - 37,50, phscore); - rb->lcd_update(); } } diff --git a/apps/plugins/stopwatch.c b/apps/plugins/stopwatch.c index e21df0d7b6..3843476f78 100644 --- a/apps/plugins/stopwatch.c +++ b/apps/plugins/stopwatch.c @@ -111,6 +111,41 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) while (!done) { + if (counting) + { + stopwatch = prev_total + *rb->current_tick - start_at; + } + else + { + stopwatch = prev_total; + } + + ticks_to_string(stopwatch,0,32,buf); + rb->lcd_puts(0, TIMER_Y, buf); + + if(update_lap) + { + lap_start = curr_lap - lap_scroll; + for (lap = lap_start; lap > lap_start - LAP_LINES; lap--) + { + if (lap > 0) + { + ticks_to_string(lap_times[(lap-1)%MAX_LAPS],lap,32,buf); + rb->lcd_puts_scroll(0, LAP_Y + lap_start - lap, buf); + } + else + { + rb->lcd_puts(0, LAP_Y + lap_start - lap, + " "); + } + } + update_lap = false; + } + +#ifdef HAVE_LCD_BITMAP + rb->lcd_update(); +#endif + if (! counting) { button = rb->button_get(true); @@ -187,41 +222,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) return PLUGIN_USB_CONNECTED; break; } - - if (counting) - { - stopwatch = prev_total + *rb->current_tick - start_at; - } - else - { - stopwatch = prev_total; - } - - ticks_to_string(stopwatch,0,32,buf); - rb->lcd_puts(0, TIMER_Y, buf); - - if(update_lap) - { - lap_start = curr_lap - lap_scroll; - for (lap = lap_start; lap > lap_start - LAP_LINES; lap--) - { - if (lap > 0) - { - ticks_to_string(lap_times[(lap-1)%MAX_LAPS],lap,32,buf); - rb->lcd_puts_scroll(0, LAP_Y + lap_start - lap, buf); - } - else - { - rb->lcd_puts(0, LAP_Y + lap_start - lap, - " "); - } - } - update_lap = false; - } - -#ifdef HAVE_LCD_BITMAP - rb->lcd_update(); -#endif } return PLUGIN_OK; } -- cgit v1.2.3