summaryrefslogtreecommitdiff
path: root/src/stage.h
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2018-09-11 01:16:50 -0700
committerVito Caputo <vcaputo@pengaru.com>2018-09-11 01:23:23 -0700
commitbd4b32fa1028a0a4340ed77080059961968c17fd (patch)
tree668372f57fca84757f50838f88a8369dfa066513 /src/stage.h
parentb263b3e4b295c42a36970435eb7df5373bce6c89 (diff)
libstage: remove everything dimensional
Having the stage manage the rendering dimensions for nodes seemed like a good idea at the time. This commit removes all that so there's no more coupling to SDL or dimensional types. Now the stage really is nothing more than a thin drawing list abstraction. The layers can be used for ordering the drawing, which is the only semi-dimensional thing remaining. The stage_fit() helper remains for now out of convenience, but it's really out of place in this library.
Diffstat (limited to 'src/stage.h')
-rw-r--r--src/stage.h34
1 files changed, 3 insertions, 31 deletions
diff --git a/src/stage.h b/src/stage.h
index 7299f4a..9f27d68 100644
--- a/src/stage.h
+++ b/src/stage.h
@@ -17,60 +17,32 @@
#ifndef _STAGE_H
#define _STAGE_H
-typedef struct SDL_Renderer SDL_Renderer;
-typedef struct SDL_Texture SDL_Texture;
-
#define STAGE_NODE_NAME_MAX 16
#define STAGE_LAYERS_MAX 10
-typedef enum stage_map_t {
- STAGE_MAP_FILL, /* -1,-1...1,1 linearly maps to the AR-constrained stage dimensions, the default */
- STAGE_MAP_MAXSQ, /* -1,-1...1,1 linearly maps to a square the size of the maximum axis of the AR-constrained stage dimensions */
- STAGE_MAP_MINSQ, /* -1,-1...1,1 linearly maps to a square the size of the minimum axis of the AR-constrained stage dimensions */
-} stage_map_t;
-
-typedef struct v2f_t v2f_t;
-typedef struct aabb_t aabb_t;
typedef struct stage_t stage_t;
typedef struct stage_node_t stage_node_t;
-typedef int (*stage_render_func_t)(SDL_Renderer *renderer, void *object, int width, int height, SDL_Texture **texture);
-typedef void (*stage_free_func_t)(void *object);
+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);
-stage_t * stage_new(SDL_Renderer *renderer, float aspect_ratio);
+stage_t * stage_new(void);
void stage_clear(stage_t *stage);
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_set_position(stage_t *stage, v2f_t *position);
-void stage_get_position(stage_t *stage, v2f_t *res_position);
-void stage_set_aabb_map(stage_t *stage, stage_map_t map);
-void stage_set_position_map(stage_t *stage, stage_map_t map);
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_get_output_size(stage_t *stage, int *res_width, int *res_height);
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_aabb(const stage_t *stage, stage_node_t *node, const aabb_t *aabb);
-void stage_node_get_aabb(const stage_t *stage, const stage_node_t *node, aabb_t *res_aabb);
-void stage_node_set_position(const stage_t *stage, stage_node_t *node, v2f_t *position);
-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, int active);
void stage_node_set_locked(const stage_t *stage, stage_node_t *node, int locked);
-void stage_node_set_static(const stage_t *stage, stage_node_t *node, int stationary);
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);
-void stage_node_set_aabb_map(const stage_t *stage, stage_node_t *node, stage_map_t fit);
-void stage_node_set_position_map(const stage_t *stage, stage_node_t *node, stage_map_t fit);
stage_node_t * stage_node_lookup_name(const stage_t *stage, const char *name);
-stage_node_t * stage_node_lookup_cartesian(const stage_t *stage, int x, int y);
#endif
© All Rights Reserved