summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--demos/checkerboard/checkerboard.c3
-rw-r--r--include/isogfx/gfx2d.h16
-rw-r--r--src/gfx2d.c2
3 files changed, 15 insertions, 6 deletions
diff --git a/demos/checkerboard/checkerboard.c b/demos/checkerboard/checkerboard.c
index 467da61..243f7a8 100644
--- a/demos/checkerboard/checkerboard.c
+++ b/demos/checkerboard/checkerboard.c
@@ -86,7 +86,8 @@ static bool init(GfxApp* app, GfxAppState* state, int argc, const char** argv) {
86 .tile_height = TILE_HEIGHT, 86 .tile_height = TILE_HEIGHT,
87 .world_width = WORLD_WIDTH, 87 .world_width = WORLD_WIDTH,
88 .world_height = WORLD_HEIGHT, 88 .world_height = WORLD_HEIGHT,
89 .num_tiles = NUM_TILES}); 89 .num_tiles = NUM_TILES,
90 .orientation = MapIsometric});
90 91
91 const Tile black = gfx2d_make_tile(iso, &tile_set[Black]); 92 const Tile black = gfx2d_make_tile(iso, &tile_set[Black]);
92 const Tile white = gfx2d_make_tile(iso, &tile_set[White]); 93 const Tile white = gfx2d_make_tile(iso, &tile_set[White]);
diff --git a/include/isogfx/gfx2d.h b/include/isogfx/gfx2d.h
index 59566f3..a3ddbb6 100644
--- a/include/isogfx/gfx2d.h
+++ b/include/isogfx/gfx2d.h
@@ -37,12 +37,18 @@ typedef struct TileDesc {
37 }; 37 };
38} TileDesc; 38} TileDesc;
39 39
40typedef enum MapOrientation {
41 MapOrthogonal,
42 MapIsometric,
43} MapOrientation;
44
40typedef struct MapDesc { 45typedef struct MapDesc {
41 int tile_width; // Base tile width in pixels. 46 int tile_width; // Base tile width in pixels.
42 int tile_height; // Base tile height in pixels. 47 int tile_height; // Base tile height in pixels.
43 int world_width; // World width in tiles. 48 int world_width; // World width in tiles.
44 int world_height; // World height in tiles. 49 int world_height; // World height in tiles.
45 int num_tiles; // Number of tiles to allocate memory for. 50 int num_tiles; // Number of tiles to allocate memory for.
51 MapOrientation orientation; // Map orientation.
46} MapDesc; 52} MapDesc;
47 53
48typedef struct IsoGfxDesc { 54typedef struct IsoGfxDesc {
diff --git a/src/gfx2d.c b/src/gfx2d.c
index 266a5f7..f609c98 100644
--- a/src/gfx2d.c
+++ b/src/gfx2d.c
@@ -263,6 +263,8 @@ void gfx2d_make_map(Gfx2d* gfx, const MapDesc* desc) {
263 .base_tile_width = desc->tile_width, 263 .base_tile_width = desc->tile_width,
264 .base_tile_height = desc->tile_height, 264 .base_tile_height = desc->tile_height,
265 .num_layers = 1, 265 .num_layers = 1,
266 .flags =
267 (desc->orientation == MapOrthogonal) ? Tm_Orthogonal : Tm_Isometric,
266 }; 268 };
267 269
268 gfx->tileset = memstack_alloc_aligned(&gfx->stack, tileset_size_bytes, 4); 270 gfx->tileset = memstack_alloc_aligned(&gfx->stack, tileset_size_bytes, 4);