diff --git a/examples/graphics/bitmap/24bit-color/Makefile b/examples/graphics/bitmap/24bit-color/Makefile index c4c758e..2f1f54a 100755 --- a/examples/graphics/bitmap/24bit-color/Makefile +++ b/examples/graphics/bitmap/24bit-color/Makefile @@ -29,8 +29,9 @@ include $(DEVKITARM)/3ds_rules TARGET := $(notdir $(CURDIR)) BUILD := build SOURCES := source -DATA := data +DATA := INCLUDES := include +GRAPHICS := gfx #--------------------------------------------------------------------------------- # options for code generation @@ -68,7 +69,8 @@ export OUTPUT := $(CURDIR)/$(TARGET) export TOPDIR := $(CURDIR) export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ - $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) \ + $(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir)) export DEPSDIR := $(CURDIR)/$(BUILD) @@ -76,6 +78,7 @@ CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) +PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png))) #--------------------------------------------------------------------------------- # use CXX for linking C++ projects, CC for standard C @@ -92,7 +95,8 @@ endif #--------------------------------------------------------------------------------- export OFILES := $(addsuffix .o,$(BINFILES)) \ - $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) + $(PNGFILES:.png=.rgb.o) \ + $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) \ export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ @@ -151,17 +155,19 @@ $(OUTPUT).elf : $(OFILES) @echo $(notdir $<) @$(bin2o) -# WARNING: This is not the right way to do this! TODO: Do it right! + + #--------------------------------------------------------------------------------- -%.vsh.o : %.vsh +%.rgb.o: %.rgb #--------------------------------------------------------------------------------- @echo $(notdir $<) - @python $(AEMSTRO)/aemstro_as.py $< ../$(notdir $<).shbin - @bin2s ../$(notdir $<).shbin | $(PREFIX)as -o $@ - @echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(notdir $<).shbin | tr . _)`.h - @echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(notdir $<).shbin | tr . _)`.h - @echo "extern const u32" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(notdir $<).shbin | tr . _)`.h - @rm ../$(notdir $<).shbin + @$(bin2o) + +#--------------------------------------------------------------------------------- +%.rgb: %.png +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + @convert $< -channel B -separate $< -channel G -separate $< -channel R -separate -channel RGB -combine -rotate 90 $@ -include $(DEPENDS) diff --git a/examples/graphics/bitmap/24bit-color/data/drunkenlogo.bin b/examples/graphics/bitmap/24bit-color/data/drunkenlogo.bin deleted file mode 100644 index 0b5b7a1..0000000 Binary files a/examples/graphics/bitmap/24bit-color/data/drunkenlogo.bin and /dev/null differ diff --git a/examples/graphics/bitmap/24bit-color/drunkenlogo.png b/examples/graphics/bitmap/24bit-color/gfx/drunkenlogo.png similarity index 100% rename from examples/graphics/bitmap/24bit-color/drunkenlogo.png rename to examples/graphics/bitmap/24bit-color/gfx/drunkenlogo.png diff --git a/examples/graphics/bitmap/24bit-color/source/main.c b/examples/graphics/bitmap/24bit-color/source/main.c index 9a3fc09..bc9b28f 100644 --- a/examples/graphics/bitmap/24bit-color/source/main.c +++ b/examples/graphics/bitmap/24bit-color/source/main.c @@ -17,7 +17,7 @@ #include //This include a header containing definitions of our image -#include "drunkenlogo_bin.h" +#include "drunkenlogo_rgb.h" int main(int argc, char **argv) { @@ -41,7 +41,7 @@ int main(int argc, char **argv) u8* fb = gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, NULL, NULL); //Copy our image in the bottom screen's frame buffer - memcpy(fb, drunkenlogo_bin, drunkenlogo_bin_size); + memcpy(fb, drunkenlogo_rgb, drunkenlogo_rgb_size); // Main loop while (aptMainLoop())