diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2018-05-24 00:36:51 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2018-05-24 01:06:12 -0700 |
commit | 04a6feb4ddf22dac13b8f9e5478b817ea4527d37 (patch) | |
tree | 04c654e9832f22adc395f19eb3923904c6710801 /src | |
parent | 29e7e9c928bd0b2918091a56013d3c3435ebed5e (diff) |
libstage: use v2f_t instead of float x,y in api
Diffstat (limited to 'src')
-rw-r--r-- | src/stage.c | 12 | ||||
-rw-r--r-- | src/stage.h | 7 |
2 files changed, 9 insertions, 10 deletions
diff --git a/src/stage.c b/src/stage.c index 064c739..c30f785 100644 --- a/src/stage.c +++ b/src/stage.c @@ -178,25 +178,23 @@ void stage_node_set_aabb(const stage_t *stage, stage_node_t *node, const aabb_t /* get the aabb for a node */ -void stage_node_get_aabb(const stage_t *stage, stage_node_t *node, aabb_t *res_aabb) +void stage_node_get_aabb(const stage_t *stage, const stage_node_t *node, aabb_t *res_aabb) { *res_aabb = node->aabb; } /* set the position for a node */ -void stage_node_set_position(const stage_t *stage, stage_node_t *node, float x, float y) +void stage_node_set_position(const stage_t *stage, stage_node_t *node, v2f_t *position) { - node->position.x = x; - node->position.y = y; + node->position = *position; } /* get the position for a node */ -void stage_node_get_position(const stage_t *stage, stage_node_t *node, float *res_x, float *res_y) +void stage_node_get_position(const stage_t *stage, const stage_node_t *node, v2f_t *res_position) { - *res_x = node->position.x; - *res_y = node->position.y; + *res_position = node->position; } diff --git a/src/stage.h b/src/stage.h index dd053f8..d29a763 100644 --- a/src/stage.h +++ b/src/stage.h @@ -22,6 +22,7 @@ #define STAGE_NODE_NAME_MAX 16 #define STAGE_LAYERS_MAX 10 +typedef struct v2f_t v2f_t; typedef struct aabb_t aabb_t; typedef struct stage_t stage_t; typedef struct stage_node_t stage_node_t; @@ -45,9 +46,9 @@ void stage_node_replace(const stage_t *stage, stage_node_t *node, const char *na stage_node_t * stage_node_free(stage_t *stage, stage_node_t *node); void stage_node_set_alpha(const stage_t *stage, stage_node_t *node, float alpha); void stage_node_set_aabb(const stage_t *stage, stage_node_t *node, const aabb_t *aabb); -void stage_node_get_aabb(const stage_t *stage, stage_node_t *node, aabb_t *res_aabb); -void stage_node_set_position(const stage_t *stage, stage_node_t *node, float x, float y); -void stage_node_get_position(const stage_t *stage, stage_node_t *node, float *res_x, float *res_y); +void stage_node_get_aabb(const stage_t *stage, const stage_node_t *node, aabb_t *res_aabb); +void stage_node_set_position(const stage_t *stage, stage_node_t *node, v2f_t *position); +void stage_node_get_position(const stage_t *stage, const stage_node_t *node, v2f_t *res_position); void stage_node_set_active(const stage_t *stage, stage_node_t *node); void stage_node_set_inactive(const stage_t *stage, stage_node_t *node); void stage_node_set_locked(const stage_t *stage, stage_node_t *node); |