summaryrefslogtreecommitdiff
path: root/src/tiledfile.c
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2023-07-11 23:24:54 +0100
committerdavidovski <david@davidovski.xyz>2023-07-11 23:24:54 +0100
commit3f2113f823f94ca91e93182cc5a2ab6b0ac5cfb6 (patch)
tree3921730af4301b705682d14d1f51b3ba545b6418 /src/tiledfile.c
parent9675503933d488736bb59f81337ab103fc0b2f57 (diff)
tidy saving code
Diffstat (limited to 'src/tiledfile.c')
-rw-r--r--src/tiledfile.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/tiledfile.c b/src/tiledfile.c
index 78f9c0e..eaeb814 100644
--- a/src/tiledfile.c
+++ b/src/tiledfile.c
@@ -111,6 +111,22 @@ TiledMap loadTiledMap(char * filename) {
return tiledMap;
}
+TiledMap newTiledMap(Image atlas, int tileSize, int width, int height) {
+ TiledMap tiledMap;
+ tiledMap.width = width;
+ tiledMap.height = height;
+ tiledMap.tilelayout = malloc(width * height);
+
+ tiledMap.tileSize = tileSize;
+
+ tiledMap.atlasSize[0] = atlas.width / tileSize;
+ tiledMap.atlasSize[1] = atlas.height / tileSize;
+
+ tiledMap.atlasData = LoadImageColors(atlas);
+
+ return tiledMap;
+}
+
void saveTiledMap(char * filename, TiledMap tiledMap) {
FILE * file;