summaryrefslogtreecommitdiff
path: root/src/stage.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stage.c')
-rw-r--r--src/stage.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/stage.c b/src/stage.c
index 70c5424..280536a 100644
--- a/src/stage.c
+++ b/src/stage.c
@@ -43,6 +43,7 @@ struct stage_node_t {
double angle; /* angle for the texture when composited */
unsigned active:1; /* node is active */
unsigned locked:1; /* node is locked */
+ unsigned statik:1; /* node is static */
stage_render_func_t render; /* render object into a texture */
stage_free_func_t free; /* free object */
@@ -229,6 +230,12 @@ void stage_node_set_locked(const stage_t *stage, stage_node_t *node, int locked)
}
+/* set a node to static (isn't influenced by external position/origin/aabb changes, solely its own positin/origin/aabb) */
+void stage_node_set_static(const stage_t *stage, stage_node_t *node, int statik)
+{
+ /* I deliberately spelled statik to avoid language keyword collision */
+ node->statik = statik;
+}
/* set a node's layer */
@@ -371,9 +378,11 @@ static void node_to_rect(const stage_t *stage, const stage_node_t *node, const S
res_rect->x = stage_rect->x + floorf((float)stage_rect->w * .5f);
res_rect->y = stage_rect->y + floorf((float)stage_rect->h * .5f);
- /* apply stage->position (scaled relative to stage_rect) */
- res_rect->x += floorf(stage->position.x * .5f * (float)stage_rect->w);
- res_rect->y += -floorf(stage->position.y * .5f * (float)stage_rect->h);
+ if (!node->statik) {
+ /* apply stage->position (scaled relative to stage_rect) */
+ res_rect->x += floorf(stage->position.x * .5f * (float)stage_rect->w);
+ res_rect->y += -floorf(stage->position.y * .5f * (float)stage_rect->h);
+ }
/* apply node->position (scaled relative to stage_rect) */
res_rect->x += floorf(node->position.x * .5f * (float)stage_rect->w);
© All Rights Reserved