comparison examples/dynamic/main.c @ 249:ab8284c8dcee

* Add loopback reference from rdman to the backend. This is only required when we need to acquire the tman for the animation. This is not a reasonable arrangement since the animation should be backend transparent. We should not touch the backend directly from the animation. We should relocate the tman to the rdman. * Remove reference to the MBApp from the mb_button_t so that it will be easier for us to generate button inside the sprite.
author wycc
date Sun, 04 Jan 2009 09:32:49 +0800
parents d9a78c859660
children a90fd749af82
comparison
equal deleted inserted replaced
248:1958bb2a87a2 249:ab8284c8dcee
114 en->currentscene = (en->currentscene + 1) % 2; 114 en->currentscene = (en->currentscene + 1) % 2;
115 printf("switch to scene %d\n", en->currentscene + 1); 115 printf("switch to scene %d\n", en->currentscene + 1);
116 MB_SPRITE_GOTO_SCENE(myApp->rootsprite,en->currentscene + 1); 116 MB_SPRITE_GOTO_SCENE(myApp->rootsprite,en->currentscene + 1);
117 } 117 }
118 118
119 MyApp_InitContent()
120 {
121 mb_button_t *b;
122 mb_sprite_t *sprite;
123
124 sprite = sprite_load("button", myApp->rdman, myApp->rdman->root_coord);
125 b = mb_button_new(myApp->rdman, sprite, "btn");
126 mb_button_add_onClick(b, test,NULL);
127 }
128
119 int main(int argc, char * const argv[]) { 129 int main(int argc, char * const argv[]) {
120 subject_t *subject; 130 subject_t *subject;
121 mb_button_t *b;
122 mb_obj_t *button; 131 mb_obj_t *button;
123 MyAppData data; 132 MyAppData data;
124 mb_timeval_t tmo,interval; 133 mb_timeval_t tmo,interval;
125 134
126 if (argc > 1) 135 if (argc > 1)
127 myApp = MBApp_Init(argv[1]); 136 myApp = MBApp_Init(argv[1]);
128 else 137 else
129 myApp = MBApp_Init("scene"); 138 myApp = MBApp_Init("scene");
130 data.currentscene=0; 139 data.currentscene=0;
131 MBApp_setData(myApp,&data); 140 MBApp_setData(myApp,&data);
132 //b = mb_button_new(myApp, myApp->rootsprite, "btn"); 141 MyApp_InitContent();
133 //mb_button_add_onClick(b, test,NULL);
134 get_now(&tmo); 142 get_now(&tmo);
135 MB_TIMEVAL_SET(&interval, 1 ,0); 143 MB_TIMEVAL_SET(&interval, 1 ,0);
136 mb_tman_timeout( MBApp_getTimer(myApp), &tmo, switch_scene, myApp); 144 mb_tman_timeout( MBApp_getTimer(myApp), &tmo, switch_scene, myApp);
137 145
138 146