From 14bef439abe547d3af6b6e96fba1c47df76e9cd2 Mon Sep 17 00:00:00 2001 From: Lephe Date: Wed, 3 Jul 2019 13:49:48 -0400 Subject: [PATCH] fxsdk fxconv: various improvements --- README.md | 4 +++- fxconv/fxconv.py | 2 +- fxsdk/assets/Makefile | 33 ++++++++++++++++++++------------- fxsdk/fxsdk.sh | 4 +++- 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 9369960..6af9983 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/fxconv/fxconv.py b/fxconv/fxconv.py index 49a7f12..a7bd802 100644 --- a/fxconv/fxconv.py +++ b/fxconv/fxconv.py @@ -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")) diff --git a/fxsdk/assets/Makefile b/fxsdk/assets/Makefile index 1b48ec8..93a942d 100755 --- a/fxsdk/assets/Makefile +++ b/fxsdk/assets/Makefile @@ -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 diff --git a/fxsdk/fxsdk.sh b/fxsdk/fxsdk.sh index 685e3c2..cd5c025 100755 --- a/fxsdk/fxsdk.sh +++ b/fxsdk/fxsdk.sh @@ -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() {