From 5941948319139b4224df29762d66de2430cc994f Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Tue, 2 Sep 2025 18:44:30 -0700 Subject: Rename map functions. --- demos/checkerboard/checkerboard.c | 12 ++++++------ demos/isomap/isomap.c | 2 +- include/isogfx/isogfx.h | 12 ++++++------ 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) { } IsoGfx* iso = state->iso; - isogfx_make_world( - iso, &(WorldDesc){.tile_width = TILE_WIDTH, - .tile_height = TILE_HEIGHT, - .world_width = WORLD_WIDTH, - .world_height = WORLD_HEIGHT, - .num_tiles = NUM_TILES}); + isogfx_make_map( + iso, &(MapDesc){.tile_width = TILE_WIDTH, + .tile_height = TILE_HEIGHT, + .world_width = WORLD_WIDTH, + .world_height = WORLD_HEIGHT, + .num_tiles = NUM_TILES}); const Tile black = isogfx_make_tile(iso, &tile_set[Black]); 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) { } IsoGfx* iso = state->iso; - if (!isogfx_load_world( + if (!isogfx_load_map( iso, "/home/jeanne/Nextcloud/assets/tilemaps/scrabling1.tm")) { return false; } 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 { }; } TileDesc; -typedef struct WorldDesc { +typedef struct MapDesc { int tile_width; // Base tile width in pixels. int tile_height; // Base tile height in pixels. int world_width; // World width in tiles. int world_height; // World height in tiles. int num_tiles; // Number of tiles to allocate memory for. -} WorldDesc; +} MapDesc; typedef struct IsoGfxDesc { void* memory; // Block of memory for the engine to use. @@ -61,11 +61,11 @@ void isogfx_del(IsoGfx**); /// Clear all loaded worlds and sprites. void isogfx_clear(IsoGfx*); -/// Create an empty world. -void isogfx_make_world(IsoGfx*, const WorldDesc*); +/// Create an empty map. +void isogfx_make_map(IsoGfx*, const MapDesc*); -/// Load a world from a tile map (.TM) file. -bool isogfx_load_world(IsoGfx*, const char* filepath); +/// Load a tile map (.TM) file. +bool isogfx_load_map(IsoGfx*, const char* filepath); /// Return the world's width. 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) { } } -void isogfx_make_world(IsoGfx* iso, const WorldDesc* desc) { +void isogfx_make_map(IsoGfx* iso, const MapDesc* desc) { assert(iso); assert(desc); assert(desc->tile_width > 0); @@ -246,7 +246,7 @@ void isogfx_make_world(IsoGfx* iso, const WorldDesc* desc) { iso->iso_space = make_iso_coord_system(iso->map, &iso->screen); } -bool isogfx_load_world(IsoGfx* iso, const char* filepath) { +bool isogfx_load_map(IsoGfx* iso, const char* filepath) { assert(iso); assert(filepath); @@ -592,7 +592,7 @@ static void draw_tile(IsoGfx* iso, ivec2 screen_origin, Tile tile) { &iso->screen, top_left, pTile->width, pTile->height, pixels, nullptr); } -static void draw_world(IsoGfx* iso) { +static void draw_map(IsoGfx* iso) { assert(iso); const int W = iso->screen.width; @@ -655,7 +655,7 @@ void isogfx_set_camera(IsoGfx* iso, int x, int y) { void isogfx_render(IsoGfx* iso) { assert(iso); - draw_world(iso); + draw_map(iso); draw_sprites(iso); } -- cgit v1.2.3