diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2004-12-03 07:36:11 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2004-12-03 07:36:11 +0000 |
commit | 059ada52d0784c31ec34e651b846e78134f93f61 (patch) | |
tree | 74cfb86af1ddbb596976784a73ab6697769a3961 /apps | |
parent | a0d5bea9ec120cb19efedc95e8e96fe1ca88feff (diff) | |
download | rockbox-059ada52d0784c31ec34e651b846e78134f93f61.tar.gz rockbox-059ada52d0784c31ec34e651b846e78134f93f61.zip |
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
Diffstat (limited to 'apps')
-rw-r--r-- | apps/plugins/snake2.c | 50 | ||||
-rw-r--r-- | apps/plugins/stopwatch.c | 70 |
2 files changed, 60 insertions, 60 deletions
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) | |||
911 | 911 | ||
912 | while (1) | 912 | while (1) |
913 | { | 913 | { |
914 | rb->lcd_clear_display(); | ||
915 | redraw(); | ||
916 | /*TODO: CENTER ALL TEXT!!!!*/ | ||
917 | rb->snprintf(plevel,sizeof(plevel),"Speed - %d",level); | ||
918 | rb->lcd_putsxy(LCD_WIDTH/2 - 30,5, plevel); | ||
919 | #if CONFIG_KEYPAD == RECORDER_PAD | ||
920 | rb->snprintf(plevel,sizeof(plevel),"F1 - Maze %d",level_from_file); | ||
921 | rb->lcd_putsxy(18, 20, plevel); | ||
922 | if(game_type==0) | ||
923 | rb->lcd_putsxy(18, 30, "F3 - Game A"); | ||
924 | else | ||
925 | rb->lcd_putsxy(18, 30, "F3 - Game B"); | ||
926 | #elif CONFIG_KEYPAD == ONDIO_PAD | ||
927 | rb->snprintf(plevel,sizeof(plevel),"Left - Maze %d",level_from_file); | ||
928 | rb->lcd_putsxy(18, 20, plevel); | ||
929 | if(game_type==0) | ||
930 | rb->lcd_putsxy(12, 30, "Right - Game A"); | ||
931 | else | ||
932 | rb->lcd_putsxy(12, 30, "Right - Game B"); | ||
933 | #endif | ||
934 | |||
935 | rb->snprintf(phscore,sizeof(phscore),"Hi Score: %d",hiscore); | ||
936 | rb->lcd_putsxy(LCD_WIDTH/2 - 37,50, phscore); | ||
937 | rb->lcd_update(); | ||
938 | |||
914 | button=rb->button_get(true); | 939 | button=rb->button_get(true); |
915 | switch (button) | 940 | switch (button) |
916 | { | 941 | { |
@@ -957,31 +982,6 @@ void game_init(void) | |||
957 | } | 982 | } |
958 | break; | 983 | break; |
959 | } | 984 | } |
960 | |||
961 | rb->lcd_clear_display(); | ||
962 | redraw(); | ||
963 | /*TODO: CENTER ALL TEXT!!!!*/ | ||
964 | rb->snprintf(plevel,sizeof(plevel),"Speed - %d",level); | ||
965 | rb->lcd_putsxy(LCD_WIDTH/2 - 30,5, plevel); | ||
966 | #if CONFIG_KEYPAD == RECORDER_PAD | ||
967 | rb->snprintf(plevel,sizeof(plevel),"F1 - Maze %d",level_from_file); | ||
968 | rb->lcd_putsxy(18, 20, plevel); | ||
969 | if(game_type==0) | ||
970 | rb->lcd_putsxy(18, 30, "F3 - Game A"); | ||
971 | else | ||
972 | rb->lcd_putsxy(18, 30, "F3 - Game B"); | ||
973 | #elif CONFIG_KEYPAD == ONDIO_PAD | ||
974 | rb->snprintf(plevel,sizeof(plevel),"Left - Maze %d",level_from_file); | ||
975 | rb->lcd_putsxy(18, 20, plevel); | ||
976 | if(game_type==0) | ||
977 | rb->lcd_putsxy(12, 30, "Right - Game A"); | ||
978 | else | ||
979 | rb->lcd_putsxy(12, 30, "Right - Game B"); | ||
980 | #endif | ||
981 | |||
982 | rb->snprintf(phscore,sizeof(phscore),"Hi Score: %d",hiscore); | ||
983 | rb->lcd_putsxy(LCD_WIDTH/2 - 37,50, phscore); | ||
984 | rb->lcd_update(); | ||
985 | } | 985 | } |
986 | } | 986 | } |
987 | 987 | ||
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) | |||
111 | 111 | ||
112 | while (!done) | 112 | while (!done) |
113 | { | 113 | { |
114 | if (counting) | ||
115 | { | ||
116 | stopwatch = prev_total + *rb->current_tick - start_at; | ||
117 | } | ||
118 | else | ||
119 | { | ||
120 | stopwatch = prev_total; | ||
121 | } | ||
122 | |||
123 | ticks_to_string(stopwatch,0,32,buf); | ||
124 | rb->lcd_puts(0, TIMER_Y, buf); | ||
125 | |||
126 | if(update_lap) | ||
127 | { | ||
128 | lap_start = curr_lap - lap_scroll; | ||
129 | for (lap = lap_start; lap > lap_start - LAP_LINES; lap--) | ||
130 | { | ||
131 | if (lap > 0) | ||
132 | { | ||
133 | ticks_to_string(lap_times[(lap-1)%MAX_LAPS],lap,32,buf); | ||
134 | rb->lcd_puts_scroll(0, LAP_Y + lap_start - lap, buf); | ||
135 | } | ||
136 | else | ||
137 | { | ||
138 | rb->lcd_puts(0, LAP_Y + lap_start - lap, | ||
139 | " "); | ||
140 | } | ||
141 | } | ||
142 | update_lap = false; | ||
143 | } | ||
144 | |||
145 | #ifdef HAVE_LCD_BITMAP | ||
146 | rb->lcd_update(); | ||
147 | #endif | ||
148 | |||
114 | if (! counting) | 149 | if (! counting) |
115 | { | 150 | { |
116 | button = rb->button_get(true); | 151 | button = rb->button_get(true); |
@@ -187,41 +222,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
187 | return PLUGIN_USB_CONNECTED; | 222 | return PLUGIN_USB_CONNECTED; |
188 | break; | 223 | break; |
189 | } | 224 | } |
190 | |||
191 | if (counting) | ||
192 | { | ||
193 | stopwatch = prev_total + *rb->current_tick - start_at; | ||
194 | } | ||
195 | else | ||
196 | { | ||
197 | stopwatch = prev_total; | ||
198 | } | ||
199 | |||
200 | ticks_to_string(stopwatch,0,32,buf); | ||
201 | rb->lcd_puts(0, TIMER_Y, buf); | ||
202 | |||
203 | if(update_lap) | ||
204 | { | ||
205 | lap_start = curr_lap - lap_scroll; | ||
206 | for (lap = lap_start; lap > lap_start - LAP_LINES; lap--) | ||
207 | { | ||
208 | if (lap > 0) | ||
209 | { | ||
210 | ticks_to_string(lap_times[(lap-1)%MAX_LAPS],lap,32,buf); | ||
211 | rb->lcd_puts_scroll(0, LAP_Y + lap_start - lap, buf); | ||
212 | } | ||
213 | else | ||
214 | { | ||
215 | rb->lcd_puts(0, LAP_Y + lap_start - lap, | ||
216 | " "); | ||
217 | } | ||
218 | } | ||
219 | update_lap = false; | ||
220 | } | ||
221 | |||
222 | #ifdef HAVE_LCD_BITMAP | ||
223 | rb->lcd_update(); | ||
224 | #endif | ||
225 | } | 225 | } |
226 | return PLUGIN_OK; | 226 | return PLUGIN_OK; |
227 | } | 227 | } |