aboutsummaryrefslogtreecommitdiff
path: root/tools/embedded.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/embedded.sh')
-rwxr-xr-xtools/embedded.sh19
1 files changed, 12 insertions, 7 deletions
diff --git a/tools/embedded.sh b/tools/embedded.sh
index ca70127..2f2ca8d 100755
--- a/tools/embedded.sh
+++ b/tools/embedded.sh
@@ -5,12 +5,6 @@
ressources=$(cat <<-EndOfResources
assets/boards/chesscom_8bits.png
assets/pieces/cburnett.png
-assets/icons/hide.png
-assets/icons/mat.png
-assets/icons/ochess.png
-assets/icons/swap.png
-assets/icons/zoomin.png
-assets/icons/zoomout.png
EndOfResources
)
###############################
@@ -18,6 +12,7 @@ EndOfResources
set -e
wai=$(dirname $(readlink -f "$0")) # Current script directory
dst="${wai}/../src/binres/binary_data.hpp"
+ui_icons_width=24
# Binary to C headers
# $1 is the resource file and $2 the variable name to use in the C code
@@ -25,9 +20,19 @@ bin2c () {
xxd -n "$2" -i "$1"
}
+# Generate ui icons png from svg
+rm -f "${wai}"/assets/icons/ui/*.png # Clear previous data
+for svg in $(find ${wai}/assets/icons/ui -name "*.svg")
+do
+ ext="${svg##*.}"
+ name="$(basename $svg .${ext})"
+ echo "Generating png for ${name}.${ext}..."
+ inkscape --export-type png --export-filename "${wai}/assets/icons/ui/ui-${name}.png" -w "${ui_icons_width}" "${svg}"
+done
+
# Generate headers
echo -n > "$dst"
-for res in $ressources
+for res in $ressources $(find ${wai}/assets/icons/ -name "*.png")
do
ext="${res##*.}"
name="$(basename $res .${ext})"