Mercurial > MadButterfly
diff examples/dynamic/hello.c @ 454:9b8dda201ccb
Make naming convention consistent with MadButterfly.
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Thu, 06 Aug 2009 09:38:51 +0800 |
parents | 84ce2d4a8c3f |
children | 26c302b47de1 |
line wrap: on
line diff
--- a/examples/dynamic/hello.c Wed Aug 05 19:34:59 2009 +0800 +++ b/examples/dynamic/hello.c Thu Aug 06 09:38:51 2009 +0800 @@ -11,7 +11,7 @@ #include "mbapp.h" -MBApp *myApp; +mbaf_t *app; typedef struct { shape_t *rect; @@ -19,46 +19,46 @@ int start_x,start_y; observer_t *obs1,*obs2; int currentscene; -}MyAppData; +}app_data_t; void switch_scene(const mb_timeval_t *tmo, const mb_timeval_t *now,void *arg) { - MyAppData *en = MBAPP_DATA((MBApp *)arg,MyAppData ); + app_data_t *en = MBAF_DATA((mbaf_t *)arg,app_data_t ); mb_timeval_t timer,interval; get_now(&timer); MB_TIMEVAL_SET(&interval, 1 ,0); MB_TIMEVAL_ADD(&timer, &interval); - mb_tman_timeout( MBApp_getTimer(myApp), &timer, switch_scene, myApp); + mb_tman_timeout( mbaf_get_timer(app), &timer, switch_scene, app); en->currentscene = (en->currentscene + 1) % 2; printf("switch to scene %d\n", en->currentscene + 1); - MB_SPRITE_GOTO_SCENE(myApp->rootsprite,en->currentscene + 1); + MB_SPRITE_GOTO_SCENE(app->rootsprite,en->currentscene + 1); } int main(int argc, char * const argv[]) { subject_t *subject; mb_button_t *b; mb_obj_t *button; - MyAppData data; + app_data_t data; mb_timeval_t tmo,interval; if (argc > 1) - myApp = MBApp_Init(argv[1], ""); + app = mbaf_init(argv[1], ""); else - myApp = MBApp_Init("scene", ".libs"); + app = mbaf_init("scene", ".libs"); data.currentscene=0; - MBApp_setData(myApp,&data); - //b = mb_button_new(myApp, myApp->rootsprite, "btn"); + mbaf_set_data(app,&data); + //b = mb_button_new(app, app->rootsprite, "btn"); //mb_button_add_onClick(b, test,NULL); get_now(&tmo); MB_TIMEVAL_SET(&interval, 1 ,0); - mb_tman_timeout( MBApp_getTimer(myApp), &tmo, switch_scene, myApp); + mb_tman_timeout( mbaf_get_timer(app), &tmo, switch_scene, app); - MBApp_loop(myApp); + mbaf_loop(app); return 0; }