guieditor/icons/sprite.sh
changeset 5 28ef73d2e7e8
equal deleted inserted replaced
4:f8d8b3ef32e0 5:28ef73d2e7e8
       
     1 #!/bin/bash
       
     2 # separator is special (only 8px wide) so ensure it goes last
       
     3 images=(`ls *.png | grep -v sprite | grep -v separator` separator.png)
       
     4 
       
     5 echo "Creating sprite.png. Update spritelist in ../editor.js with:"
       
     6 echo -ne "\t["
       
     7 for img in ${images[@]}; do
       
     8 	echo -n "'${img%.png}'"
       
     9 	if [ $img != "separator.png" ]; then
       
    10 		echo -n ", "
       
    11 	fi
       
    12 done
       
    13 echo "]"
       
    14 
       
    15 montage=`which montage`
       
    16 if [ -z "$montage" ]; then
       
    17 	echo "Could not find montage, please install imagemagick"
       
    18 	exit 1
       
    19 fi
       
    20 
       
    21 montage -background transparent -tile ${#images[@]}x1 -geometry +0+0 ${images[@]} sprite.png
       
    22