comparison examples/dynamic/main.c @ 229:cc8dd16d8b6a

Modify dynamic to support the dynamic loading
author wycc
date Wed, 17 Dec 2008 21:18:44 +0800
parents a6e559fb76d7
children 3e6da6f6a226
comparison
equal deleted inserted replaced
228:25bc0e753b88 229:cc8dd16d8b6a
14 typedef struct _engine engine_t; 14 typedef struct _engine engine_t;
15 struct _engine { 15 struct _engine {
16 X_MB_runtime_t *rt; 16 X_MB_runtime_t *rt;
17 redraw_man_t *rdman; 17 redraw_man_t *rdman;
18 menu_t *menu; 18 menu_t *menu;
19 button_t *button; 19 mb_sprite_t *button;
20 int state; 20 int state;
21 co_aix orx,ory; 21 co_aix orx,ory;
22 int start_x,start_y; 22 int start_x,start_y;
23 observer_t *obs1,*obs2; 23 observer_t *obs1,*obs2;
24 shape_t *rect; 24 shape_t *rect;
104 mb_progm_abort(btn->progm); 104 mb_progm_abort(btn->progm);
105 btn->progm = NULL; 105 btn->progm = NULL;
106 } 106 }
107 COORD_SHOW(btn->click); 107 COORD_SHOW(btn->click);
108 COORD_HIDE(btn->active); 108 COORD_HIDE(btn->active);
109 rdman_coord_changed(en->rdman,en->button->root_coord); 109 rdman_coord_changed(en->rdman,btn->root);
110 rdman_redraw_changed(en->rdman); 110 rdman_redraw_changed(en->rdman);
111 111
112 btn->progm = progm = mb_progm_new(1, en->rdman); 112 btn->progm = progm = mb_progm_new(1, en->rdman);
113 MB_TIMEVAL_SET(&start, 0, 500000); 113 MB_TIMEVAL_SET(&start, 0, 500000);
114 MB_TIMEVAL_SET(&playing, 0, 0); 114 MB_TIMEVAL_SET(&playing, 0, 0);
276 engine_t *en; 276 engine_t *en;
277 mb_button_t *b; 277 mb_button_t *b;
278 278
279 en = engine_init(); 279 en = engine_init();
280 en->menu = menu_new(en->rdman, en->rdman->root_coord); 280 en->menu = menu_new(en->rdman, en->rdman->root_coord);
281 en->button = button_new(en->rdman, en->rdman->root_coord); 281 en->button = sprite_load("button",en->rdman, en->rdman->root_coord);
282 b = mb_button_new(en, (mb_sprite_t *) en->button, "btn"); 282 b = mb_button_new(en, (mb_sprite_t *) en->button, "btn");
283 mb_button_add_onClick(b, test,NULL); 283 mb_button_add_onClick(b, test,NULL);
284 284
285 en->rx = 0; 285 en->rx = 0;
286 en->ry = 0; 286 en->ry = 0;