Skip to content

Commit

Permalink
Merge pull request #1 from WinterMute/example-24bit_Bitmap
Browse files Browse the repository at this point in the history
Example 24bit bitmap
  • Loading branch information
Aurelio92 committed Dec 15, 2014
2 parents 31dfb6a + cbb00e4 commit 83cdef0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
28 changes: 17 additions & 11 deletions examples/graphics/bitmap/24bit-color/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -68,14 +69,16 @@ 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)

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
Expand All @@ -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) \
Expand Down Expand Up @@ -151,17 +155,19 @@ $(OUTPUT).elf : $(OFILES)
@echo $(notdir $<)
@$(bin2o)

# WARNING: This is not the right way to do this! TODO: Do it right!


#---------------------------------------------------------------------------------
%.rgb.o: %.rgb
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)

#---------------------------------------------------------------------------------
%.vsh.o : %.vsh
%.rgb: %.png
#---------------------------------------------------------------------------------
@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
@convert $< -channel B -separate $< -channel G -separate $< -channel R -separate -channel RGB -combine -rotate 90 $@

-include $(DEPENDS)

Expand Down
Binary file not shown.
4 changes: 2 additions & 2 deletions examples/graphics/bitmap/24bit-color/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <string.h>

//This include a header containing definitions of our image
#include "drunkenlogo_bin.h"
#include "drunkenlogo_rgb.h"

int main(int argc, char **argv)
{
Expand All @@ -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())
Expand Down

0 comments on commit 83cdef0

Please sign in to comment.