summaryrefslogtreecommitdiff
path: root/src/stage.c
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2019-05-10 00:54:00 -0700
committerVito Caputo <vcaputo@pengaru.com>2019-05-10 14:18:28 -0700
commit7eceed2d2f8b99d8300ae828cb942f44f6351b03 (patch)
tree152e314a03d003833ee9d53acecce0ad2e21ad48 /src/stage.c
parent7c359879af46c63d93ad9190a18da04bbeb492bb (diff)
libstage: add pass-thru pointer to stage_render()
It's common to need access to some rendering context from the per-stage render functions, this simply plumbs an opaque pointer from stage_render() down to the render functions.
Diffstat (limited to 'src/stage.c')
-rw-r--r--src/stage.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/stage.c b/src/stage.c
index a2c6e2d..44a0378 100644
--- a/src/stage.c
+++ b/src/stage.c
@@ -254,14 +254,14 @@ void stage_clear(stage_t *stage)
}
-static void _render_stage(const stage_t *stage, float alpha)
+static void _render_stage(const stage_t *stage, float alpha, void *render_ctxt)
{
float a = alpha * stage->alpha;
assert(stage);
if (stage->render)
- stage->render(stage, stage->object, a);
+ stage->render(stage, stage->object, a, render_ctxt);
for (int i = 0; i < STAGE_LAYERS_MAX; i++) {
stage_t *s;
@@ -270,21 +270,21 @@ static void _render_stage(const stage_t *stage, float alpha)
if (!s->active)
continue;
- _render_stage(s, a);
+ _render_stage(s, a, render_ctxt);
}
}
}
/* recursively render the supplied stage tree, skipping inactive branches */
-void stage_render(const stage_t *stage)
+void stage_render(const stage_t *stage, void *render_ctxt)
{
assert(stage);
if (!stage->active)
return;
- _render_stage(stage, 1.f);
+ _render_stage(stage, 1.f, render_ctxt);
}
© All Rights Reserved