X-Git-Url: https://git.ctpug.org.za/?a=blobdiff_plain;f=koperkapel%2Fimages%2FMakefile;h=3cac6205d7c305ec2e8bed5d2d541678c38794c2;hb=99defb307e6cf4465b218846e7866ff9ebc31f68;hp=1d584a143273f2403b040e22c5bc7eb3aca0b225;hpb=6d0c5defad74ee46b1291e8284f098cfaaa5069c;p=koperkapel.git diff --git a/koperkapel/images/Makefile b/koperkapel/images/Makefile index 1d584a1..3cac620 100644 --- a/koperkapel/images/Makefile +++ b/koperkapel/images/Makefile @@ -1,53 +1,111 @@ -VPATH=../../sources/vector +VPATH=../../sources -SVGS=$(shell find $(VPATH) -name "*.svg") -PNGS=$(patsubst $(VPATH)/%.svg, %.png, $(SVGS)) -ROACH=$(filter roach, $(PNGS)) +# Vector tiles -ROACH_32=$(subst roach, roach_32, $(ROACH)) -ROACH_21=$(subst roach, roach_21, $(ROACH)) +TILE_DIRS=roach serum vehicle_tiles +TILE_SVGS=$(shell find $(patsubst %, $(VPATH)/vector/%, $(TILE_DIRS)) -name "*.svg") +TILE_PNGS=$(patsubst $(VPATH)/vector/%.svg, %.png, $(TILE_SVGS)) -all: $(PNGS) $(ROACH_32) $(ROACH_21) roach_quartet roach_nonet +# Bitmap tiles -# Default rule +BTILE_DIRS=wall floor tunnel underground +BTILE_SRC=$(shell find $(patsubst %, $(VPATH)/bitmap/%, $(BTILE_DIRS)) -name "*.png") +BTILE_PNGS=$(patsubst $(VPATH)/bitmap/%, bunker/%, $(BTILE_SRC)) -%.png: %.svg - @mkdir -p `dirname $@` - @inkscape -z -e $@ -w 64 -h 64 $< +# Vector images to rasterize without resizing + +SIMPLE_DIRS=roach_management vehicles +SIMPLE_SVGS=$(shell find $(patsubst %, $(VPATH)/vector/%, $(SIMPLE_DIRS)) -name "*.svg") +SIMPLE_PNGS=$(patsubst $(VPATH)/vector/%.svg, %.png, $(SIMPLE_SVGS)) + +# Aggregate cockroach sprites + +ROACH=$(filter roach/%, $(TILE_PNGS)) +ROACH_32=$(patsubst roach/%, roach_32/%, $(ROACH)) +ROACH_21=$(patsubst roach/%, roach_21/%, $(ROACH)) +ROACH_QUARTET=$(patsubst roach/%, roach_quartet/%, $(ROACH)) +ROACH_NONET=$(patsubst roach/%, roach_nonet/%, $(ROACH)) +ROACH_BIG=$(patsubst roach/%, roach_big/%, $(ROACH)) + +# Aggregate serum sprites + +SERUM=$(filter serum/%, $(TILE_PNGS)) +SERUM_BIG=$(patsubst serum/%, serum_big/%, $(SERUM)) + +# Default target with everything + +all: $(TILE_PNGS) $(BTILE_PNGS) $(SIMPLE_PNGS)\ + $(ROACH_32) $(ROACH_21) $(ROACH_QUARTET) $(ROACH_NONET) $(ROACH_BIG)\ + $(SERUM_BIG) + +# Vector tile rule + +define tile +$(1)/%.png: vector/$(1)/%.svg + @mkdir -p `dirname $$@` + @inkscape -z -e $$@ -w 64 -h 64 $$< +endef + +$(foreach tiledir,$(TILE_DIRS),$(eval $(call tile,$(tiledir)))) + +# No resize rule + +define simple +$(1)/%.png: vector/$(1)/%.svg + @mkdir -p `dirname $$@` + @inkscape -z -e $$@ $$< +endef + +$(foreach simpledir,$(SIMPLE_DIRS),$(eval $(call simple,$(simpledir)))) + +# Bitmap tile rule + +define btile +bunker/$(1)/%.png: bitmap/$(1)/%.png + @mkdir -p `dirname $$@` + @convert $$< -resize 64x64 $$@ +endef + +$(foreach tiledir,$(BTILE_DIRS),$(eval $(call btile,$(tiledir)))) # Smaller roaches -roach_32/%.png: roach/%.svg +roach_32/%.png: vector/roach/%.svg @mkdir -p `dirname $@` @inkscape -z -e $@ -w 32 -h 32 $< -roach_21/%.png: roach/%.svg +roach_21/%.png: vector/roach/%.svg @mkdir -p `dirname $@` @inkscape -z -e $@ -w 21 -h 21 $< +# Big roaches + +roach_big/%.png: vector/roach/%.svg + @mkdir -p `dirname $@` + @inkscape -z -e $@ -w 192 -h 192 $< + +# Big serums + +serum_big/%.png: vector/serum/%.svg + @mkdir -p `dirname $@` + @inkscape -z -e $@ -w 192 -h 192 $< + # Roach quartet -roach_quartet: $(ROACH_32) +roach_quartet/roach_%.png: $(foreach i, 1 2 3 4, roach_32/roach_$(i).png) @mkdir -p roach_quartet - @montage $(foreach i, 1 2 3 4, roach_32/roach_$(i).png) -geometry +0+0 -background none roach_quartet/roach_1.png - @montage $(foreach i, 2 3 4 1, roach_32/roach_$(i).png) -geometry +0+0 -background none roach_quartet/roach_2.png - @montage $(foreach i, 3 4 1 2, roach_32/roach_$(i).png) -geometry +0+0 -background none roach_quartet/roach_3.png - @montage $(foreach i, 4 1 2 3, roach_32/roach_$(i).png) -geometry +0+0 -background none roach_quartet/roach_4.png - @montage $(foreach i, 1 2 3 4, roach_32/eyes_$(i).png) -geometry +0+0 -background none roach_quartet/eyes_1.png - @montage $(foreach i, 2 3 4 1, roach_32/eyes_$(i).png) -geometry +0+0 -background none roach_quartet/eyes_2.png - @montage $(foreach i, 3 4 1 2, roach_32/eyes_$(i).png) -geometry +0+0 -background none roach_quartet/eyes_3.png - @montage $(foreach i, 4 1 2 3, roach_32/eyes_$(i).png) -geometry +0+0 -background none roach_quartet/eyes_4.png + @montage $(foreach i, -1 0 1 2 , roach_32/roach_$$(( ( $(i) + $(patsubst roach_quartet/roach_%.png,%, $@) ) % 4 + 1 )).png) -geometry +0+0 -background none $@ + +roach_quartet/eyes_%.png: $(foreach i, 1 2 3 4, roach_32/eyes_$(i).png) + @mkdir -p roach_quartet + @montage $(foreach i, -1 0 1 2 , roach_32/eyes_$$(( ( $(i) + $(patsubst roach_quartet/eyes_%.png,%, $@) ) % 4 + 1 )).png) -geometry +0+0 -background none $@ # Roach nonet -roach_nonet: $(ROACH_21) +roach_nonet/roach_%.png: $(foreach i, 1 2 3 4, roach_21/roach_$(i).png) @mkdir -p roach_nonet - @montage $(foreach i, 1 2 3 4 1 2 3 4 1, roach_21/roach_$(i).png) -geometry +0+0 -background none - | convert - -background none -gravity southeast -splice 1x1 roach_nonet/roach_1.png - @montage $(foreach i, 2 3 4 1 2 3 4 1 2, roach_21/roach_$(i).png) -geometry +0+0 -background none - | convert - -background none -gravity southeast -splice 1x1 roach_nonet/roach_2.png - @montage $(foreach i, 3 4 1 2 3 4 1 2 3, roach_21/roach_$(i).png) -geometry +0+0 -background none - | convert - -background none -gravity southeast -splice 1x1 roach_nonet/roach_3.png - @montage $(foreach i, 4 1 2 3 4 1 2 3 4, roach_21/roach_$(i).png) -geometry +0+0 -background none - | convert - -background none -gravity southeast -splice 1x1 roach_nonet/roach_4.png - @montage $(foreach i, 1 2 3 4 1 2 3 4 1, roach_21/eyes_$(i).png) -geometry +0+0 -background none - | convert - -background none -gravity southeast -splice 1x1 roach_nonet/eyes_1.png - @montage $(foreach i, 2 3 4 1 2 3 4 1 2, roach_21/eyes_$(i).png) -geometry +0+0 -background none - | convert - -background none -gravity southeast -splice 1x1 roach_nonet/eyes_2.png - @montage $(foreach i, 3 4 1 2 3 4 1 2 3, roach_21/eyes_$(i).png) -geometry +0+0 -background none - | convert - -background none -gravity southeast -splice 1x1 roach_nonet/eyes_3.png - @montage $(foreach i, 4 1 2 3 4 1 2 3 4, roach_21/eyes_$(i).png) -geometry +0+0 -background none - | convert - -background none -gravity southeast -splice 1x1 roach_nonet/eyes_4.png + @montage $(foreach i, -1 0 1 2 3 4 5 6 7 , roach_21/roach_$$(( ( $(i) + $(patsubst roach_nonet/roach_%.png,%, $@) ) % 4 + 1 )).png) -geometry +0+0 -background none - | convert - -background none -gravity southeast -splice 1x1 $@ +roach_nonet/eyes_%.png: $(foreach i, 1 2 3 4, roach_21/eyes_$(i).png) + @mkdir -p roach_nonet + @montage $(foreach i, -1 0 1 2 3 4 5 6 7 , roach_21/eyes_$$(( ( $(i) + $(patsubst roach_nonet/eyes_%.png,%, $@) ) % 4 + 1 )).png) -geometry +0+0 -background none - | convert - -background none -gravity southeast -splice 1x1 $@