Files
mahjong/темыФишек/заглушка/2019-09-08/ген

61 lines
1.3 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 1. Создать тему фишек на основе нейтральной и выбранной текстур.
function gen
{
base=$1
text=$2
name=$3
convert $base -pointsize 30 -draw "text 30,85 '$text'" $name
}
function genTheme
{
prefix=$1
base=$2
# Обычные фишки.
for i in {1..34}
do
gen $base $i ${prefix}/$i.png
done
# Особенные фишки.
gen $base "А" ${prefix}/35.png
gen $base "Б" ${prefix}/36.png
gen $base "В" ${prefix}/37.png
gen $base "Г" ${prefix}/38.png
gen $base ":)" ${prefix}/39.png
gen $base ":(" ${prefix}/40.png
gen $base ":|" ${prefix}/41.png
gen $base ":O" ${prefix}/42.png
}
genTheme 0 основа.нейтраль.png
genTheme 1 основа.выбор.png
# 2. Создать файл JavaScript с текстурами в формате Base64.
function genBase
{
target=$1
echo -e "const R = [\n" > $target
for prefix in "0" "1"
do
for i in {1..42}
do
echo -n "['$prefix/$i', '" >> $target
fileName="$prefix/$i.png"
base64 -w 0 $fileName >> $target
echo -e "'],\n" >> $target
done
done
echo "];" >> $target
}
genBase "../2019-09-08.js"