diff options
author | kdx <kikoodx@paranoici.org> | 2023-07-16 23:10:58 +0200 |
---|---|---|
committer | kdx <kikoodx@paranoici.org> | 2023-07-16 23:10:58 +0200 |
commit | 21af10a4faf14932784668ea01019c63276a422a (patch) | |
tree | 94f5551fe4ad0a961187fbe7b6d353e294d2b500 | |
parent | e01373acd557c16f38153084b155143cd0b37848 (diff) | |
download | study-sttky-21af10a4faf14932784668ea01019c63276a422a.tar.gz |
fix build
-rw-r--r-- | Tupfile | 2 | ||||
-rw-r--r-- | res/font.png | bin | 5690 -> 166 bytes | |||
-rw-r--r-- | res/player.png | bin | 89 -> 97 bytes | |||
-rw-r--r-- | src/map.c | 4 | ||||
-rw-r--r-- | src/tiled2c.h | 23 |
5 files changed, 25 insertions, 4 deletions
@@ -7,7 +7,7 @@ LDFLAGS = -lm -lSDL2 -lSDL2_image -lSDL2_mixer # codebase : foreach map/*.tmj |> tiled2c %f embed_%B_tmj >%o |> build/embed_%B_tmj.c : foreach map/*.tsj |> tiled2c %f embed_%B_tsj >%o |> build/embed_%B_tsj.c -: foreach res/*.png res/pal.png |> pximg spr_%B %f res/pal.png >%o |> build/spr_%B.c +: foreach res/*.png ^res/pal.png |> pximg spr_%B %f res/pal.png >%o |> build/spr_%B.c : foreach res/*.txt |> ./mimic.sh "%f" "%o" |> build/res/%B.wav : res/pal.png |> pxpal res/pal.png >%o |> build/pxpal.c : foreach src/*.c |> $(CC) $(CFLAGS) -c -o %o %f |> build/%B.o diff --git a/res/font.png b/res/font.png Binary files differindex 9be5b5a..149e764 100644 --- a/res/font.png +++ b/res/font.png diff --git a/res/player.png b/res/player.png Binary files differindex 1b00f2d..c2a1383 100644 --- a/res/player.png +++ b/res/player.png @@ -62,7 +62,7 @@ map_get(int x, int y, unsigned int type) return (type != TILE_SPIKE); for (unsigned int i = 0; i < map->numlayers; i++) { const unsigned int tile = map->layers[i] - .data[x + y * map_width()]; + .tilelayer.data[x + y * map_width()]; if (tile_type(tile) == type) return true; } @@ -87,7 +87,7 @@ draw_layer(const Tiled2cLayer *layer) for (int y = 0; y < map_height(); y++) for (int x = 0; x < map_width(); x++) { const unsigned tile = - layer->data[x + y * map_width()]; + layer->tilelayer.data[x + y * map_width()]; if (tile == 0) continue; const unsigned vtile = tile_visual(tile); diff --git a/src/tiled2c.h b/src/tiled2c.h index f57c83a..bbf7ce8 100644 --- a/src/tiled2c.h +++ b/src/tiled2c.h @@ -1,4 +1,7 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif typedef struct { double duration; @@ -28,12 +31,26 @@ typedef struct { } Tiled2cSet; typedef struct { + const unsigned int *data; +} Tiled2cTilelayer; + +typedef struct { + const char *image; + int x; + int y; +} Tiled2cImagelayer; + +typedef struct { const char *name; + unsigned int type; double opacity; unsigned int visible; double parallaxx; double parallaxy; - const unsigned int *data; + union { + Tiled2cTilelayer tilelayer; + Tiled2cImagelayer imagelayer; + }; } Tiled2cLayer; typedef struct { @@ -59,3 +76,7 @@ typedef struct { const Tiled2cObject *objects; unsigned int numobjects; } Tiled2cMap; + +#ifdef __cplusplus +} +#endif |