annotate src/mbaf/mbapp.c @ 439:254854ed479c

Fix bug of _find_shape_in_pos(). It can not find a correct shape for a specified point. Since it call _shape_pos_is_in_cairo() directly, cairo_new_path() is not called to clear path after each calling for a shape. So, old path would interference later testing. It should call _shape_pos_is_in() instead of _shape_pos_is_in_cairo().
author Thinker K.F. Li <thinker@branda.to>
date Thu, 30 Jul 2009 15:42:47 +0800
parents 2e97e8082d83
children 84ce2d4a8c3f
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);
296
2e97e8082d83 * Fix the symbol definition code which does not assume the id is the same as the mbname.
wycc
parents: 294
diff changeset
12 app->kbevents = X_MB_kbevents(rt);
294
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
13 app->rootsprite= sprite_load(module,app->rdman, app->rdman->root_coord);
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
14 rdman_attach_backend(app->rdman, rt);
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
15 MB_SPRITE_GOTO_SCENE(app->rootsprite, 1);
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
16 return app;
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
17 }
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
18
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
19 void MBApp_setData(MBApp *app,void *data)
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
20 {
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
21 app->private = (void *) data;
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
22 }
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
23
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
24 mb_tman_t *MBApp_getTimer(MBApp *app)
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
25 {
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
26 return X_MB_tman(app->rt);
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
27 }
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
28
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
29 void MBApp_loop(MBApp *en)
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
30 {
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
31 /*
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
32 * Start handle connections, includes one to X server.
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
33 * User start to interact with the application.
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
34 */
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
35 X_MB_handle_connection(en->rt);
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
36
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
37 /*
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
38 * Clean
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
39 */
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
40 X_MB_free(en->rt);
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
41 free(en);
2ca0773cd48d * Add MBAF files
wycc
parents:
diff changeset
42 }