geometra/gen_sprites.sh

33 lines
564 B
Bash
Executable File

#!/usr/bin/env bash
if [[ $# < 1 ]]; then
echo 'expected source assets directory'
exit 1
fi
src_dir=$1
out_dir=assets/sprite/
dpi=192
svg_to_png="inkscape -C"
gen_sprite_map="dune exec --no-print-directory --display=quiet src/bin/gen_sprite_map.exe"
mkdir -p $out_dir
function gen() {
name=$1
dpi=${2:-92}
echo "$name..."
src=$src_dir/$name.svg
dst_png=$out_dir/$name.png
dst_map=$out_dir/$name.map
$svg_to_png $src -o $dst_png -d $dpi || exit 1
$gen_sprite_map < $src > $dst_map || exit 1
}
gen blocks 192
gen hud