Compare commits
2 Commits
testbranch
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 3dc28849c4 | |||
| 8a6214e893 |
44
Makefile
44
Makefile
@@ -13,6 +13,8 @@ SRC_DIR = inc
|
|||||||
SRC = $(shell sed 's|^|$(SRC_DIR)/|' $(ORDER))
|
SRC = $(shell sed 's|^|$(SRC_DIR)/|' $(ORDER))
|
||||||
|
|
||||||
ASSETS_LUA = inc/meta/meta.assets.lua
|
ASSETS_LUA = inc/meta/meta.assets.lua
|
||||||
|
ASSETS_DIR = assets
|
||||||
|
ASSET_TYPES = tiles sprites sfx music
|
||||||
|
|
||||||
# CI/CD variables
|
# CI/CD variables
|
||||||
VERSION_FILE = .version
|
VERSION_FILE = .version
|
||||||
@@ -56,25 +58,36 @@ watch:
|
|||||||
make build
|
make build
|
||||||
fswatch -o $(SRC_DIR) $(ORDER) assets | while read; do make build; done
|
fswatch -o $(SRC_DIR) $(ORDER) assets | while read; do make build; done
|
||||||
|
|
||||||
import_assets:
|
import_assets: $(OUTPUT)
|
||||||
@for t in $(ASSET_TYPES); do \
|
@TIC_CMD="load $(OUTPUT) &"; \
|
||||||
|
for t in $(ASSET_TYPES); do \
|
||||||
for f in $(ASSETS_DIR)/$$t/*.png; do \
|
for f in $(ASSETS_DIR)/$$t/*.png; do \
|
||||||
[ -e "$$f" ] || continue; \
|
[ -e "$$f" ] || continue; \
|
||||||
echo "==> Importing $$f as $$t..."; \
|
echo "==> Importing $$f as $$t..."; \
|
||||||
tic80 --cli --skip --fs=. --cmd="import $$t $$f & exit"; \
|
TIC_CMD="$${TIC_CMD} & import $$t $$f"; \
|
||||||
done; \
|
done; \
|
||||||
done
|
done; \
|
||||||
|
TIC_CMD="$$TIC_CMD save & exit"; \
|
||||||
|
echo $$TIC_CMD; \
|
||||||
|
tic80 --cli --skip --fs=. --cmd="$$TIC_CMD"
|
||||||
|
|
||||||
export_assets: build
|
# export helper function
|
||||||
|
define f_export_asset_awk
|
||||||
|
cat $(2) | awk '/-- <$(1)>/,/<\/$(1)>/' >> $(3)
|
||||||
|
endef
|
||||||
|
|
||||||
|
export_assets:
|
||||||
|
# $(OUTPUT) would be a circular dependency
|
||||||
|
@test -e $(OUTPUT)
|
||||||
@echo "==> Exporting TIC-80 asset sections"
|
@echo "==> Exporting TIC-80 asset sections"
|
||||||
@mkdir -p inc/meta
|
@mkdir -p inc/meta
|
||||||
@sed -n '/^-- <PALETTE>/,/^-- <\/PALETTE>/p;\
|
@echo -n '' > $(ASSETS_LUA)
|
||||||
/^-- <TILES>/,/^-- <\/TILES>/p;\
|
@$(call f_export_asset_awk,PALETTE,$(OUTPUT),$(ASSETS_LUA))
|
||||||
/^-- <SPRITES>/,/^-- <\/SPRITES>/p;\
|
@$(call f_export_asset_awk,TILES,$(OUTPUT),$(ASSETS_LUA))
|
||||||
/^-- <MAP>/,/^-- <\/MAP>/p;\
|
@$(call f_export_asset_awk,SPRITES,$(OUTPUT),$(ASSETS_LUA))
|
||||||
/^-- <SFX>/,/^-- <\/SFX>/p;\
|
@$(call f_export_asset_awk,MAP,$(OUTPUT),$(ASSETS_LUA))
|
||||||
/^-- <MUSIC>/,/^-- <\/MUSIC>/p' \
|
@$(call f_export_asset_awk,SFX,$(OUTPUT),$(ASSETS_LUA))
|
||||||
$(OUTPUT) > $(ASSETS_LUA)
|
@$(call f_export_asset_awk,WAVES,$(OUTPUT),$(ASSETS_LUA))
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@rm -f $(PROJECT)-*.tic $(PROJECT)-*.html.zip $(OUTPUT)
|
@rm -f $(PROJECT)-*.tic $(PROJECT)-*.html.zip $(OUTPUT)
|
||||||
@@ -113,3 +126,10 @@ ci-update:
|
|||||||
|
|
||||||
.PHONY: all build export watch import_assets export_assets clean ci-version ci-export ci-upload ci-update
|
.PHONY: all build export watch import_assets export_assets clean ci-version ci-export ci-upload ci-update
|
||||||
|
|
||||||
|
#-- <WAVES>
|
||||||
|
#-- 000:224578acdeeeeddcba95434567653100
|
||||||
|
#-- </WAVES>
|
||||||
|
#
|
||||||
|
#-- <SFX>
|
||||||
|
#-- 000:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000000000
|
||||||
|
#-- </SFX>
|
||||||
|
|||||||
Reference in New Issue
Block a user