36 lines
648 B
Bash
Executable File
36 lines
648 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/sprites/
|
|
dpi=192
|
|
|
|
svg_to_png="inkscape -C"
|
|
gen_sprite_map="dune exec --no-print-directory --display=quiet scripts/gen_sprite_map.exe"
|
|
|
|
mkdir -p $out_dir
|
|
|
|
function gen() {
|
|
name=$1
|
|
dpi=${2:-96}
|
|
|
|
echo "$name..."
|
|
|
|
src=$src_dir/$name.svg
|
|
dst_png=$out_dir/$name.png
|
|
dst_map=$out_dir/$name.map
|
|
|
|
[[ "$src" -nt "$dst_png" ]] &&
|
|
($svg_to_png $src -o $dst_png -d $dpi || exit 1)
|
|
|
|
[[ "$src" -nt "$dst_map" ]] &&
|
|
($gen_sprite_map < $src > $dst_map || exit 1)
|
|
}
|
|
|
|
gen blocks 192
|
|
gen hud
|