annotate src/mbaf/mbapp.c @ 294:2ca0773cd48d

* Add MBAF files * Change begin_index to be start_index * fix the color setting.
author wycc
date Sun, 01 Feb 2009 09:51:12 +0800
parents
children 2e97e8082d83
rev   line source
294
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
1 #include <mb.h>
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
2 #include <mbapp.h>
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
3 MBApp *MBApp_Init(char *module)
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
4 {
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
5 MBApp *app = (MBApp *) malloc(sizeof(MBApp));
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
6 X_MB_runtime_t *rt;
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
7
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
8 rt = X_MB_new(":0.0", 800, 600);
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
9
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
10 app->rt = rt;
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
11 app->rdman = X_MB_rdman(rt);
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
12 app->rootsprite= sprite_load(module,app->rdman, app->rdman->root_coord);
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
13 rdman_attach_backend(app->rdman, rt);
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
14 MB_SPRITE_GOTO_SCENE(app->rootsprite, 1);
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
15 return app;
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
16 }
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
17
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
18 void MBApp_setData(MBApp *app,void *data)
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
19 {
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
20 app->private = (void *) data;
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
21 }
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
22
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
23 mb_tman_t *MBApp_getTimer(MBApp *app)
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
24 {
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
25 return X_MB_tman(app->rt);
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
26 }
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
27
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
28 void MBApp_loop(MBApp *en)
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
29 {
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
30 /*
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
31 * Start handle connections, includes one to X server.
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
32 * User start to interact with the application.
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
33 */
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
34 X_MB_handle_connection(en->rt);
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
35
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
36 /*
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
37 * Clean
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
38 */
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
39 X_MB_free(en->rt);
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
40 free(en);
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
41 }