export_assets make target
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
|
.local
|
||||||
impostor.lua
|
impostor.lua
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ steps:
|
|||||||
<<: *environment
|
<<: *environment
|
||||||
XDG_RUNTIME_DIR: /tmp
|
XDG_RUNTIME_DIR: /tmp
|
||||||
commands:
|
commands:
|
||||||
- make build PROJECT=$GAME_NAME
|
- make build
|
||||||
- make export PROJECT=$GAME_NAME
|
- make export
|
||||||
|
|
||||||
- name: artifact
|
- name: artifact
|
||||||
image: alpine
|
image: alpine
|
||||||
|
|||||||
32
Makefile
32
Makefile
@@ -1,10 +1,5 @@
|
|||||||
# -----------------------------------------
|
# -----------------------------------------
|
||||||
# Makefile – TIC-80 project builder
|
# Makefile – TIC-80 project builder
|
||||||
# Usage:
|
|
||||||
# make build
|
|
||||||
# make import_assets
|
|
||||||
# make watch
|
|
||||||
# make export
|
|
||||||
# -----------------------------------------
|
# -----------------------------------------
|
||||||
|
|
||||||
PROJECT = impostor
|
PROJECT = impostor
|
||||||
@@ -17,28 +12,29 @@ OUTPUT_TIC = $(PROJECT).tic
|
|||||||
SRC_DIR = inc
|
SRC_DIR = inc
|
||||||
SRC = $(shell sed 's|^|$(SRC_DIR)/|' $(ORDER))
|
SRC = $(shell sed 's|^|$(SRC_DIR)/|' $(ORDER))
|
||||||
|
|
||||||
ASSETS_DIR = assets
|
ASSETS_LUA = inc/meta/meta.assets.lua
|
||||||
ASSET_TYPES = tiles sprites sfx music
|
|
||||||
|
|
||||||
all: build
|
all: build
|
||||||
|
|
||||||
build: import_assets $(OUTPUT)
|
build: $(OUTPUT)
|
||||||
|
|
||||||
$(OUTPUT): $(SRC) $(ORDER)
|
$(OUTPUT): $(SRC) $(ORDER)
|
||||||
@rm -f $(OUTPUT)
|
@rm -f $(OUTPUT)
|
||||||
@while read f; do \
|
@while read f; do \
|
||||||
cat "$(SRC_DIR)/$$f" >> $(OUTPUT); \
|
cat "$(SRC_DIR)/$$f" >> $(OUTPUT); \
|
||||||
echo "\n" >> $(OUTPUT); \
|
echo "" >> $(OUTPUT); \
|
||||||
done < $(ORDER)
|
done < $(ORDER)
|
||||||
|
|
||||||
import_assets:
|
export_assets: build
|
||||||
@for t in $(ASSET_TYPES); do \
|
@echo "==> Exporting TIC-80 asset sections"
|
||||||
for f in $(ASSETS_DIR)/$$t/*.png; do \
|
@mkdir -p inc/meta
|
||||||
[ -e "$$f" ] || continue; \
|
@sed -n '/^-- <PALETTE>/,/^-- <\/PALETTE>/p;\
|
||||||
echo "==> Importing $$f as $$t..."; \
|
/^-- <TILES>/,/^-- <\/TILES>/p;\
|
||||||
tic80 --cli --skip --fs=. --cmd="import $$t $$f & exit"; \
|
/^-- <SPRITES>/,/^-- <\/SPRITES>/p;\
|
||||||
done; \
|
/^-- <MAP>/,/^-- <\/MAP>/p;\
|
||||||
done
|
/^-- <SFX>/,/^-- <\/SFX>/p;\
|
||||||
|
/^-- <MUSIC>/,/^-- <\/MUSIC>/p' \
|
||||||
|
$(OUTPUT) > $(ASSETS_LUA)
|
||||||
|
|
||||||
export: build
|
export: build
|
||||||
tic80 --cli --skip --fs=. \
|
tic80 --cli --skip --fs=. \
|
||||||
@@ -46,4 +42,4 @@ export: build
|
|||||||
|
|
||||||
watch:
|
watch:
|
||||||
make build
|
make build
|
||||||
fswatch -o $(SRC_DIR) $(ORDER) $(ASSETS_DIR) | while read; do make build; done
|
fswatch -o $(SRC_DIR) $(ORDER) assets | while read; do make build; done
|
||||||
|
|||||||
Reference in New Issue
Block a user