comparison src/mbaf/animated_menu.c @ 454:9b8dda201ccb

Make naming convention consistent with MadButterfly.
author Thinker K.F. Li <thinker@branda.to>
date Thu, 06 Aug 2009 09:38:51 +0800
parents 080aca2b7c47
children 58b6337fb3b2
comparison
equal deleted inserted replaced
453:84ce2d4a8c3f 454:9b8dda201ccb
36 group = (coord_t *) m->objects[m->items[i]]; 36 group = (coord_t *) m->objects[m->items[i]];
37 if (i < m->max) 37 if (i < m->max)
38 set_text(group, m->titles[m->top+i]); 38 set_text(group, m->titles[m->top+i]);
39 else 39 else
40 set_text(group, ""); 40 set_text(group, "");
41 rdman_coord_changed(MBAPP_RDMAN(m->app),group); 41 rdman_coord_changed(MBAF_RDMAN(m->app),group);
42 } 42 }
43 43
44 44
45 textgroup = (coord_t *) m->objects[m->items[i]]; 45 textgroup = (coord_t *) m->objects[m->items[i]];
46 coord_hide(textgroup); 46 coord_hide(textgroup);
47 rdman_coord_changed(MBAPP_RDMAN(m->app),textgroup); 47 rdman_coord_changed(MBAF_RDMAN(m->app),textgroup);
48 48
49 lightbar = (coord_t *) m->lightbar; 49 lightbar = (coord_t *) m->lightbar;
50 group = (coord_t *) m->objects[m->cur]; 50 group = (coord_t *) m->objects[m->cur];
51 coord_y(lightbar) = coord_y(group); 51 coord_y(lightbar) = coord_y(group);
52 rdman_coord_changed(MBAPP_RDMAN(m->app),lightbar); 52 rdman_coord_changed(MBAF_RDMAN(m->app),lightbar);
53 rdman_redraw_changed(MBAPP_RDMAN(m->app)); 53 rdman_redraw_changed(MBAF_RDMAN(m->app));
54 } 54 }
55 55
56 static void mb_animated_menu_complete(event_t *ev,void *arg) 56 static void mb_animated_menu_complete(event_t *ev,void *arg)
57 { 57 {
58 mb_animated_menu_t *m = (mb_animated_menu_t *) arg; 58 mb_animated_menu_t *m = (mb_animated_menu_t *) arg;
76 76
77 // fill new item 77 // fill new item
78 group = (coord_t *) m->objects[m->items[8]]; 78 group = (coord_t *) m->objects[m->items[8]];
79 set_text(group, m->titles[m->top]); 79 set_text(group, m->titles[m->top]);
80 80
81 m->progm = progm = mb_progm_new(2, MBAPP_RDMAN(m->app)); 81 m->progm = progm = mb_progm_new(2, MBAF_RDMAN(m->app));
82 MB_TIMEVAL_SET(&start, 0, 0); 82 MB_TIMEVAL_SET(&start, 0, 0);
83 MB_TIMEVAL_SET(&playing, 0, m->speed); 83 MB_TIMEVAL_SET(&playing, 0, m->speed);
84 word = mb_progm_next_word(progm, &start, &playing); 84 word = mb_progm_next_word(progm, &start, &playing);
85 get_now(&now); 85 get_now(&now);
86 86
110 mb_visibility_new(VIS_HIDDEN, textgroup,word); 110 mb_visibility_new(VIS_HIDDEN, textgroup,word);
111 111
112 mb_progm_free_completed(progm); 112 mb_progm_free_completed(progm);
113 m->ready--; 113 m->ready--;
114 subject_add_observer(mb_progm_get_complete(progm), mb_animated_menu_complete,m); 114 subject_add_observer(mb_progm_get_complete(progm), mb_animated_menu_complete,m);
115 mb_progm_start(progm, X_MB_tman(MBAPP_RDMAN(m->app)->rt), &now); 115 mb_progm_start(progm, X_MB_tman(MBAF_RDMAN(m->app)->rt), &now);
116 rdman_redraw_changed(MBAPP_RDMAN(m->app)); 116 rdman_redraw_changed(MBAF_RDMAN(m->app));
117 tmp = m->items[8]; 117 tmp = m->items[8];
118 for(i=8;i>0;i--) { 118 for(i=8;i>0;i--) {
119 m->items[i] = m->items[i-1]; 119 m->items[i] = m->items[i-1];
120 } 120 }
121 m->items[0] = tmp; 121 m->items[0] = tmp;
138 138
139 139
140 // fill new item 140 // fill new item
141 set_text((coord_t *)m->objects[m->items[8]], m->titles[m->top+7]); 141 set_text((coord_t *)m->objects[m->items[8]], m->titles[m->top+7]);
142 142
143 m->progm = progm = mb_progm_new(2, MBAPP_RDMAN(m->app)); 143 m->progm = progm = mb_progm_new(2, MBAF_RDMAN(m->app));
144 MB_TIMEVAL_SET(&start, 0, 0); 144 MB_TIMEVAL_SET(&start, 0, 0);
145 MB_TIMEVAL_SET(&playing, 0, m->speed); 145 MB_TIMEVAL_SET(&playing, 0, m->speed);
146 word = mb_progm_next_word(progm, &start, &playing); 146 word = mb_progm_next_word(progm, &start, &playing);
147 get_now(&now); 147 get_now(&now);
148 148
166 mb_visibility_new(VIS_VISIBLE, (coord_t *) m->objects[m->items[0]],word); 166 mb_visibility_new(VIS_VISIBLE, (coord_t *) m->objects[m->items[0]],word);
167 167
168 mb_progm_free_completed(progm); 168 mb_progm_free_completed(progm);
169 m->ready--; 169 m->ready--;
170 subject_add_observer(mb_progm_get_complete(progm), mb_animated_menu_complete,m); 170 subject_add_observer(mb_progm_get_complete(progm), mb_animated_menu_complete,m);
171 mb_progm_start(progm, X_MB_tman(MBAPP_RDMAN(m->app)->rt), &now); 171 mb_progm_start(progm, X_MB_tman(MBAF_RDMAN(m->app)->rt), &now);
172 rdman_redraw_changed(MBAPP_RDMAN(m->app)); 172 rdman_redraw_changed(MBAF_RDMAN(m->app));
173 tmp = m->items[0]; 173 tmp = m->items[0];
174 for(i=0;i<8;i++) { 174 for(i=0;i<8;i++) {
175 m->items[i] = m->items[i+1]; 175 m->items[i] = m->items[i+1];
176 } 176 }
177 m->items[8] = tmp; 177 m->items[8] = tmp;
183 mb_progm_t *progm; 183 mb_progm_t *progm;
184 mb_word_t *word; 184 mb_word_t *word;
185 coord_t *group; 185 coord_t *group;
186 coord_t *lightbar; 186 coord_t *lightbar;
187 187
188 m->progm = progm = mb_progm_new(1, MBAPP_RDMAN(m->app)); 188 m->progm = progm = mb_progm_new(1, MBAF_RDMAN(m->app));
189 MB_TIMEVAL_SET(&start, 0, 0); 189 MB_TIMEVAL_SET(&start, 0, 0);
190 MB_TIMEVAL_SET(&playing, 0, m->speed); 190 MB_TIMEVAL_SET(&playing, 0, m->speed);
191 word = mb_progm_next_word(progm, &start, &playing); 191 word = mb_progm_next_word(progm, &start, &playing);
192 get_now(&now); 192 get_now(&now);
193 193
194 lightbar = (coord_t *) m->lightbar; 194 lightbar = (coord_t *) m->lightbar;
195 mb_shift_new(0,m->menus_y[m->cur]-coord_y(lightbar),lightbar,word); 195 mb_shift_new(0,m->menus_y[m->cur]-coord_y(lightbar),lightbar,word);
196 mb_progm_free_completed(progm); 196 mb_progm_free_completed(progm);
197 m->ready--; 197 m->ready--;
198 subject_add_observer(mb_progm_get_complete(progm), mb_animated_menu_complete,m); 198 subject_add_observer(mb_progm_get_complete(progm), mb_animated_menu_complete,m);
199 mb_progm_start(progm, X_MB_tman(MBAPP_RDMAN(m->app)->rt), &now); 199 mb_progm_start(progm, X_MB_tman(MBAF_RDMAN(m->app)->rt), &now);
200 rdman_redraw_changed(MBAPP_RDMAN(m->app)); 200 rdman_redraw_changed(MBAF_RDMAN(m->app));
201 } 201 }
202 202
203 static void mb_animated_menu_up(mb_animated_menu_t *m) 203 static void mb_animated_menu_up(mb_animated_menu_t *m)
204 { 204 {
205 if (m->cur > 5) { 205 if (m->cur > 5) {
316 * The objectnames is used to extract symbols from the SVG file. 316 * The objectnames is used to extract symbols from the SVG file.
317 * ${objectnames}0 - ${objectnames}8 is the text object. 317 * ${objectnames}0 - ${objectnames}8 is the text object.
318 * ${objectnames}_lightbar is the lightbar. 318 * ${objectnames}_lightbar is the lightbar.
319 * 319 *
320 */ 320 */
321 mb_animated_menu_t *mb_animated_menu_new(MBApp *app,mb_sprite_t *sp,char *objnames,char *menus[]) 321 mb_animated_menu_t *mb_animated_menu_new(mbaf_t *app,mb_sprite_t *sp,char *objnames,char *menus[])
322 { 322 {
323 mb_animated_menu_t *m; 323 mb_animated_menu_t *m;
324 int i,len; 324 int i,len;
325 char name[255]; 325 char name[255];
326 mb_obj_t *l; 326 mb_obj_t *l;
359 snprintf(name,sizeof(name), "%s_lightbar", objnames); 359 snprintf(name,sizeof(name), "%s_lightbar", objnames);
360 m->lightbar = (mb_obj_t *) MB_SPRITE_GET_OBJ(sp,name); 360 m->lightbar = (mb_obj_t *) MB_SPRITE_GET_OBJ(sp,name);
361 if (m->lightbar==NULL) 361 if (m->lightbar==NULL)
362 fprintf(stderr,"Can not find object %s\n",name); 362 fprintf(stderr,"Can not find object %s\n",name);
363 mb_animated_menu_fillMenuContent(m); 363 mb_animated_menu_fillMenuContent(m);
364 subject_add_observer(MBAPP_keySubject(app), mb_animated_menu_keyHandler,m); 364 subject_add_observer(MBAF_KB_SUBJECT(app), mb_animated_menu_keyHandler,m);
365 return m; 365 return m;
366 } 366 }
367 367
368 void mb_animated_menu_set_titles(mb_animated_menu_t *m, char *menus[]) 368 void mb_animated_menu_set_titles(mb_animated_menu_t *m, char *menus[])
369 { 369 {