Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use asetools #448

Merged
merged 2 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 14 additions & 16 deletions core/assets-src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ TOOLS_DIR ?= ../../tools

FINAL_OUT_DIR ?= ../../android/assets

ASESPLIT = $(TOOLS_DIR)/asetools/asesplit

all: hud anims stills vehicles tiles helicopter ui map-icons championship-icons input-icons

clean:
Expand All @@ -22,7 +20,7 @@ stills: $(OUT_STILL_IMAGES)
$(OUT_DIR)/sprites/%.png: sprites/%.still.ase
mkdir -p $(OUT_DIR)/sprites
mkdir -p $(OUT_DIR)/sprites/tires
$(ASESPLIT) $< $@
asesplit $< $@

# Anims
ANIM_IMAGES := $(wildcard sprites/*.anim.ase sprites/tires/*.anim.ase)
Expand All @@ -35,14 +33,14 @@ $(OUT_DIR)/sprites/%_0.png: sprites/%.anim.ase
mkdir -p $(OUT_DIR)/sprites/tires
# $(@D) is the directory part of the target
# $(*F) is the % part of the target
$(ASESPLIT) $< "$(@D)/$(*F)_{frame}.png"
asesplit $< "$(@D)/$(*F)_{frame}.png"

# Helicopter
helicopter: $(OUT_DIR)/sprites/helicopter-body.png

$(OUT_DIR)/sprites/helicopter-body.png: sprites/helicopter.ase
mkdir -p $(OUT_DIR)/sprites
$(ASESPLIT) --split-layers --trim $< "$(OUT_DIR)/sprites/helicopter-{layer}.png"
asesplit --split-layers --trim $< "$(OUT_DIR)/sprites/helicopter-{layer}.png"

# hud-*
# Just enough to trigger the target
Expand All @@ -51,16 +49,16 @@ hud: $(OUT_DIR)/sprites/hud-pause.png $(OUT_DIR)/sprites/lap-icon.png
$(OUT_DIR)/sprites/hud-pause.png: sprites/hud/hud-pie-buttons.ase sprites/hud/hud-sides-buttons.ase sprites/hud/hud.py
mkdir -p $(OUT_DIR)/sprites

$(ASESPLIT) --split-layers --trim sprites/hud/hud-pie-buttons.ase \
asesplit --split-layers --trim sprites/hud/hud-pie-buttons.ase \
"sprites/hud/hud-{layer}.png"

$(ASESPLIT) --split-slices sprites/hud/hud-sides-buttons.ase \
asesplit --split-slices sprites/hud/hud-sides-buttons.ase \
"sprites/hud/{slice}.png"

sprites/hud/hud.py $(OUT_DIR)/sprites

$(OUT_DIR)/sprites/lap-icon.png: sprites/hud/lap-icon.ase
$(ASESPLIT) $< $@
asesplit $< $@

#- sprites/vehicles/ ----------------------------------------------------------
VEHICLE_IMAGES := $(wildcard sprites/vehicles/*.ase)
Expand All @@ -70,7 +68,7 @@ vehicles: $(OUT_VEHICLE_IMAGES)

$(OUT_DIR)/sprites/vehicles/%_0.png: sprites/vehicles/%.ase
mkdir -p $(OUT_DIR)/sprites/vehicles
$(ASESPLIT) --rotate -90 $< "$(OUT_DIR)/sprites/vehicles/$(*F)_{frame}.png"
asesplit --rotate -90 $< "$(OUT_DIR)/sprites/vehicles/$(*F)_{frame}.png"

#- maps/ ----------------------------------------------------------------------
TILE_IMAGES := $(wildcard maps/*.ase)
Expand All @@ -81,7 +79,7 @@ tiles: $(OUT_TILE_IMAGES)
$(FINAL_OUT_DIR)/maps/%.png: TMP_PNG = $(@:%.png=%-tmp.png)
$(FINAL_OUT_DIR)/maps/%.png: maps/%.ase
mkdir -p $(FINAL_OUT_DIR)/maps
$(ASESPLIT) $< $(TMP_PNG)
asesplit $< $(TMP_PNG)
convert -alpha set -channel RGBA \
-fill '#22203460' -opaque '#ff00ff' \
-fill '#ffffff20' -opaque '#00ffff' \
Expand All @@ -96,7 +94,7 @@ OUT_UI_STILL_IMAGES := $(UI_STILL_IMAGES:%.still.ase=$(OUT_DIR)/%.png)

$(OUT_DIR)/ui/%.png: ui/%.still.ase
mkdir -p $(OUT_DIR)/ui
$(ASESPLIT) $< $@
asesplit $< $@

# Anims
UI_ANIM_IMAGES := $(wildcard ui/*.anim.ase)
Expand All @@ -105,7 +103,7 @@ OUT_UI_ANIM_FIRST_FRAMES := $(UI_ANIM_IMAGES:%.anim.ase=$(OUT_DIR)/%_0.png)
$(OUT_DIR)/ui/%_0.png: ui/%.anim.ase
mkdir -p $(OUT_DIR)/ui
# $(*F) is the % part of the target
$(ASESPLIT) $< "$(OUT_DIR)/ui/$(*F)_{frame}.png"
asesplit $< "$(OUT_DIR)/ui/$(*F)_{frame}.png"

# Slices. We don't know the name of the slices, so use a "timestamp" file to
# track the target status
Expand All @@ -114,7 +112,7 @@ OUT_UI_SLICES_IMAGES := $(UI_SLICES_IMAGES:%.slices.ase=$(OUT_DIR)/%.slices.time

$(OUT_DIR)/ui/%.slices.timestamp: ui/%.slices.ase
mkdir -p $(OUT_DIR)/ui
$(ASESPLIT) --split-slices $< "$(OUT_DIR)/ui/{slice}.png"
asesplit --split-slices $< "$(OUT_DIR)/ui/{slice}.png"
touch $@

ui: $(OUT_UI_STILL_IMAGES) $(OUT_UI_ANIM_FIRST_FRAMES) $(OUT_UI_SLICES_IMAGES)
Expand All @@ -127,7 +125,7 @@ map-icons: $(OUT_MAP_ICONS)

$(OUT_DIR)/ui/map-icons/%.png: ui/map-icons/%.ase
mkdir -p $(OUT_DIR)/ui/map-icons
$(ASESPLIT) $< $@
asesplit $< $@

#- ui/championship-icons/ -----------------------------------------------------
CHAMPIONSHIP_ICONS := $(wildcard ui/championship-icons/*.ase)
Expand All @@ -137,7 +135,7 @@ championship-icons: $(OUT_CHAMPIONSHIP_ICONS)

$(OUT_DIR)/ui/championship-icons/%.png: ui/championship-icons/%.ase
mkdir -p $(OUT_DIR)/ui/championship-icons
$(ASESPLIT) $< $@
asesplit $< $@

#- ui/input-icons/ ------------------------------------------------------------
INPUT_ICONS := ui/input-icons/input-icons.ase
Expand All @@ -148,4 +146,4 @@ input-icons: $(OUT_INPUT_ICONS_DIR)/sides.png
$(OUT_INPUT_ICONS_DIR)/sides.png: $(INPUT_ICONS)
mkdir -p $(OUT_INPUT_ICONS_DIR)

$(ASESPLIT) --split-slices $< "$(OUT_INPUT_ICONS_DIR)/{slice}.png"
asesplit --split-slices $< "$(OUT_INPUT_ICONS_DIR)/{slice}.png"
5 changes: 1 addition & 4 deletions docs/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ Building Pixel Wheels requires the following components:
- libgdx: <https://libgdx.badlogicgames.com>
- ImageMagick: <http://imagemagick.org>
- GNU Make: <http://www.gnu.org/software/make/>
- Some Python packages:
- PAFX: <https://github.com/agateau/pafx>
- Pillow: <https://python-pillow.github.io>
- pypng: <https://github.com/drj11/pypng>
- Some Python packages (see `requirements.txt` file)

#### Python packages

Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
Pillow==10.0.1
git+https://github.com/agateau/pafx@9c364ca9098d70ee23b6c4caccbcdf0cc44f2fb4#egg=pafx
pypng==0.0.20
fonttools==4.27.1
asetools==0.1.1
6 changes: 0 additions & 6 deletions tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@

This directory contains tools used to build or work on Pixel Wheels.

## asetools/

Command-line tools to turn Aseprite images into PNG usable by the game.

More details in [asetools/README.md](asetools/README.md).

## fonts/

Scripts to process fonts shipped with the game, to reduce their size.
Expand Down
25 changes: 0 additions & 25 deletions tools/asetools/README.md

This file was deleted.

42 changes: 0 additions & 42 deletions tools/asetools/aseinfo

This file was deleted.

Loading
Loading