fxsdk fxconv: various improvements

This commit is contained in:
Lephe 2019-07-03 13:49:48 -04:00
parent f8dc830adc
commit 14bef439ab
4 changed files with 27 additions and 16 deletions

View File

@ -56,9 +56,11 @@ makes it a lot easier to climb back abstraction levels from the code.
## Build instructions
The fxSDK is platform-agnostic; a single install will cover any target
platforms. There's only one noticeable dependency:
platforms. Here are the dependencies:
* libpng ≥ 1.6
* Python ≥ 3.7 (might work in 3.6)
* The Pillow library for Python 3
First configure; you can specify the install folder with `--prefix`, which
defaults to your local home folder. You can also enable or disable tools.

View File

@ -97,7 +97,7 @@ class _Grid:
# [grid] is a dictionary of parameters. Relevant keys:
# "border", "padding", "width", "height", "size"
def __init__(self, grid):
self.border = int(grid.get("border", 1))
self.border = int(grid.get("border", 0))
self.padding = int(grid.get("padding", 0))
self.w = int(grid.get("width", "-1"))

View File

@ -39,24 +39,31 @@ target-cg := $(filename).g3a
# Source files
src := $(wildcard src/*.c)
img-fx := $(wildcard assets-fx/img/**/*)
fonts-fx := $(wildcard assets-fx/fonts/**/*)
img-cg := $(wildcard assets-cg/img/**/*)
fonts-cg := $(wildcard assets-cg/fonts/**/*)
assets-fx := $(wildcard assets-fx/**/*)
assets-cg := $(wildcard assets-cg/**/*)
# Object files
obj-fx := $(src:%.c=build-fx/%.o) $(res:assets-fx/%=build-fx/assets/%.o)
obj-cg := $(src:%.c=build-cg/%.o) $(res:assets-cg/%=build-cg/assets/%.o)
obj-fx := $(src:%.c=build-fx/%.o) $(assets-fx:assets-fx/%=build-fx/assets/%.o)
obj-cg := $(src:%.c=build-cg/%.o) $(assets-cg:assets-cg/%=build-cg/assets/%.o)
# Additional dependencies
deps-fx := $(ICON_FX)
deps-cg := $(ICON_CG_UNS) $(ICON_CG_SEL)
deps-fx := $(ICON_FX)
deps-cg := $(ICON_CG_UNS) $(ICON_CG_SEL)
# All targets
all :=
ifneq "$(wildcard build-fx)" ""
all += all-fx
endif
ifneq "$(wildcard build-cg)" ""
all += all-cg
endif
#
# Build rules
#
all: all-fx all-cg
all: $(all)
all-fx: $(target-fx)
all-cg: $(target-cg)
@ -84,22 +91,22 @@ build-cg/%.o: %.c
# Images
build-fx/assets/img/%.o: assets-fx/img/%
@ mkdir -p $(dir $@)
fxconv -i $< -o $@ name:$*
fxconv -i $< -o $@ name:img_$(basename $*)
build-cg/assets/img/%.o: assets-cg/img/%
@ echo -ne "\e[31;1mWARNING: image conversion for fxcg50 is not "
@ echo -ne "supported yet\e[0m"
@ mkdir -p $(dir $@)
fxconv -i $< -o $@ name:$*
fxconv -i $< -o $@ name:img_$(basename $*)
# Fonts
build-fx/assets/fonts/%.o: assets-fx/fonts/%
@ mkdir -p $(dir $@)
fxconv -f $< -o $@ name:$*
fxconv -f $< -o $@ name:font_$(basename $*) $(FONT.$*)
build-cg/assets/fonts/%.o: assets-cg/fonts/%
@ mkdir -p $(dir $@)
fxconv -f $< -o $@ name:$*
fxconv -f $< -o $@ name:font_$(basename $*) $(FONT.$*)
#
# Cleaning and utilities

View File

@ -114,7 +114,9 @@ fxsdk_new_project_interactive() {
}
fxsdk_load_config() {
sed -E 's/^([A-Z_]+)\s*=\s*(.*)/\1="\2"' project.cfg | source /dev/stdin
grep -E '^ *[a-zA-Z0-9_]+ *=' project.cfg \
| sed -E 's/^([A-Z_]+)\s*=\s*(.*)/\1="\2"/' \
| source /dev/stdin
}
fxsdk_create_config() {