comparison examples/menu/main.c @ 298:959c4ac544a1

Add SPPED marcro to adjust the speed
author wycc
date Wed, 04 Feb 2009 01:28:01 +0800
parents e885dc875f30
children 5bf503270419
comparison
equal deleted inserted replaced
297:e885dc875f30 298:959c4ac544a1
37 "Item 18", 37 "Item 18",
38 }; 38 };
39 39
40 int menus_y[10]; 40 int menus_y[10];
41 int items[10]; 41 int items[10];
42 42 #define SPEED 600000
43 43
44 typedef struct { 44 typedef struct {
45 int top; 45 int top;
46 int cur; 46 int cur;
47 int max; 47 int max;
108 text = (shape_t *) MB_SPRITE_GET_OBJ(sprite,name); 108 text = (shape_t *) MB_SPRITE_GET_OBJ(sprite,name);
109 sh_text_set_text(text, menus[data->top]); 109 sh_text_set_text(text, menus[data->top]);
110 110
111 progm = mb_progm_new(2, MBAPP_RDMAN(myApp)); 111 progm = mb_progm_new(2, MBAPP_RDMAN(myApp));
112 MB_TIMEVAL_SET(&start, 0, 0); 112 MB_TIMEVAL_SET(&start, 0, 0);
113 MB_TIMEVAL_SET(&playing, 0, 300000); 113 MB_TIMEVAL_SET(&playing, 0, SPEED);
114 word = mb_progm_next_word(progm, &start, &playing); 114 word = mb_progm_next_word(progm, &start, &playing);
115 get_now(&now); 115 get_now(&now);
116 116
117 for(i=0;i<7;i++) { 117 for(i=0;i<7;i++) {
118 //shift to the next item 118 //shift to the next item
136 mb_shift_new(0,100, textgroup,word); 136 mb_shift_new(0,100, textgroup,word);
137 137
138 lightbar = (coord_t *) MB_SPRITE_GET_OBJ(sprite, "lightbar"); 138 lightbar = (coord_t *) MB_SPRITE_GET_OBJ(sprite, "lightbar");
139 mb_shift_new(0,menus_y[data->cur]-coord_y(lightbar),lightbar,word); 139 mb_shift_new(0,menus_y[data->cur]-coord_y(lightbar),lightbar,word);
140 140
141 MB_TIMEVAL_SET(&start, 0, 300000); 141 MB_TIMEVAL_SET(&start, 0, SPEED);
142 MB_TIMEVAL_SET(&playing, 0, 0); 142 MB_TIMEVAL_SET(&playing, 0, 0);
143 word = mb_progm_next_word(progm, &start, &playing); 143 word = mb_progm_next_word(progm, &start, &playing);
144 snprintf(name, sizeof(name),"item%d", items[8]); 144 snprintf(name, sizeof(name),"item%d", items[8]);
145 textgroup = (coord_t *) MB_SPRITE_GET_OBJ(sprite,name); 145 textgroup = (coord_t *) MB_SPRITE_GET_OBJ(sprite,name);
146 mb_visibility_new(VIS_VISIBLE, textgroup,word); 146 mb_visibility_new(VIS_VISIBLE, textgroup,word);
175 text = (shape_t *) MB_SPRITE_GET_OBJ(sprite,name); 175 text = (shape_t *) MB_SPRITE_GET_OBJ(sprite,name);
176 sh_text_set_text(text, menus[data->top+7]); 176 sh_text_set_text(text, menus[data->top+7]);
177 177
178 progm = mb_progm_new(2, MBAPP_RDMAN(myApp)); 178 progm = mb_progm_new(2, MBAPP_RDMAN(myApp));
179 MB_TIMEVAL_SET(&start, 0, 0); 179 MB_TIMEVAL_SET(&start, 0, 0);
180 MB_TIMEVAL_SET(&playing, 0, 300000); 180 MB_TIMEVAL_SET(&playing, 0, SPEED);
181 word = mb_progm_next_word(progm, &start, &playing); 181 word = mb_progm_next_word(progm, &start, &playing);
182 get_now(&now); 182 get_now(&now);
183 183
184 for(i=1;i<8;i++) { 184 for(i=1;i<8;i++) {
185 //shift to the next item 185 //shift to the next item
200 mb_shift_new(0,-100, textgroup,word); 200 mb_shift_new(0,-100, textgroup,word);
201 201
202 lightbar = (coord_t *) MB_SPRITE_GET_OBJ(sprite, "lightbar"); 202 lightbar = (coord_t *) MB_SPRITE_GET_OBJ(sprite, "lightbar");
203 mb_shift_new(0,menus_y[data->cur]-coord_y(lightbar),lightbar,word); 203 mb_shift_new(0,menus_y[data->cur]-coord_y(lightbar),lightbar,word);
204 204
205 MB_TIMEVAL_SET(&start, 0, 300001); 205 MB_TIMEVAL_SET(&start, 0, SPEED);
206 MB_TIMEVAL_SET(&playing, 0, 0); 206 MB_TIMEVAL_SET(&playing, 0, 0);
207 word = mb_progm_next_word(progm, &start, &playing); 207 word = mb_progm_next_word(progm, &start, &playing);
208 snprintf(name, sizeof(name),"item%d", items[0]); 208 snprintf(name, sizeof(name),"item%d", items[0]);
209 textgroup = (coord_t *) MB_SPRITE_GET_OBJ(sprite,name); 209 textgroup = (coord_t *) MB_SPRITE_GET_OBJ(sprite,name);
210 mb_visibility_new(VIS_VISIBLE, textgroup,word); 210 mb_visibility_new(VIS_VISIBLE, textgroup,word);