diff options
author | 3gg <3gg@shellblade.net> | 2025-09-02 18:44:30 -0700 |
---|---|---|
committer | 3gg <3gg@shellblade.net> | 2025-09-02 18:45:12 -0700 |
commit | 5941948319139b4224df29762d66de2430cc994f (patch) | |
tree | 21ab50c106600a4fcc2245587ff513b9b95deb38 | |
parent | e6bf7e77797103ee7ab0eda57c360c38f1b2089c (diff) |
Rename map functions.
-rw-r--r-- | demos/checkerboard/checkerboard.c | 12 | ||||
-rw-r--r-- | demos/isomap/isomap.c | 2 | ||||
-rw-r--r-- | include/isogfx/isogfx.h | 12 | ||||
-rw-r--r-- | src/isogfx.c | 8 |
4 files changed, 17 insertions, 17 deletions
diff --git a/demos/checkerboard/checkerboard.c b/demos/checkerboard/checkerboard.c index 0c8ff37..7ca31e1 100644 --- a/demos/checkerboard/checkerboard.c +++ b/demos/checkerboard/checkerboard.c | |||
@@ -81,12 +81,12 @@ static bool init(GfxApp* app, GfxAppState* state, int argc, const char** argv) { | |||
81 | } | 81 | } |
82 | IsoGfx* iso = state->iso; | 82 | IsoGfx* iso = state->iso; |
83 | 83 | ||
84 | isogfx_make_world( | 84 | isogfx_make_map( |
85 | iso, &(WorldDesc){.tile_width = TILE_WIDTH, | 85 | iso, &(MapDesc){.tile_width = TILE_WIDTH, |
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 | 90 | ||
91 | const Tile black = isogfx_make_tile(iso, &tile_set[Black]); | 91 | const Tile black = isogfx_make_tile(iso, &tile_set[Black]); |
92 | const Tile white = isogfx_make_tile(iso, &tile_set[White]); | 92 | const Tile white = isogfx_make_tile(iso, &tile_set[White]); |
diff --git a/demos/isomap/isomap.c b/demos/isomap/isomap.c index 27c2bf3..391860c 100644 --- a/demos/isomap/isomap.c +++ b/demos/isomap/isomap.c | |||
@@ -46,7 +46,7 @@ static bool init(GfxApp* app, GfxAppState* state, int argc, const char** argv) { | |||
46 | } | 46 | } |
47 | IsoGfx* iso = state->iso; | 47 | IsoGfx* iso = state->iso; |
48 | 48 | ||
49 | if (!isogfx_load_world( | 49 | if (!isogfx_load_map( |
50 | iso, "/home/jeanne/Nextcloud/assets/tilemaps/scrabling1.tm")) { | 50 | iso, "/home/jeanne/Nextcloud/assets/tilemaps/scrabling1.tm")) { |
51 | return false; | 51 | return false; |
52 | } | 52 | } |
diff --git a/include/isogfx/isogfx.h b/include/isogfx/isogfx.h index 7a7f814..323b389 100644 --- a/include/isogfx/isogfx.h +++ b/include/isogfx/isogfx.h | |||
@@ -37,13 +37,13 @@ typedef struct TileDesc { | |||
37 | }; | 37 | }; |
38 | } TileDesc; | 38 | } TileDesc; |
39 | 39 | ||
40 | typedef struct WorldDesc { | 40 | typedef struct MapDesc { |
41 | int tile_width; // Base tile width in pixels. | 41 | int tile_width; // Base tile width in pixels. |
42 | int tile_height; // Base tile height in pixels. | 42 | int tile_height; // Base tile height in pixels. |
43 | int world_width; // World width in tiles. | 43 | int world_width; // World width in tiles. |
44 | int world_height; // World height in tiles. | 44 | int world_height; // World height in tiles. |
45 | int num_tiles; // Number of tiles to allocate memory for. | 45 | int num_tiles; // Number of tiles to allocate memory for. |
46 | } WorldDesc; | 46 | } MapDesc; |
47 | 47 | ||
48 | typedef struct IsoGfxDesc { | 48 | typedef struct IsoGfxDesc { |
49 | void* memory; // Block of memory for the engine to use. | 49 | void* memory; // Block of memory for the engine to use. |
@@ -61,11 +61,11 @@ void isogfx_del(IsoGfx**); | |||
61 | /// Clear all loaded worlds and sprites. | 61 | /// Clear all loaded worlds and sprites. |
62 | void isogfx_clear(IsoGfx*); | 62 | void isogfx_clear(IsoGfx*); |
63 | 63 | ||
64 | /// Create an empty world. | 64 | /// Create an empty map. |
65 | void isogfx_make_world(IsoGfx*, const WorldDesc*); | 65 | void isogfx_make_map(IsoGfx*, const MapDesc*); |
66 | 66 | ||
67 | /// Load a world from a tile map (.TM) file. | 67 | /// Load a tile map (.TM) file. |
68 | bool isogfx_load_world(IsoGfx*, const char* filepath); | 68 | bool isogfx_load_map(IsoGfx*, const char* filepath); |
69 | 69 | ||
70 | /// Return the world's width. | 70 | /// Return the world's width. |
71 | int isogfx_world_width(const IsoGfx*); | 71 | int isogfx_world_width(const IsoGfx*); |
diff --git a/src/isogfx.c b/src/isogfx.c index 865ebb4..fcb4b19 100644 --- a/src/isogfx.c +++ b/src/isogfx.c | |||
@@ -198,7 +198,7 @@ void isogfx_del(IsoGfx** ppIso) { | |||
198 | } | 198 | } |
199 | } | 199 | } |
200 | 200 | ||
201 | void isogfx_make_world(IsoGfx* iso, const WorldDesc* desc) { | 201 | void isogfx_make_map(IsoGfx* iso, const MapDesc* desc) { |
202 | assert(iso); | 202 | assert(iso); |
203 | assert(desc); | 203 | assert(desc); |
204 | assert(desc->tile_width > 0); | 204 | assert(desc->tile_width > 0); |
@@ -246,7 +246,7 @@ void isogfx_make_world(IsoGfx* iso, const WorldDesc* desc) { | |||
246 | iso->iso_space = make_iso_coord_system(iso->map, &iso->screen); | 246 | iso->iso_space = make_iso_coord_system(iso->map, &iso->screen); |
247 | } | 247 | } |
248 | 248 | ||
249 | bool isogfx_load_world(IsoGfx* iso, const char* filepath) { | 249 | bool isogfx_load_map(IsoGfx* iso, const char* filepath) { |
250 | assert(iso); | 250 | assert(iso); |
251 | assert(filepath); | 251 | assert(filepath); |
252 | 252 | ||
@@ -592,7 +592,7 @@ static void draw_tile(IsoGfx* iso, ivec2 screen_origin, Tile tile) { | |||
592 | &iso->screen, top_left, pTile->width, pTile->height, pixels, nullptr); | 592 | &iso->screen, top_left, pTile->width, pTile->height, pixels, nullptr); |
593 | } | 593 | } |
594 | 594 | ||
595 | static void draw_world(IsoGfx* iso) { | 595 | static void draw_map(IsoGfx* iso) { |
596 | assert(iso); | 596 | assert(iso); |
597 | 597 | ||
598 | const int W = iso->screen.width; | 598 | const int W = iso->screen.width; |
@@ -655,7 +655,7 @@ void isogfx_set_camera(IsoGfx* iso, int x, int y) { | |||
655 | 655 | ||
656 | void isogfx_render(IsoGfx* iso) { | 656 | void isogfx_render(IsoGfx* iso) { |
657 | assert(iso); | 657 | assert(iso); |
658 | draw_world(iso); | 658 | draw_map(iso); |
659 | draw_sprites(iso); | 659 | draw_sprites(iso); |
660 | } | 660 | } |
661 | 661 | ||