summaryrefslogtreecommitdiff
path: root/src/tiledfile.c
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2023-07-11 18:28:48 +0100
committerdavidovski <david@davidovski.xyz>2023-07-11 19:29:05 +0100
commit625cb961a3b35afdaf6d5c1e8bf4966a522a022a (patch)
treecf2cafdd8d7ca670712f930ab9175de71be3527c /src/tiledfile.c
parente8b6b1f0ee8b825443972b99b191fd5a85437008 (diff)
add editor
Diffstat (limited to 'src/tiledfile.c')
-rw-r--r--src/tiledfile.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/tiledfile.c b/src/tiledfile.c
index d6d4b1b..bf0a828 100644
--- a/src/tiledfile.c
+++ b/src/tiledfile.c
@@ -30,6 +30,7 @@ void renderTilemapTexture(Texture2D *texOut, TiledMap tiledMap) {
textureFromPixels(texOut, pixels, tiledMap.width, tiledMap.height);
}
+
//! read rgba image from file
void readrgba(Texture2D *loc, int width, int height, FILE *file) {
Color *pixels = malloc(width*height*4);
@@ -57,6 +58,14 @@ int readb(char * out, size_t noBytes, FILE * file) {
return 0;
}
+char getTiledMapTile(TiledMap tiledMap, int pos[2]) {
+ return tiledMap.tilelayout[pos[1]*tiledMap.width + pos[0]];
+}
+
+void setTiledMapTile(TiledMap tiledMap, int pos[2], char tile) {
+ tiledMap.tilelayout[pos[1]*tiledMap.width + pos[0]] = tile;
+}
+
//! load tilemap data from file
TiledMap loadTiledMap(char * filename) {
TiledMap tiledMap;