diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2018-06-09 16:33:13 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2018-06-09 16:33:13 -0700 |
commit | 6aa5347f343927b68d4ab445724a0dec272432ce (patch) | |
tree | 9f204ac427c511f290121b349b0c769cf77a786c | |
parent | 00ac7e921426edc7e27e4ba679edc1aba6c15250 (diff) |
libstage: simplify set active and locked node api
Just pass in the boolean setting rather than having different
functions.
-rw-r--r-- | src/stage.c | 25 | ||||
-rw-r--r-- | src/stage.h | 6 |
2 files changed, 8 insertions, 23 deletions
diff --git a/src/stage.c b/src/stage.c index c52e5b1..2a8a5a5 100644 --- a/src/stage.c +++ b/src/stage.c @@ -215,33 +215,20 @@ void stage_node_get_origin(const stage_t *stage, const stage_node_t *node, v2f_t } -/* set a node to active (participates in rendering) */ -void stage_node_set_active(const stage_t *stage, stage_node_t *node) +/* set a node's active state (participates in rendering) */ +void stage_node_set_active(const stage_t *stage, stage_node_t *node, int active) { - node->active = 1; + node->active = active; } -/* set a node to inactive (doesn't participate in rendering) */ -void stage_node_set_inactive(const stage_t *stage, stage_node_t *node) +/* set a node's locked state (doesn't get freed by clears) */ +void stage_node_set_locked(const stage_t *stage, stage_node_t *node, int locked) { - /* TODO: should this discard the potentially cached texture? */ - node->active = 0; + node->locked = locked; } -/* set a node to locked (doesn't get freed by clears) */ -void stage_node_set_locked(const stage_t *stage, stage_node_t *node) -{ - node->locked = 1; -} - - -/* set a node to unlocked (default, gets freed by clears) */ -void stage_node_set_unlocked(const stage_t *stage, stage_node_t *node) -{ - node->locked = 0; -} /* set a node's layer */ diff --git a/src/stage.h b/src/stage.h index a51656d..f5d38e6 100644 --- a/src/stage.h +++ b/src/stage.h @@ -54,10 +54,8 @@ void stage_node_set_position(const stage_t *stage, stage_node_t *node, v2f_t *po void stage_node_get_position(const stage_t *stage, const stage_node_t *node, v2f_t *res_position); void stage_node_set_origin(const stage_t *stage, stage_node_t *node, v2f_t *origin); void stage_node_get_origin(const stage_t *stage, const stage_node_t *node, v2f_t *res_origin); -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); -void stage_node_set_unlocked(const stage_t *stage, stage_node_t *node); +void stage_node_set_active(const stage_t *stage, stage_node_t *node, int active); +void stage_node_set_locked(const stage_t *stage, stage_node_t *node, int locked); void stage_node_set_layer(stage_t *stage, stage_node_t *node, int layer); void stage_node_set_angle(const stage_t *stage, stage_node_t *node, double angle); void stage_node_get_angle(const stage_t *stage, stage_node_t *node, double *res_angle); |