Seperate map and asset directories
This commit is contained in:
parent
a82586f327
commit
0cbc541bce
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,5 +1,4 @@
|
||||
build*
|
||||
build
|
||||
Testing
|
||||
*.bin
|
||||
*.png
|
||||
assets
|
||||
*.tiled-session
|
||||
|
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<tileset version="1.10" tiledversion="1.11.0" name="tileset" tilewidth="32" tileheight="32" tilecount="1288" columns="56">
|
||||
<image source="tileset.png" width="1792" height="736"/>
|
||||
</tileset>
|
@ -7,7 +7,9 @@ else()
|
||||
target_link_libraries(game PRIVATE engine)
|
||||
endif()
|
||||
set_default_target_options(game)
|
||||
target_compile_definitions(game PRIVATE ASSET_DIR="${ASSET_DIR}")
|
||||
target_compile_definitions(game PRIVATE
|
||||
MAP_DIR="${CMAKE_SOURCE_DIR}/map"
|
||||
ASSET_DIR="${ASSET_DIR}")
|
||||
target_include_directories(game PUBLIC include)
|
||||
|
||||
target_link_libraries(game PRIVATE
|
||||
|
12
game/main.c
12
game/main.c
@ -250,8 +250,8 @@ static unsigned load_objtype(
|
||||
xmlNodePtr sprites)
|
||||
{
|
||||
static char buf[MAX_PATH_LEN];
|
||||
assert(strlen(ASSET_DIR) + strlen(templ) + 1 < MAX_PATH_LEN);
|
||||
strcpy(buf, ASSET_DIR);
|
||||
assert(strlen(MAP_DIR) + strlen(templ) + 1 < MAX_PATH_LEN);
|
||||
strcpy(buf, MAP_DIR);
|
||||
strcat(buf, "/");
|
||||
strcat(buf, templ);
|
||||
|
||||
@ -361,8 +361,8 @@ static void
|
||||
load_objects(gamestate_t *state, xmlNodePtr node, SDL_Renderer *renderer)
|
||||
{
|
||||
char path[MAX_PATH_LEN];
|
||||
assert(strlen(ASSET_DIR OBJSPRITES) < MAX_PATH_LEN);
|
||||
strcpy(path, ASSET_DIR OBJSPRITES);
|
||||
assert(strlen(MAP_DIR OBJSPRITES) < MAX_PATH_LEN);
|
||||
strcpy(path, MAP_DIR OBJSPRITES);
|
||||
xmlDocPtr spritesdoc = xmlParseFile(path);
|
||||
xmlNodePtr sprites = xmlDocGetRootElement(spritesdoc);
|
||||
|
||||
@ -498,8 +498,8 @@ void game_init(void *mem, SDL_Renderer *renderer)
|
||||
gamestate_t *state = (gamestate_t *)mem;
|
||||
|
||||
// Load map
|
||||
assert(strlen(ASSET_DIR MAP_ASSET) < MAX_PATH_LEN);
|
||||
strcpy(path, ASSET_DIR MAP_ASSET);
|
||||
assert(strlen(MAP_DIR MAP_ASSET) < MAX_PATH_LEN);
|
||||
strcpy(path, MAP_DIR MAP_ASSET);
|
||||
load_map(state, path, renderer);
|
||||
|
||||
// Load tileset
|
||||
|
@ -2,7 +2,7 @@
|
||||
<tileset version="1.10" tiledversion="1.11.0" name="objectsprites" tilewidth="80" tileheight="128" tilecount="5" columns="0">
|
||||
<grid orientation="orthogonal" width="1" height="1"/>
|
||||
<tile id="0">
|
||||
<image source="tiled-obj/flag-0.png" width="32" height="64"/>
|
||||
<image source="../assets/tiled-obj/flag-0.png" width="32" height="64"/>
|
||||
<objectgroup draworder="index" id="5">
|
||||
<object id="5" x="6" y="0" width="26" height="55"/>
|
||||
<object id="6" x="0" y="54">
|
||||
@ -11,7 +11,7 @@
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="1">
|
||||
<image source="tiled-obj/fountain-0.png" width="48" height="48"/>
|
||||
<image source="../assets/tiled-obj/fountain-0.png" width="48" height="48"/>
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="48" height="45"/>
|
||||
<object id="4" x="0" y="31">
|
||||
@ -20,7 +20,7 @@
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="2">
|
||||
<image source="tiled-obj/house.png" width="80" height="80"/>
|
||||
<image source="../assets/tiled-obj/house.png" width="80" height="80"/>
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="3" y="0" width="74" height="77"/>
|
||||
<object id="2" x="0" y="75">
|
||||
@ -29,7 +29,7 @@
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="3">
|
||||
<image source="tiled-obj/tower.png" width="48" height="128"/>
|
||||
<image source="../assets/tiled-obj/tower.png" width="48" height="128"/>
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="48" height="112"/>
|
||||
<object id="2" x="0" y="95">
|
||||
@ -38,7 +38,7 @@
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="4">
|
||||
<image source="tiled-obj/waterfall-0.png" width="48" height="64"/>
|
||||
<image source="../assets/tiled-obj/waterfall-0.png" width="48" height="64"/>
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="48" height="64"/>
|
||||
<object id="2" x="0" y="48">
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<tileset version="1.10" tiledversion="1.11.0" name="Overworld" tilewidth="16" tileheight="16" tilecount="1440" columns="40">
|
||||
<image source="overworld.png" width="640" height="576"/>
|
||||
<image source="../assets/overworld.png" width="640" height="576"/>
|
||||
<wangsets>
|
||||
<wangset name="Landscape" type="corner" tile="-1">
|
||||
<wangcolor name="grass" color="#00ff00" tile="0" probability="1"/>
|
Loading…
x
Reference in New Issue
Block a user