Compare commits
No commits in common. "314cca64340c97e64ca408a97720c71ada76dac9" and "67850aff2874c2a77bb5b38f9ca3c1d41efd49d3" have entirely different histories.
314cca6434
...
67850aff28
5
Makefile
|
|
@ -7,7 +7,7 @@ BUILD_DIR = build
|
||||||
SOURCE_OUTPUT := 2D_Engine
|
SOURCE_OUTPUT := 2D_Engine
|
||||||
|
|
||||||
# Assets output
|
# Assets output
|
||||||
ASSET_OUTPUT := game.data
|
ASSETS_OUTPUT := game.data
|
||||||
|
|
||||||
# Verbosity
|
# Verbosity
|
||||||
Q := @
|
Q := @
|
||||||
|
|
@ -21,7 +21,8 @@ YELLOW := \033[33m
|
||||||
RESET := \033[m
|
RESET := \033[m
|
||||||
|
|
||||||
# Default targets
|
# Default targets
|
||||||
all: build_core build_src compress_assets
|
#all: build_core build_src compress_assets
|
||||||
|
all: build_core build_src
|
||||||
|
|
||||||
# Sub Makefiles
|
# Sub Makefiles
|
||||||
SOURCE_DIR = src
|
SOURCE_DIR = src
|
||||||
|
|
|
||||||
|
|
@ -1,44 +1,26 @@
|
||||||
# Assets files
|
# Assets files
|
||||||
ASSETS := \
|
ASSETS := \
|
||||||
assets/tileset/tileset.png \
|
assets/tileset/tileset.png \
|
||||||
assets/player_sheets/player_idle_sheet.png \
|
assets/player-sheets/player_idle_sheet.png \
|
||||||
assets/player_sheets/player_run_sheet.png \
|
assets/player-sheets/player_walk_sheet.png \
|
||||||
assets/player_sheets/player_death_sheet.png \
|
assets/player-sheets/player_run_sheet.png \
|
||||||
assets/enemy_sheets/enemy_idle_sheet.png \
|
assets/props-sheets/barred_door_sheet.png \
|
||||||
assets/enemy_sheets/enemy_run_sheet.png \
|
assets/props-sheets/lever_sheet.png \
|
||||||
assets/enemy_sheets/enemy_death_sheet.png \
|
assets/props-sheets/small_chest_sheet.png \
|
||||||
|
assets/props-sheets/big_chest_sheet.png \
|
||||||
assets/maps/map_test.json
|
assets/maps/map_test.json
|
||||||
|
|
||||||
# Deduce assets lz4
|
# Deduce assets lz4
|
||||||
ASSETS_COMPRESSED = $(ASSETS:%=$(BUILD_DIR)/%.lz4)
|
ASSETS_COMPRESSED = $(ASSETS:%=$(BUILD_DIR)/%.lz4)
|
||||||
|
|
||||||
# Current file nb to process
|
|
||||||
CURRENT_ASSET_FILE := 0
|
|
||||||
|
|
||||||
# Build asset target
|
|
||||||
compress_assets: asset_setup count_assets_compress $(BUILD_DIR)/$(ASSET_OUTPUT) assets_end
|
|
||||||
|
|
||||||
# Asset compressing message
|
|
||||||
asset_setup:
|
|
||||||
@echo "Compressing Assets (3/3)"
|
|
||||||
$(Q)mkdir -p $(dir $(ASSETS_COMPRESSED))
|
|
||||||
|
|
||||||
# Count nb of assets to compress
|
|
||||||
count_assets_compress:
|
|
||||||
$(eval export TOTAL_ASSETS_FILES := $(shell echo $$(($$(make -n $(ASSETS_COMPRESSED) 2>/dev/null | grep -c "Compressing") + 1))))
|
|
||||||
|
|
||||||
# Compress assets into tar file
|
# Compress assets into tar file
|
||||||
$(BUILD_DIR)/$(ASSET_OUTPUT): $(ASSETS_COMPRESSED)
|
$(BUILD_DIR)/$(ASSETS_OUTPUT): $(ASSETS_COMPRESSED)
|
||||||
@echo -e "[100%] $(YELLOW)Compressing $(ASSET_OUTPUT)$(RESET)"
|
@echo "[100%] $(YELLOW)Compressing $(ASSETS_OUTPUT)$(RESET)"
|
||||||
$(Q)tar -cf $@ $(ASSETS_COMPRESSED)
|
$(Q)tar -cvf $@ $()
|
||||||
|
|
||||||
# Compress individual assets
|
# Compress individual assets
|
||||||
$(BUILD_DIR)/%.lz4: %
|
$(BUILD_DIR)/%.lz4: %
|
||||||
$(eval CURRENT_ASSET_FILE := $(shell echo $$(($(CURRENT_ASSET_FILE) + 1))))
|
$(eval CURRENT_FILE := $(shell echo $$(($(CURRENT_FILE) + 1))))
|
||||||
$(eval PERCENTAGE := $(shell echo $$(($(CURRENT_ASSET_FILE) * 100 / $(TOTAL_ASSETS_FILES)))))
|
$(eval PERCENTAGE := $(shell echo $$(($(CURRENT_FILE) * 100 / $(TOTAL_FILES)))))
|
||||||
@echo -e "[$(PERCENTAGE)%] $(GREEN)Compressing asset $@$(RESET)"
|
@echo "[$(PERCENTAGE)%] $(GREEN)Compressing asset $@$(RESET)"
|
||||||
$(Q)lz4 --favor-decSpeed -fqtz $< $@
|
$(Q)lz4 $< $@
|
||||||
|
|
||||||
# Print ending message
|
|
||||||
assets_end: $(BUILD_DIR)/$(SOURCE_OUTPUT)
|
|
||||||
@echo "Compressed target $(ASSET_OUTPUT)"
|
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 68 KiB |
|
|
@ -23,12 +23,12 @@ CURRENT_SRC_FILE := 0
|
||||||
# Build src target
|
# Build src target
|
||||||
build_src: src_setup count_src_build $(BUILD_DIR)/$(SOURCE_OUTPUT) src_end
|
build_src: src_setup count_src_build $(BUILD_DIR)/$(SOURCE_OUTPUT) src_end
|
||||||
|
|
||||||
# Source build directories
|
# Source build directories and
|
||||||
src_setup:
|
src_setup:
|
||||||
@echo "Building Source (2/3)"
|
@echo "Building Source (2/3)"
|
||||||
$(Q)mkdir -p $(dir $(SOURCE_OBJECTS))
|
$(Q)mkdir -p $(dir $(SOURCE_OBJECTS))
|
||||||
|
|
||||||
# Count nb of files to build
|
# Count
|
||||||
count_src_build:
|
count_src_build:
|
||||||
$(eval export TOTAL_SRC_FILES := $(shell echo $$(($$(make -n $(SOURCE_OBJECTS) 2>/dev/null | grep -c "Building") + 1))))
|
$(eval export TOTAL_SRC_FILES := $(shell echo $$(($$(make -n $(SOURCE_OBJECTS) 2>/dev/null | grep -c "Building") + 1))))
|
||||||
|
|
||||||
|
|
|
||||||