summaryrefslogtreecommitdiff
path: root/src/stage.h
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2018-06-11 23:24:23 -0700
committerVito Caputo <vcaputo@pengaru.com>2018-06-11 23:35:00 -0700
commit853b6f1c47caa825aea09d3e8fefee47098f3be7 (patch)
treefd64539e8f945d1d4427a52183f68609875464fa /src/stage.h
parent5caa894a3612b8bc090271f5c26daa556237dd97 (diff)
libstage: add alternate node mappings
Until now all aabb and position mapping has been simple linear filling of the stage. When the stage isn't square, which is usually, this isn't always desirable especially for the aabb sizing of things. This introduces per-node settings for the mapping of the node's aabb and position. The default continues to be to map the full stage, with two new settings for the minimum square and maximum square.
Diffstat (limited to 'src/stage.h')
-rw-r--r--src/stage.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/stage.h b/src/stage.h
index f157653..6e0a93c 100644
--- a/src/stage.h
+++ b/src/stage.h
@@ -23,6 +23,12 @@ 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;
@@ -60,6 +66,8 @@ void stage_node_set_static(const stage_t *stage, stage_node_t *node, int station
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);
© All Rights Reserved