comparison src/mbaf/animated_menu.c @ 822:586e50f82c1f

Unify coding style tag for emacs and vim.
author Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
date Tue, 14 Sep 2010 01:08:39 +0800
parents f43224bf3524
children 152bc503dc99
comparison
equal deleted inserted replaced
821:bfdc82bbd6e4 822:586e50f82c1f
1 // -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*-
2 // vim: sw=4:ts=8:sts=4
1 #include <stdio.h> 3 #include <stdio.h>
2 #include <mb.h> 4 #include <mb.h>
3 #include <string.h> 5 #include <string.h>
4 //#include "menu.h" 6 //#include "menu.h"
5 #include "mb_af.h" 7 #include "mb_af.h"
92 coord_show(textgroup); 94 coord_show(textgroup);
93 mb_shift_new(0,100, textgroup,word); 95 mb_shift_new(0,100, textgroup,word);
94 96
95 lightbar = (coord_t *) m->lightbar; 97 lightbar = (coord_t *) m->lightbar;
96 mb_shift_new(0,m->menus_y[m->cur]-coord_y(lightbar),lightbar,word); 98 mb_shift_new(0,m->menus_y[m->cur]-coord_y(lightbar),lightbar,word);
97 99
98 MB_TIMEVAL_SET(&start, 0, m->speed); 100 MB_TIMEVAL_SET(&start, 0, m->speed);
99 MB_TIMEVAL_SET(&playing, 0, 0); 101 MB_TIMEVAL_SET(&playing, 0, 0);
100 word = mb_progm_next_word(progm, &start, &playing); 102 word = mb_progm_next_word(progm, &start, &playing);
101 textgroup = (coord_t *) m->objects[m->items[7]]; 103 textgroup = (coord_t *) m->objects[m->items[7]];
102 mb_visibility_new(VIS_HIDDEN, textgroup,word); 104 mb_visibility_new(VIS_HIDDEN, textgroup,word);
195 if (m->top > 0) { 197 if (m->top > 0) {
196 m->top--; 198 m->top--;
197 mb_animated_menu_fillMenuContentUp(m); 199 mb_animated_menu_fillMenuContentUp(m);
198 mb_animated_menu_update(m); 200 mb_animated_menu_update(m);
199 } else { 201 } else {
200 if (m->cur == 0) 202 if (m->cur == 0)
201 return; 203 return;
202 m->cur--; 204 m->cur--;
203 mb_animated_menu_moveLightBar(m); 205 mb_animated_menu_moveLightBar(m);
204 mb_animated_menu_update(m); 206 mb_animated_menu_update(m);
205 } 207 }
254 static void mb_animated_menu_keyHandler(event_t *ev, void *arg); 256 static void mb_animated_menu_keyHandler(event_t *ev, void *arg);
255 static void mb_animated_menu_send_pending_key(event_t *ev,void *arg) 257 static void mb_animated_menu_send_pending_key(event_t *ev,void *arg)
256 { 258 {
257 mb_animated_menu_t *m = (mb_animated_menu_t *) arg; 259 mb_animated_menu_t *m = (mb_animated_menu_t *) arg;
258 X_kb_event_t *xkey; 260 X_kb_event_t *xkey;
259 261
260 xkey = &m->pending_keys[m->pending_pos]; 262 xkey = &m->pending_keys[m->pending_pos];
261 m->pending_pos = (m->pending_pos + 1) & 0xf; 263 m->pending_pos = (m->pending_pos + 1) & 0xf;
262 mb_animated_menu_keyHandler((event_t *) xkey, m); 264 mb_animated_menu_keyHandler((event_t *) xkey, m);
263 } 265 }
264 static void mb_animated_menu_keyHandler(event_t *ev, void *arg) 266 static void mb_animated_menu_keyHandler(event_t *ev, void *arg)
300 default: 302 default:
301 return; 303 return;
302 } 304 }
303 } 305 }
304 306
305 /** \brief Create an instace of animated menu. 307 /** \brief Create an instace of animated menu.
306 * 308 *
307 * The objectnames is used to extract symbols from the SVG file. 309 * The objectnames is used to extract symbols from the SVG file.
308 * ${objectnames}0 - ${objectnames}8 is the text object. 310 * ${objectnames}0 - ${objectnames}8 is the text object.
309 * ${objectnames}_lightbar is the lightbar. 311 * ${objectnames}_lightbar is the lightbar.
310 * 312 *
311 */ 313 */
312 mb_animated_menu_t *mb_animated_menu_new(mbaf_t *app,mb_sprite_t *sp,char *objnames,char *menus[]) 314 mb_animated_menu_t *mb_animated_menu_new(mbaf_t *app,mb_sprite_t *sp,char *objnames,char *menus[])
320 if (menus == NULL) 322 if (menus == NULL)
321 i=0; 323 i=0;
322 else 324 else
323 for(i=0;menus[i];i++); 325 for(i=0;menus[i];i++);
324 ii=9; 326 ii=9;
325 327
326 m = (mb_animated_menu_t *) malloc(sizeof(mb_animated_menu_t)); 328 m = (mb_animated_menu_t *) malloc(sizeof(mb_animated_menu_t));
327 m->items = (int *) malloc(sizeof(int)*ii*2+sizeof(mb_obj_t *)*ii); 329 m->items = (int *) malloc(sizeof(int)*ii*2+sizeof(mb_obj_t *)*ii);
328 m->app = app; 330 m->app = app;
329 m->sprite = sp; 331 m->sprite = sp;
330 m->top = 0; 332 m->top = 0;