diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2eaa5806..618e6905 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -78,9 +78,6 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Install Python - uses: actions/setup-python@v2 - - name: Install rust uses: actions-rs/toolchain@v1 with: @@ -104,6 +101,7 @@ jobs: elif [ "$RUNNER_OS" == "Windows" ]; then curl -sL https://github.com/RazrFalcon/resvg/releases/download/v0.11.0/viewsvg-win.zip -O 7z x viewsvg-win.zip + mv resvg ~/.cargo/bin else echo "$RUNNER_OS not supported" exit 1 @@ -112,7 +110,7 @@ jobs: - name: Export assets shell: bash run: | - python ./utils/assets_export.py + ./utils/assets_export.sh ls -lR assets - name: Build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 026e1773..a74cfead 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,9 +48,6 @@ jobs: run: | sudo apt-get -yq --no-install-suggests --no-install-recommends install libx11-dev libxi-dev libgl1-mesa-dev - - name: Install Python - uses: actions/setup-python@v2 - - name: Install rust uses: actions-rs/toolchain@v1 with: @@ -77,7 +74,7 @@ jobs: - name: Export assets shell: bash run: | - python ./utils/assets_export.py + ./utils/assets_export.sh ls -lR assets - name: Build @@ -143,14 +140,11 @@ jobs: profile: minimal override: true - - name: Install Python - uses: actions/setup-python@v2 - - name: Install resvg run: cargo install resvg - name: Export assets - run: python ./utils/assets_export.py + run: ./utils/assets_export.sh - name: Build run: ./utils/wasm/build.sh diff --git a/README.md b/README.md index 8cc1f231..c6cb2fec 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ Install all [miniquad's system dependencies][mq_sys_deps]. ```bash cargo install resvg -./utils/assets_export.py +./utils/assets_export.sh cargo run ``` @@ -145,7 +145,7 @@ cargo run ```bash cargo install resvg -./utils/assets_export.py +./utils/assets_export.sh rustup target add wasm32-unknown-unknown ./utils/wasm/build.sh cargo install basic-http-server diff --git a/assets_src/export_ids b/assets_src/export_ids new file mode 100644 index 00000000..c45538f9 --- /dev/null +++ b/assets_src/export_ids @@ -0,0 +1,63 @@ +tile +tile_rocks +poison_cloud +imp +imp_toxic +imp_summoner +imp_summoner_cast +imp_bomber +imp_bomber_throw +grass +shadow +fire +boulder +bomb +bomb_fire +bomb_poison +bomb_demonic +explosion_ground_mark +blood +slash +smash +pierce +claw +spike_trap +dot +selection +white_hex +hammerman +heavy_hammerman +spearman +elite_spearman +heavy_spearman +alchemist +alchemist_throw +alchemist_heal +healer +healer_throw +healer_heal +firer +firer_throw +swordsman +elite_swordsman +elite_swordsman_rage +heavy_swordsman +effect_poison +effect_stun +effect_bloodlust +icon_ability_club +icon_ability_knockback +icon_ability_jump +icon_ability_dash +icon_ability_rage +icon_ability_heal +icon_ability_bomb_push +icon_ability_bomb +icon_ability_bomb_fire +icon_ability_bomb_poison +icon_ability_bomb_demonic +icon_ability_summon +icon_ability_bloodlust +icon_info +icon_end_turn +icon_menu diff --git a/utils/assets_export.py b/utils/assets_export.py deleted file mode 100755 index 9e05b8d2..00000000 --- a/utils/assets_export.py +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env python3 -"""Convert one `.svg` file to many `png`s.""" - -import subprocess -import os - - -EXPORT_IDS = [ - 'tile', - 'tile_rocks', - 'poison_cloud', - 'imp', - 'imp_toxic', - 'imp_summoner', - 'imp_summoner_cast', - 'imp_bomber', - 'imp_bomber_throw', - 'grass', - 'shadow', - 'fire', - 'boulder', - 'bomb', - 'bomb_fire', - 'bomb_poison', - 'bomb_demonic', - 'explosion_ground_mark', - 'blood', - 'slash', - 'smash', - 'pierce', - 'claw', - 'spike_trap', - 'dot', - 'selection', - 'white_hex', - 'hammerman', - 'heavy_hammerman', - 'spearman', - 'elite_spearman', - 'heavy_spearman', - 'alchemist', - 'alchemist_throw', - 'alchemist_heal', - 'healer', - 'healer_throw', - 'healer_heal', - 'firer', - 'firer_throw', - 'swordsman', - 'elite_swordsman', - 'elite_swordsman_rage', - 'heavy_swordsman', - 'effect_poison', - 'effect_stun', - 'effect_bloodlust', - 'icon_ability_club', - 'icon_ability_knockback', - 'icon_ability_jump', - 'icon_ability_dash', - 'icon_ability_rage', - 'icon_ability_heal', - 'icon_ability_bomb_push', - 'icon_ability_bomb', - 'icon_ability_bomb_fire', - 'icon_ability_bomb_poison', - 'icon_ability_bomb_demonic', - 'icon_ability_summon', - 'icon_ability_bloodlust', - 'icon_info', - 'icon_end_turn', - 'icon_menu', -] -INPUT_FILE_NAME = os.path.join('assets_src', 'atlas.svg') -OUT_DIR_NAME = os.path.join('assets', 'img') - - -def _main() -> None: - os.makedirs(OUT_DIR_NAME, exist_ok=True) - for export_id in EXPORT_IDS: - cmd = [ - 'resvg', - '--zoom=12', - f'--export-id={export_id}', - INPUT_FILE_NAME, - os.path.join(OUT_DIR_NAME, f'{export_id}.png'), - ] - print(cmd) - subprocess.run(cmd, check=True) - - -_main() diff --git a/utils/assets_export.sh b/utils/assets_export.sh new file mode 100755 index 00000000..0805d258 --- /dev/null +++ b/utils/assets_export.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# Convert one `.svg` file to many `png`s. + +EXPORT_IDS="assets_src/export_ids" +INPUT_FILE="assets_src/atlas.svg" +OUT_DIR="assets/img" + +mkdir -p $OUT_DIR + +cat $EXPORT_IDS | tr -d '\r' | while read -r id +do + echo Exporting "$id" + resvg --zoom=12 --export-id="$id" $INPUT_FILE "$OUT_DIR/$id.png" +done