summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2016-12-30 09:38:02 +0100
committertomsmeding <tom.smeding@gmail.com>2016-12-30 09:38:02 +0100
commitf62f270de05ebe5a71ef2e66a1a0f54b4ed9dc61 (patch)
tree19957fe8bc0e0bccbce6c73fef6b6092ed705807 /Makefile
parentc8a110cdeca8c23b88d6908f0b06231847c9e722 (diff)
Working sprites and instance_create
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile8
1 files changed, 4 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 995f07f..54d6f53 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
CXX := g++
CXXFLAGS := -Wall -Wextra -std=c++11 -O2 -I.
-LIBS := -lfltk -L/usr/local/lib
+LIBS := -L/usr/local/lib -lfltk -lfltk_images
BIN := game
object_src := $(wildcard src/objects/*.cpp)
@@ -12,10 +12,10 @@ sprite_allfiles := $(wildcard src/sprites/*)
sprite_fnames := $(filter %.png,$(sprite_allfiles))
sprite_skipped := $(filter-out %.png,$(sprite_allfiles))
sprite_obj := $(patsubst src/sprites/%.png,build/sprites/%.o,$(sprite_fnames))
-sprite_externs := $(shell echo $$(for f in $(sprite_obj); do basename $$f | sed 's/\.[^.]*$$//' | sed 's/.*/extern const Sprite &;/'; done))
+sprite_externs := $(shell echo $$(for f in $(sprite_obj); do basename $$f | sed 's/\.[^.]*$$//' | sed 's/.*/extern Sprite *&;/'; done))
base_src := $(wildcard *_base.cpp)
-base_src += library.cpp main.cpp
+base_src += library.cpp sprite.cpp main.cpp
base_obj := $(patsubst %.cpp,build/%.o,$(base_src))
.PHONY: all clean remake run
@@ -80,7 +80,7 @@ build/sprites/%.o: build/sprites/%.cpp
build/sprites/%.cpp: src/sprites/%.png
echo Generating for sprite $*
mkdir -p $(dir $@)
- printf "#include \"sprite.h\"\n\nstatic const unsigned char data[]={\n%s, 0\n};\n\nSprite $*=(Sprite){.image=data,.image_len=%d};\n" "$$(xxd -i <"$<")" $$(stat -f '%z' "$<") >"$@"
+ printf "#include \"sprite.h\"\n\nstatic const unsigned char data[]={\n%s, 0\n};\n\nstatic Sprite struct_data=Sprite(data,%d);\nSprite *$*=&struct_data;\n" "$$(xxd -i <"$<")" $$(stat -f '%z' "$<") >"$@"
build/sprites.h:
echo Collecting generated sprite files