mirror of
https://git.planet-casio.com/Lephenixnoir/fxsdk.git
synced 2024-12-29 13:03:37 +01:00
fxsdk fxconv: various improvements
This commit is contained in:
parent
f8dc830adc
commit
14bef439ab
4 changed files with 27 additions and 16 deletions
|
@ -56,9 +56,11 @@ makes it a lot easier to climb back abstraction levels from the code.
|
||||||
## Build instructions
|
## Build instructions
|
||||||
|
|
||||||
The fxSDK is platform-agnostic; a single install will cover any target
|
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
|
* 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
|
First configure; you can specify the install folder with `--prefix`, which
|
||||||
defaults to your local home folder. You can also enable or disable tools.
|
defaults to your local home folder. You can also enable or disable tools.
|
||||||
|
|
|
@ -97,7 +97,7 @@ class _Grid:
|
||||||
# [grid] is a dictionary of parameters. Relevant keys:
|
# [grid] is a dictionary of parameters. Relevant keys:
|
||||||
# "border", "padding", "width", "height", "size"
|
# "border", "padding", "width", "height", "size"
|
||||||
def __init__(self, grid):
|
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.padding = int(grid.get("padding", 0))
|
||||||
|
|
||||||
self.w = int(grid.get("width", "-1"))
|
self.w = int(grid.get("width", "-1"))
|
||||||
|
|
|
@ -39,24 +39,31 @@ target-cg := $(filename).g3a
|
||||||
|
|
||||||
# Source files
|
# Source files
|
||||||
src := $(wildcard src/*.c)
|
src := $(wildcard src/*.c)
|
||||||
img-fx := $(wildcard assets-fx/img/**/*)
|
assets-fx := $(wildcard assets-fx/**/*)
|
||||||
fonts-fx := $(wildcard assets-fx/fonts/**/*)
|
assets-cg := $(wildcard assets-cg/**/*)
|
||||||
img-cg := $(wildcard assets-cg/img/**/*)
|
|
||||||
fonts-cg := $(wildcard assets-cg/fonts/**/*)
|
|
||||||
|
|
||||||
# Object files
|
# Object files
|
||||||
obj-fx := $(src:%.c=build-fx/%.o) $(res:assets-fx/%=build-fx/assets/%.o)
|
obj-fx := $(src:%.c=build-fx/%.o) $(assets-fx:assets-fx/%=build-fx/assets/%.o)
|
||||||
obj-cg := $(src:%.c=build-cg/%.o) $(res:assets-cg/%=build-cg/assets/%.o)
|
obj-cg := $(src:%.c=build-cg/%.o) $(assets-cg:assets-cg/%=build-cg/assets/%.o)
|
||||||
|
|
||||||
# Additional dependencies
|
# Additional dependencies
|
||||||
deps-fx := $(ICON_FX)
|
deps-fx := $(ICON_FX)
|
||||||
deps-cg := $(ICON_CG_UNS) $(ICON_CG_SEL)
|
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
|
# Build rules
|
||||||
#
|
#
|
||||||
|
|
||||||
all: all-fx all-cg
|
all: $(all)
|
||||||
|
|
||||||
all-fx: $(target-fx)
|
all-fx: $(target-fx)
|
||||||
all-cg: $(target-cg)
|
all-cg: $(target-cg)
|
||||||
|
@ -84,22 +91,22 @@ build-cg/%.o: %.c
|
||||||
# Images
|
# Images
|
||||||
build-fx/assets/img/%.o: assets-fx/img/%
|
build-fx/assets/img/%.o: assets-fx/img/%
|
||||||
@ mkdir -p $(dir $@)
|
@ mkdir -p $(dir $@)
|
||||||
fxconv -i $< -o $@ name:$*
|
fxconv -i $< -o $@ name:img_$(basename $*)
|
||||||
|
|
||||||
build-cg/assets/img/%.o: assets-cg/img/%
|
build-cg/assets/img/%.o: assets-cg/img/%
|
||||||
@ echo -ne "\e[31;1mWARNING: image conversion for fxcg50 is not "
|
@ echo -ne "\e[31;1mWARNING: image conversion for fxcg50 is not "
|
||||||
@ echo -ne "supported yet\e[0m"
|
@ echo -ne "supported yet\e[0m"
|
||||||
@ mkdir -p $(dir $@)
|
@ mkdir -p $(dir $@)
|
||||||
fxconv -i $< -o $@ name:$*
|
fxconv -i $< -o $@ name:img_$(basename $*)
|
||||||
|
|
||||||
# Fonts
|
# Fonts
|
||||||
build-fx/assets/fonts/%.o: assets-fx/fonts/%
|
build-fx/assets/fonts/%.o: assets-fx/fonts/%
|
||||||
@ mkdir -p $(dir $@)
|
@ mkdir -p $(dir $@)
|
||||||
fxconv -f $< -o $@ name:$*
|
fxconv -f $< -o $@ name:font_$(basename $*) $(FONT.$*)
|
||||||
|
|
||||||
build-cg/assets/fonts/%.o: assets-cg/fonts/%
|
build-cg/assets/fonts/%.o: assets-cg/fonts/%
|
||||||
@ mkdir -p $(dir $@)
|
@ mkdir -p $(dir $@)
|
||||||
fxconv -f $< -o $@ name:$*
|
fxconv -f $< -o $@ name:font_$(basename $*) $(FONT.$*)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Cleaning and utilities
|
# Cleaning and utilities
|
||||||
|
|
|
@ -114,7 +114,9 @@ fxsdk_new_project_interactive() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fxsdk_load_config() {
|
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() {
|
fxsdk_create_config() {
|
||||||
|
|
Loading…
Reference in a new issue