summaryrefslogtreecommitdiff
path: root/src/stage.h
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2019-05-09 19:40:42 -0700
committerVito Caputo <vcaputo@pengaru.com>2019-05-10 14:18:28 -0700
commit277ead61dc5ff6bba1035acf7b6e194e6de739ad (patch)
tree7cc093ff4aed45085e10b1412939c254e6a1dfd9 /src/stage.h
parent049d14269ac518135a278132efe2ac01f92482e6 (diff)
libstage: deprecate stage_node_*, go heirarchical
Now stage_t is the only type, and a tree of stages may be constructed by supplying a parent to stage_new(). Essentially stage_t swallowed stage_node_t. The heirarchy is handy for grouping stages logically, and alpha is computed statefully during the recursive render. So alpha of grouped stages may be varied at a single parent. The active flag is also honored recursively for a similar effect; toggle subtrees in a single place. Container stages may be created by omitting object/render/free attributes. These are handy for the aforementioned group alpha/active controls.
Diffstat (limited to 'src/stage.h')
-rw-r--r--src/stage.h34
1 files changed, 14 insertions, 20 deletions
diff --git a/src/stage.h b/src/stage.h
index 942174a..8357206 100644
--- a/src/stage.h
+++ b/src/stage.h
@@ -17,32 +17,26 @@
#ifndef _STAGE_H
#define _STAGE_H
-#define STAGE_NODE_NAME_MAX 16
+#define STAGE_NAME_MAX 16
#define STAGE_LAYERS_MAX 10
typedef struct stage_t stage_t;
-typedef struct stage_node_t stage_node_t;
-typedef void (*stage_render_func_t)(const stage_t *stage, const stage_node_t *node, void *object, float alpha);
-typedef void (*stage_free_func_t)(const stage_t *stage, const stage_node_t *node, void *object);
+typedef void (*stage_render_func_t)(const stage_t *stage, void *object, float alpha);
+typedef void (*stage_free_func_t)(const stage_t *stage, void *object);
-stage_t * stage_new(void);
-void stage_clear(stage_t *stage);
+stage_t * stage_new(stage_t *parent, int layer, const char *name, void *object, stage_render_func_t render_func, stage_free_func_t free_func);
stage_t * stage_free(stage_t *stage);
-void stage_fit(float aspect_ratio, int width, int height, int *res_width, int *res_height);
-void stage_set_alpha(stage_t *stage, float alpha);
-void stage_get_alpha(stage_t *stage, float *res_alpha);
void stage_render(const stage_t *stage);
-stage_node_t * stage_node_new(stage_t *stage, int layer, const char *name, void *object, stage_render_func_t render_func, stage_free_func_t free_func);
-
-void stage_node_set_object(const stage_t *stage, stage_node_t *node, void *object);
-void stage_node_get_object(const stage_t *stage, stage_node_t *node, void **res_object);
-void stage_node_replace(const stage_t *stage, stage_node_t *node, const char *name, void *object, stage_render_func_t render_func, stage_free_func_t free_func);
-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_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);
-stage_node_t * stage_node_lookup_name(const stage_t *stage, const char *name);
+void stage_clear(stage_t *stage);
+void stage_set_alpha(stage_t *stage, float alpha);
+void stage_get_alpha(const stage_t *stage, float *res_alpha);
+void stage_set_active(stage_t *stage, int active);
+void stage_set_locked(stage_t *stage, int locked);
+void stage_set_object(stage_t *stage, void *object);
+void stage_get_object(const stage_t *stage, void **res_object);
+void stage_replace(stage_t *stage, const char *name, void *object, stage_render_func_t render_func, stage_free_func_t free_func);
+void stage_set_layer(stage_t *stage, int layer);
+stage_t * stage_lookup_name(stage_t *stage, const char *name);
#endif
© All Rights Reserved