Mercurial > MadButterfly
comparison 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 |
comparison
equal
deleted
inserted
replaced
246:4df1b766bbf5 | 247:d9a78c859660 |
---|---|
1 #include <mb.h> | |
2 #include <mbapp.h> | |
3 MBApp *MBApp_Init(char *module) | |
4 { | |
5 MBApp *app = (MBApp *) malloc(sizeof(MBApp)); | |
6 X_MB_runtime_t *rt; | |
7 | |
8 rt = X_MB_new(":0.0", 800, 600); | |
9 | |
10 app->rt = rt; | |
11 app->rdman = X_MB_rdman(rt); | |
12 app->rootsprite= sprite_load(module,app->rdman, app->rdman->root_coord); | |
13 return app; | |
14 } | |
15 | |
16 void MBApp_setData(MBApp *app,void *data) | |
17 { | |
18 app->private = (void *) data; | |
19 } | |
20 | |
21 mb_tman_t *MBApp_getTimer(MBApp *app) | |
22 { | |
23 return X_MB_tman(app->rt); | |
24 } | |
25 | |
26 void MBApp_loop(MBApp *en) | |
27 { | |
28 /* | |
29 * Start handle connections, includes one to X server. | |
30 * User start to interact with the application. | |
31 */ | |
32 X_MB_handle_connection(en->rt); | |
33 | |
34 /* | |
35 * Clean | |
36 */ | |
37 X_MB_free(en->rt); | |
38 free(en); | |
39 } |