Mercurial > MadButterfly
comparison examples/menu/main.c @ 307:b6891068109f
Fix the boundary condition for scroll down
author | wycc |
---|---|
date | Sat, 21 Feb 2009 21:51:05 +0800 |
parents | c981e561ac37 |
children | 9e1d72eca57b |
comparison
equal
deleted
inserted
replaced
306:c981e561ac37 | 307:b6891068109f |
---|---|
242 MB_TIMEVAL_SET(&playing, 0, m->speed); | 242 MB_TIMEVAL_SET(&playing, 0, m->speed); |
243 word = mb_progm_next_word(progm, &start, &playing); | 243 word = mb_progm_next_word(progm, &start, &playing); |
244 get_now(&now); | 244 get_now(&now); |
245 | 245 |
246 lightbar = (coord_t *) m->lightbar; | 246 lightbar = (coord_t *) m->lightbar; |
247 #if 1 | |
248 // The redraw algorithm has bugs so that the items is not redrawed correctly. We redraw the items under the lightbar to work around it. | |
249 // Comment these lines if the algprothm is fixed. | |
250 rdman_coord_changed(MBAPP_RDMAN(m->app),m->objects[m->cur]); | |
251 if (m->cur != 0) | |
252 mb_shift_new(0,0,m->objects[m->cur-1],word); | |
253 if (m->cur != 7) | |
254 mb_shift_new(0,0,m->objects[m->cur+1],word); | |
255 #endif | |
256 mb_shift_new(0,m->menus_y[m->cur]-coord_y(lightbar),lightbar,word); | 247 mb_shift_new(0,m->menus_y[m->cur]-coord_y(lightbar),lightbar,word); |
257 mb_progm_free_completed(progm); | 248 mb_progm_free_completed(progm); |
258 m->ready--; | 249 m->ready--; |
259 subject_add_observer(mb_progm_get_complete(progm), mb_animated_menu_complete,m); | 250 subject_add_observer(mb_progm_get_complete(progm), mb_animated_menu_complete,m); |
260 mb_progm_start(progm, X_MB_tman(MBAPP_RDMAN(m->app)->rt), &now); | 251 mb_progm_start(progm, X_MB_tman(MBAPP_RDMAN(m->app)->rt), &now); |
285 if (m->top+m->cur <= m->max) { | 276 if (m->top+m->cur <= m->max) { |
286 m->cur++; | 277 m->cur++; |
287 mb_animated_menu_moveLightBar(m); | 278 mb_animated_menu_moveLightBar(m); |
288 } | 279 } |
289 } else { | 280 } else { |
290 if ((m->top+8) < m->max) { | 281 if ((m->top+8) < m->max-1) { |
291 m->top++; | 282 m->top++; |
292 mb_animated_menu_fillMenuContentDown(m); | 283 mb_animated_menu_fillMenuContentDown(m); |
293 } else { | 284 } else { |
294 if (m->cur+m->top < m->max-1) { | 285 if (m->cur+m->top < m->max-2) { |
295 m->cur++; | 286 m->cur++; |
296 mb_animated_menu_moveLightBar(m); | 287 mb_animated_menu_moveLightBar(m); |
297 } else | 288 } else |
298 return; | 289 return; |
299 } | 290 } |