From f62f270de05ebe5a71ef2e66a1a0f54b4ed9dc61 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Fri, 30 Dec 2016 09:38:02 +0100 Subject: Working sprites and instance_create --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Makefile') 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 -- cgit v1.2.3-70-g09d2