294
|
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 rdman_attach_backend(app->rdman, rt);
|
|
14 MB_SPRITE_GOTO_SCENE(app->rootsprite, 1);
|
|
15 return app;
|
|
16 }
|
|
17
|
|
18 void MBApp_setData(MBApp *app,void *data)
|
|
19 {
|
|
20 app->private = (void *) data;
|
|
21 }
|
|
22
|
|
23 mb_tman_t *MBApp_getTimer(MBApp *app)
|
|
24 {
|
|
25 return X_MB_tman(app->rt);
|
|
26 }
|
|
27
|
|
28 void MBApp_loop(MBApp *en)
|
|
29 {
|
|
30 /*
|
|
31 * Start handle connections, includes one to X server.
|
|
32 * User start to interact with the application.
|
|
33 */
|
|
34 X_MB_handle_connection(en->rt);
|
|
35
|
|
36 /*
|
|
37 * Clean
|
|
38 */
|
|
39 X_MB_free(en->rt);
|
|
40 free(en);
|
|
41 }
|