Mercurial > MadButterfly
diff examples/dynamic/mbapp.c @ 247:d9a78c859660
Seperate the frameowrk codes from the main.c.
Write a simpler MBAF demo hello program.
author | wycc |
---|---|
date | Thu, 01 Jan 2009 08:32:03 +0800 |
parents | |
children | ab8284c8dcee |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/dynamic/mbapp.c Thu Jan 01 08:32:03 2009 +0800 @@ -0,0 +1,39 @@ +#include <mb.h> +#include <mbapp.h> +MBApp *MBApp_Init(char *module) +{ + MBApp *app = (MBApp *) malloc(sizeof(MBApp)); + X_MB_runtime_t *rt; + + rt = X_MB_new(":0.0", 800, 600); + + app->rt = rt; + app->rdman = X_MB_rdman(rt); + app->rootsprite= sprite_load(module,app->rdman, app->rdman->root_coord); + return app; +} + +void MBApp_setData(MBApp *app,void *data) +{ + app->private = (void *) data; +} + +mb_tman_t *MBApp_getTimer(MBApp *app) +{ + return X_MB_tman(app->rt); +} + +void MBApp_loop(MBApp *en) +{ + /* + * Start handle connections, includes one to X server. + * User start to interact with the application. + */ + X_MB_handle_connection(en->rt); + + /* + * Clean + */ + X_MB_free(en->rt); + free(en); +}