diff 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
line wrap: on
line diff
--- a/examples/dynamic/main.c	Sat Jan 03 08:43:29 2009 +0800
+++ b/examples/dynamic/main.c	Sun Jan 04 09:32:49 2009 +0800
@@ -116,9 +116,18 @@
     MB_SPRITE_GOTO_SCENE(myApp->rootsprite,en->currentscene + 1);
 }
 
+MyApp_InitContent()
+{
+    mb_button_t *b;
+    mb_sprite_t *sprite;
+
+    sprite = sprite_load("button", myApp->rdman, myApp->rdman->root_coord);
+    b = mb_button_new(myApp->rdman, sprite, "btn");
+    mb_button_add_onClick(b, test,NULL);
+}
+
 int main(int argc, char * const argv[]) {
     subject_t *subject;
-    mb_button_t *b;
     mb_obj_t *button;
     MyAppData data;
     mb_timeval_t tmo,interval;
@@ -129,8 +138,7 @@
 	    myApp = MBApp_Init("scene");
     data.currentscene=0;
     MBApp_setData(myApp,&data);
-    //b = mb_button_new(myApp, myApp->rootsprite, "btn");
-    //mb_button_add_onClick(b, test,NULL);
+    MyApp_InitContent();
     get_now(&tmo);
     MB_TIMEVAL_SET(&interval, 1 ,0);
     mb_tman_timeout( MBApp_getTimer(myApp), &tmo, switch_scene, myApp);