halsafar/libtmx-parser added to project
This commit is contained in:
parent
66b8de6f40
commit
dc43e59ff6
7
Makefile
7
Makefile
@ -9,12 +9,15 @@ SRCS := $(shell find $(SRC_DIRS) -name *.cpp -or -name *.c -or -name *.s)
|
||||
OBJS := $(SRCS:%=$(BUILD_DIR)/%.o)
|
||||
DEPS := $(OBJS:.o=.d)
|
||||
|
||||
LIBXML_ROOT ?= /usr/include/libxml2
|
||||
#LIBRARY_PATH=. ./lib/
|
||||
|
||||
INC_DIRS := $(shell find $(SRC_DIRS) -type d)
|
||||
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
|
||||
|
||||
CPPFLAGS ?= $(INC_FLAGS) -MMD -MP -w
|
||||
CPPFLAGS ?= $(INC_FLAGS) -Ilibtmx-parser/src -Ilibtmx-parser/libs/tinyxml2 -MMD -MP -w -I$(LIBXML_ROOT)
|
||||
|
||||
LINKER_FLAGS = -lSDL2 -lSDL2_image -lSDL2_mixer
|
||||
LINKER_FLAGS = -lSDL2 -lSDL2_image -lSDL2_mixer -lxml2 -ltmxparser
|
||||
|
||||
$(BUILD_DIR)/$(TARGET_EXEC): $(OBJS)
|
||||
# $(CC) $(OBJS) -o $@ $(LDFLAGS)
|
||||
|
BIN
assets/maps/br-tiles.png
Normal file
BIN
assets/maps/br-tiles.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
103
assets/maps/br-tiles.tsx
Normal file
103
assets/maps/br-tiles.tsx
Normal file
@ -0,0 +1,103 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<tileset version="1.8" tiledversion="1.8.2" name="br-tiles" tilewidth="16" tileheight="16" tilecount="50" columns="10">
|
||||
<image source="br-tiles.png" width="160" height="80"/>
|
||||
<tile id="8"/>
|
||||
<tile id="1"/>
|
||||
<tile id="0"/>
|
||||
<tile id="2"/>
|
||||
<tile id="3"/>
|
||||
<tile id="4"/>
|
||||
<tile id="5"/>
|
||||
<tile id="6"/>
|
||||
<tile id="7"/>
|
||||
<tile id="10">
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="16" height="16"/>
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="9"/>
|
||||
<tile id="11">
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="16" height="16"/>
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="12">
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="16" height="16"/>
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="13">
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="16" height="16"/>
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="14"/>
|
||||
<tile id="15">
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="16" height="16"/>
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="16"/>
|
||||
<tile id="17"/>
|
||||
<tile id="18"/>
|
||||
<tile id="19">
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="16" height="16"/>
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="20">
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="16" height="16"/>
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="21">
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="16" height="16"/>
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="22"/>
|
||||
<tile id="23"/>
|
||||
<tile id="24"/>
|
||||
<tile id="25"/>
|
||||
<tile id="26"/>
|
||||
<tile id="27"/>
|
||||
<tile id="28">
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="16" height="16"/>
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="29"/>
|
||||
<tile id="30"/>
|
||||
<tile id="31"/>
|
||||
<tile id="32"/>
|
||||
<tile id="33"/>
|
||||
<tile id="34"/>
|
||||
<tile id="35"/>
|
||||
<tile id="36"/>
|
||||
<tile id="37"/>
|
||||
<tile id="38"/>
|
||||
<tile id="39"/>
|
||||
<tile id="40"/>
|
||||
<tile id="41"/>
|
||||
<tile id="42"/>
|
||||
<tile id="43">
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="2" x="0" y="0" width="16" height="16"/>
|
||||
<object id="3" x="0.96875" y="0.875" width="14.4375" height="14.2813"/>
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="44">
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="16" height="16"/>
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="45">
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="16" height="16"/>
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="46"/>
|
||||
<tile id="47"/>
|
||||
<tile id="48"/>
|
||||
<tile id="49"/>
|
||||
</tileset>
|
96
assets/maps/testmap.tmx
Normal file
96
assets/maps/testmap.tmx
Normal file
@ -0,0 +1,96 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.8" tiledversion="1.8.2" orientation="orthogonal" renderorder="right-down" width="42" height="42" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="1">
|
||||
<tileset firstgid="1" source="br-tiles.tsx"/>
|
||||
<layer id="1" name="TileMap" width="42" height="42">
|
||||
<data encoding="csv">
|
||||
11,12,13,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,45,46,44,44,44,45,46,44,45,46,44,45,46,44,45,46,44,45,46,44,45,44,45,44,45,46,45,44,44,44,44,44,44,44,44,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,44,45,46,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,44,45,46,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,11,12,13,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,11,12,13,40,40,40,40,40,14,15,16,40,40,40,40,40,40,14,15,16,
|
||||
14,15,16,17,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,17,18,19,40,40,40,40,40,14,15,16,40,40,40,40,40,40,14,15,16,
|
||||
20,21,22,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,11,12,13
|
||||
</data>
|
||||
</layer>
|
||||
<layer id="3" name="Collision" width="42" height="42">
|
||||
<data encoding="csv">
|
||||
2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,
|
||||
2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,
|
||||
2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,
|
||||
2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,
|
||||
2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,
|
||||
2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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,0,0,0,2,2,2,
|
||||
2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
|
||||
</data>
|
||||
</layer>
|
||||
</map>
|
9
assets/maps/testmapb64.tmx
Normal file
9
assets/maps/testmapb64.tmx
Normal file
File diff suppressed because one or more lines are too long
103
assets/textures/tiles/br-tiles.tsx
Normal file
103
assets/textures/tiles/br-tiles.tsx
Normal file
@ -0,0 +1,103 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<tileset version="1.8" tiledversion="1.8.2" name="br-tiles" tilewidth="16" tileheight="16" tilecount="50" columns="10">
|
||||
<image source="br-tiles.png" width="160" height="80"/>
|
||||
<tile id="8"/>
|
||||
<tile id="1"/>
|
||||
<tile id="0"/>
|
||||
<tile id="2"/>
|
||||
<tile id="3"/>
|
||||
<tile id="4"/>
|
||||
<tile id="5"/>
|
||||
<tile id="6"/>
|
||||
<tile id="7"/>
|
||||
<tile id="10">
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="16" height="16"/>
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="9"/>
|
||||
<tile id="11">
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="16" height="16"/>
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="12">
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="16" height="16"/>
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="13">
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="16" height="16"/>
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="14"/>
|
||||
<tile id="15">
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="16" height="16"/>
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="16"/>
|
||||
<tile id="17"/>
|
||||
<tile id="18"/>
|
||||
<tile id="19">
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="16" height="16"/>
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="20">
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="16" height="16"/>
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="21">
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="16" height="16"/>
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="22"/>
|
||||
<tile id="23"/>
|
||||
<tile id="24"/>
|
||||
<tile id="25"/>
|
||||
<tile id="26"/>
|
||||
<tile id="27"/>
|
||||
<tile id="28">
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="16" height="16"/>
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="29"/>
|
||||
<tile id="30"/>
|
||||
<tile id="31"/>
|
||||
<tile id="32"/>
|
||||
<tile id="33"/>
|
||||
<tile id="34"/>
|
||||
<tile id="35"/>
|
||||
<tile id="36"/>
|
||||
<tile id="37"/>
|
||||
<tile id="38"/>
|
||||
<tile id="39"/>
|
||||
<tile id="40"/>
|
||||
<tile id="41"/>
|
||||
<tile id="42"/>
|
||||
<tile id="43">
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="2" x="0" y="0" width="16" height="16"/>
|
||||
<object id="3" x="0.96875" y="0.875" width="14.4375" height="14.2813"/>
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="44">
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="16" height="16"/>
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="45">
|
||||
<objectgroup draworder="index" id="2">
|
||||
<object id="1" x="0" y="0" width="16" height="16"/>
|
||||
</objectgroup>
|
||||
</tile>
|
||||
<tile id="46"/>
|
||||
<tile id="47"/>
|
||||
<tile id="48"/>
|
||||
<tile id="49"/>
|
||||
</tileset>
|
Binary file not shown.
1
libtmx-parser
Submodule
1
libtmx-parser
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit a2b8ca09efbcaff4c423580a633b2e7787ba7405
|
2
rungame.sh
Executable file
2
rungame.sh
Executable file
@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
LD_LIBRARY_PATH=./libtmx-parser/ ./build/BeagleRescue
|
@ -45,7 +45,6 @@ void Map::LoadMap(std::string path, int sizeX, int sizeY, int scale)
|
||||
srcY = atoi(&c) * tileSize;
|
||||
mapFile.get(c);
|
||||
srcX = atoi(&c) * tileSize;
|
||||
AddTile(srcX, srcY, x*scaledSize, y*scaledSize);
|
||||
mapFile.ignore(2,',');
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"GameName":"Beagle Rescue",
|
||||
"Developers": "Alan Youngblood, Simon Zaleski, Daniel Rinaldi",
|
||||
"LibraryDevelopers": "Sam Lantinga, Dave Gamble, Carl Birch, Job Vranish, David Lafreniere",
|
||||
"LibraryDevelopers": "Sam Lantinga, Dave Gamble, Carl Birch, Job Vranish, David Lafreniere, Bayle Jonathan",
|
||||
"SpecialThanks":"Nic Allen, Brian Lhota, Rodrigo Monteiro"
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "PlayerController.h"
|
||||
#include "ProjectileComponent.h"
|
||||
#include "TileComponent.h"
|
||||
#include "TileMapComponent.h"
|
||||
#include "UITextComponent.h"
|
||||
|
||||
#endif /* SRC_COMPONENTS_H_ */
|
||||
|
79
src/ecs/TileMapComponent.h
Normal file
79
src/ecs/TileMapComponent.h
Normal file
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* TileMapComponent.h
|
||||
*
|
||||
* Created on: Mar 21, 2020
|
||||
* Author: ayoungblood
|
||||
*/
|
||||
|
||||
#ifndef SRC_ECS_TILEMAPCOMPONENT_H_
|
||||
#define SRC_ECS_TILEMAPCOMPONENT_H_
|
||||
|
||||
#include "ECS.h"
|
||||
#include "SDL2/SDL.h"
|
||||
#include "../assetmgr/AssetManager.h"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
|
||||
class TileMapComponent : public Component
|
||||
{
|
||||
public:
|
||||
TransformComponent *transform;
|
||||
SDL_Texture* texture;
|
||||
SDL_Rect srcRect, destRect;
|
||||
Vector2D position;
|
||||
std::tuple <SDL_Rect,SDL_Rect> tile;
|
||||
|
||||
TileMapComponent() = default;
|
||||
|
||||
~TileMapComponent()
|
||||
{
|
||||
SDL_DestroyTexture(texture);
|
||||
}
|
||||
|
||||
TileMapComponent(std::string id, int tsize, int tscale)
|
||||
{
|
||||
setTex(id);
|
||||
// position.x = xpos;
|
||||
// position.y = ypos;
|
||||
//
|
||||
// srcRect.x = srcX;
|
||||
// srcRect.y = srcY;
|
||||
srcRect.w = srcRect.h = tsize;
|
||||
|
||||
// destRect.x = xpos;
|
||||
// destRect.y = ypos;
|
||||
destRect.w = destRect.h = tsize * tscale;
|
||||
}
|
||||
|
||||
void update() override
|
||||
{
|
||||
destRect.x = position.x - Game::camera.x;
|
||||
destRect.y = position.y - Game::camera.y;
|
||||
}
|
||||
|
||||
void draw() override
|
||||
{
|
||||
//iterate through rows and columns of the map to draw the tiles
|
||||
|
||||
TextureManager::Draw(texture, srcRect, destRect, SDL_FLIP_NONE);
|
||||
}
|
||||
|
||||
std::tuple<SDL_Rect,SDL_Rect> getTile(char currentTile, int i)
|
||||
{
|
||||
std::tuple<SDL_Rect,SDL_Rect> tileTuple;
|
||||
|
||||
|
||||
tileTuple = std::make_tuple(srcRect,destRect);
|
||||
return tileTuple;
|
||||
}
|
||||
|
||||
void setTex(std::string id)
|
||||
{
|
||||
texture = Game::assets->GetTexture(id);
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* SRC_ECS_TILEMAPCOMPONENT_H_ */
|
||||
|
@ -35,8 +35,6 @@ private:
|
||||
std::tuple <SDL_Rect, SDL_Rect> letter;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
UITextComponent(std::string id, std::string textToPrint, int letterW, int letterH, int letterScale)
|
||||
{
|
||||
setTex(id);
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "Game.hpp"
|
||||
#include "../assetmgr/TextureManager.h"
|
||||
#include "../assetmgr/Map.h"
|
||||
// #include "../assetmgr/Map.h"
|
||||
#include "../ecs/Components.h"
|
||||
#include "Collision.h"
|
||||
#include <string>
|
||||
@ -21,8 +21,10 @@
|
||||
// #include "../ui/UIText.h"
|
||||
#include "../ui/UINineSlice.h"
|
||||
#include "../cjson/cJSON.h"
|
||||
#include "tmxparser.h"
|
||||
|
||||
Map* map;
|
||||
|
||||
// Map* map;
|
||||
Manager manager;
|
||||
UINineSlice* my9Slice;
|
||||
UINineSlice* scoreboard9Slice;
|
||||
@ -117,7 +119,17 @@ void Game::init(const char *title, int width, int height, bool fullscreen, int g
|
||||
SDL_LogError(SDL_LOG_CATEGORY_ERROR, "Couldn't initialize SDL audio mixer!, Error: %s", SDL_GetError());
|
||||
}
|
||||
|
||||
|
||||
// Trying out the halsafar/libtmx-parser
|
||||
tmxparser::TmxReturn error;
|
||||
tmxparser::TmxMap map;
|
||||
error = tmxparser::parseFromFile("assets/maps/testmap.tmx", &map, "assets/textures/tiles/");
|
||||
// current_time = SDL_GetTicks();
|
||||
if (!error)
|
||||
{
|
||||
printf("Yay! Tile map loaded with no errors.\n");
|
||||
std::cout << "Map width: " << map.width << " tiles wide by: " << map.height << " tiles high" << std::endl;
|
||||
}
|
||||
|
||||
assets->AddTexture("terrain", "assets/textures/tiles/br-tiles.png");
|
||||
assets->AddTexture("player", "assets/textures/actors/firefighter.png");
|
||||
@ -133,7 +145,7 @@ void Game::init(const char *title, int width, int height, bool fullscreen, int g
|
||||
assets->AddSoundClip("bark1","assets/audio/sfx/Bark1.wav");
|
||||
assets->AddSoundClip("bark2","assets/audio/sfx/Bark2.wav");
|
||||
|
||||
map = new Map("terrain",globalScale,16);
|
||||
// map = new Map("terrain",globalScale,16);
|
||||
|
||||
// std::string myText = "Find lost puppies!\nThey need your help!";
|
||||
std::string myText = "Press U to Start";
|
||||
@ -171,7 +183,7 @@ void Game::init(const char *title, int width, int height, bool fullscreen, int g
|
||||
|
||||
//ecs implementation
|
||||
|
||||
map->LoadMap("assets/maps/br-map-color.txt",70,45, globalScale);
|
||||
// map->LoadMap("assets/maps/br-map-color.txt",70,45, globalScale);
|
||||
|
||||
player.addComponent<TransformComponent>(860*globalScale,640*globalScale,22,42,globalScale);
|
||||
player.addComponent<SpriteComponent>("player", SpriteComponent::spriteAnimation, "assets/textures/actors/firefighter.json");
|
||||
@ -298,10 +310,10 @@ void Game::update()
|
||||
camera.x = 0;
|
||||
if (camera.y < 0)
|
||||
camera.y = 0;
|
||||
if (camera.x > map->width-camera.w)
|
||||
camera.x = map->width-camera.w;
|
||||
if (camera.y > map->height-camera.h)
|
||||
camera.y = map->height-camera.h;
|
||||
// if (camera.x > map->width-camera.w)
|
||||
// camera.x = map->width-camera.w;
|
||||
// if (camera.y > map->height-camera.h)
|
||||
// camera.y = map->height-camera.h;
|
||||
if (Game::debugCollisionBoxes)
|
||||
{
|
||||
for (auto& c: colliders)
|
||||
|
Loading…
Reference in New Issue
Block a user