Mercurial > MadButterfly
changeset 130:3a4d6179e6a9
change mb_c_source.m4 and mb_c_header.m4 to specify parent for SVG object
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Tue, 16 Sep 2008 21:23:34 +0800 |
parents | ba581d8a4b9b |
children | 6a8588df68af |
files | examples/calculator/main.c examples/svg2code_ex/main.c examples/tank/tank_main.c src/animate.h tools/mb_c_header.m4 tools/mb_c_source.m4 |
diffstat | 6 files changed, 15 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/examples/calculator/main.c Tue Sep 16 17:35:04 2008 +0800 +++ b/examples/calculator/main.c Tue Sep 16 21:23:34 2008 +0800 @@ -179,7 +179,7 @@ rt = X_MB_new(":0.0", 300, 400); rdman = X_MB_rdman(rt); - calculator_scr = calculator_scr_new(rdman); + calculator_scr = calculator_scr_new(rdman, rdman->root_coord); calc_data.rt = rt; calc_data.code = calculator_scr;
--- a/examples/svg2code_ex/main.c Tue Sep 16 17:35:04 2008 +0800 +++ b/examples/svg2code_ex/main.c Tue Sep 16 21:23:34 2008 +0800 @@ -61,7 +61,7 @@ * Instantiate objects from a SVG file. */ rdman = X_MB_rdman(rt); - svg2code = svg2code_ex_new(rdman); + svg2code = svg2code_ex_new(rdman, rdman->root_coord); /* * Get observer factory
--- a/examples/tank/tank_main.c Tue Sep 16 17:35:04 2008 +0800 +++ b/examples/tank/tank_main.c Tue Sep 16 21:23:34 2008 +0800 @@ -152,22 +152,22 @@ for(j = 0; j < 16; j++) { switch(map[i][j]) { case MUD: - mud = mud_new(rdman); + mud = mud_new(rdman, rdman->root_coord); CHANGE_POS(mud, j * 50, i * 50); tank_rt->map[i][j] = (void *)mud; break; case BRI: - brick = brick_new(rdman); + brick = brick_new(rdman, rdman->root_coord); CHANGE_POS(brick, j * 50, i * 50); tank_rt->map[i][j] = (void *)brick; break; case ROC: - rock = rock_new(rdman); + rock = rock_new(rdman, rdman->root_coord); CHANGE_POS(rock, j * 50, i * 50); tank_rt->map[i][j] = (void *)rock; break; case BSH: - bush = bush_new(rdman); + bush = bush_new(rdman, rdman->root_coord); CHANGE_POS(bush, j * 50, i * 50); tank_rt->map[i][j] = (void *)bush; break; @@ -175,12 +175,12 @@ } } - tank_rt->tank1 = tank1_new(rdman); + tank_rt->tank1 = tank1_new(rdman, rdman->root_coord); CHANGE_POS(tank_rt->tank1, 5 * 50, 11 * 50); - tank_rt->tank2 = tank2_new(rdman); + tank_rt->tank2 = tank2_new(rdman, rdman->root_coord); CHANGE_POS(tank_rt->tank2, 10 * 50, 11 * 50); for(i = 0; i < 3; i++) { - tank_rt->tank_enemies[i] = tank_en_new(rdman); + tank_rt->tank_enemies[i] = tank_en_new(rdman, rdman->root_coord); CHANGE_POS(tank_rt->tank_enemies[i], (2 + i * 3) * 50, 0); } tank_rt->n_enemy = i;
--- a/src/animate.h Tue Sep 16 17:35:04 2008 +0800 +++ b/src/animate.h Tue Sep 16 21:23:34 2008 +0800 @@ -11,8 +11,9 @@ * \li start, * \li step, * \li stop, - * \li free, and - * \li *_new(). + * \li free, + * \li *_new(), and + * \li add *_new() to \ref animate.h . * * *_new() must invokes mb_word_add_action() to add new object * as one of actions in the word specified as an argument of it.
--- a/tools/mb_c_header.m4 Tue Sep 16 17:35:04 2008 +0800 +++ b/tools/mb_c_header.m4 Tue Sep 16 21:23:34 2008 +0800 @@ -52,7 +52,7 @@ $2[]dnl [}; -extern $1_t *$1_new(redraw_man_t *rdman); +extern $1_t *$1_new(redraw_man_t *rdman, coord_t *parent_coord); extern void $1_free($1_t *obj); #endif /* __$1_H_ */]
--- a/tools/mb_c_source.m4 Tue Sep 16 17:35:04 2008 +0800 +++ b/tools/mb_c_source.m4 Tue Sep 16 21:23:34 2008 +0800 @@ -267,7 +267,7 @@ #include "mb/paint.h" #include "$1.h" -$1_t *$1_new(redraw_man_t *rdman) { +$1_t *$1_new(redraw_man_t *rdman, coord_t *parent_coord) { $1_t *obj; grad_stop_t *stops = NULL;]DECLARE_VARS $2[]dnl @@ -275,7 +275,7 @@ obj = ($1_t *)malloc(sizeof($1_t)); if(obj == NULL) return NULL; ]SETUP_VARS - obj->root_coord = rdman_coord_new(rdman, rdman->root_coord); + obj->root_coord = rdman_coord_new(rdman, parent_coord); $2 [ return obj; }