gdritter repos office-tiles / master
Added Makefile to generate spritesheet Getty Ritter 9 years ago
2 changed file(s) with 30 addition(s) and 2 deletion(s). Collapse all Expand all
1 SVGS ::= $(wildcard raws/*.svg)
2 PNGS ::= $(SVGS:.svg=.png)
3
4 all: $(PNGS) sheet/spritesheet.png sheet/spritesheet.xml
5
6 %.png: %.svg
7 inkscape -e $@ $<
8
9 sheet/spritesheet.png: $(PNGS)
10 mkdir -p sheet
11 montage $(sort $(PNGS)) -background None -geometry +0+0 -tile 8x8 $@
12
13 sheet/spritesheet.xml: $(PNGS)
14 mkdir -p sheet
15 echo "<TextureAtlas>" >$@
16 for Y in `seq 0 8`; do \
17 for X in `seq 0 8`; do \
18 NX=`echo $$X '*' 40 | bc`; \
19 NY=`echo $$Y '*' 40 | bc`; \
20 C=`echo $$X + $$Y '*' 8 | bc`; \
21 FN=`printf '%03d-' $$C`; \
22 FL=raws/$$FN*.png; \
23 test '!' -e $$FL || \
24 echo " <SubTexture name=\"$${FN}sprite\" x=\"$$NX\" y=\"$$NY\" width=\"40\" height=\"40\" />" >>$@; \
25 done;\
26 done
27 echo "</TextureAtlas>" >>$@
28
29 clean:
30 rm -f sheet/spritesheet.xml sheet/spritesheet.png raws/*.png
+0
-2
sheet/spritesheet.xml less more
1 <data>
2 </data>