diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2019-06-12 14:43:52 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2019-06-12 14:43:52 -0700 |
commit | 83a324a7d4a2c3e0a75148c918171b14f77dd371 (patch) | |
tree | 58a0051bf815e647955a82fdc6f0190e9acb1453 /src/stage.h | |
parent | 196a44106ef10b343d06be2c130cba4037e85aec (diff) |
libstage: introduce stage_conf_t for stage_new()
stage_new() call sites were getting quite annoying, using compound
literals with designated initializers on a struct makes the call sites
a lot more readable, self-documenting, and often more compact thanks
to the automatic zeroing of omitted members.
I don't particularly like the name, and may switch it later, something
shorter would be nice.
Diffstat (limited to 'src/stage.h')
-rw-r--r-- | src/stage.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/stage.h b/src/stage.h index 2b5cc91..86d2311 100644 --- a/src/stage.h +++ b/src/stage.h @@ -27,7 +27,21 @@ typedef void (stage_render_func_t)(const stage_t *stage, void *object, float alp typedef void (stage_free_func_t)(const stage_t *stage, void *object); typedef stage_t * (stage_lookup_func_t)(const stage_t *stage, void *object, void *key); -stage_t * stage_new(stage_t *parent, int layer, const char *name, void *object, stage_prepare_func_t *prepare_func, stage_render_func_t *render_func, stage_free_func_t *free_func, stage_lookup_func_t *lookup_func); +typedef struct stage_conf_t { + stage_t *parent; + int layer; + const char *name; + void *object; + stage_prepare_func_t *prepare_func; + stage_render_func_t *render_func; + stage_free_func_t *free_func; + stage_lookup_func_t *lookup_func; + float alpha; + unsigned active:1; + unsigned locked:1; +} stage_conf_t; + +stage_t * stage_new(const stage_conf_t *conf); void stage_replace(stage_t *stage, const char *name, void *object, stage_prepare_func_t *prepare_func, stage_render_func_t *render_func, stage_free_func_t *free_func, stage_lookup_func_t *lookup_func); stage_t * stage_free(stage_t *stage); int stage_render(stage_t *stage, void *render_ctxt); |