diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 32cc76d..ff98541 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,4 +26,5 @@ jobs: name: examples path: | examples/**/*.elf + examples/gamecube/**/*.dol !examples/template/* diff --git a/examples/gamecube/3D_CubedTileDemo/Makefile b/examples/gamecube/3D_CubedTileDemo/Makefile new file mode 100644 index 0000000..1a18e66 --- /dev/null +++ b/examples/gamecube/3D_CubedTileDemo/Makefile @@ -0,0 +1,146 @@ +#--------------------------------------------------------------------------------- +# Clear the implicit built in rules +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- +ifeq ($(strip $(DEVKITPPC)),) +$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") +endif + +include $(DEVKITPPC)/gamecube_rules + +#--------------------------------------------------------------------------------- +# TARGET is the name of the output +# BUILD is the directory where object files & intermediate files will be placed +# SOURCES is a list of directories containing source code +# INCLUDES is a list of directories containing extra header files +#--------------------------------------------------------------------------------- +TARGET := $(notdir $(CURDIR)) +BUILD := build +SOURCES := source +DATA := data +INCLUDES := + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- + +CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) +CXXFLAGS = $(CFLAGS) + +LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -lgrrlib -lfreetype -lbz2 -lpngu -lpng -ljpeg -lz -lfat -logc -lm + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(CURDIR)/$(GRRLIB) $(PORTLIBS) + +#--------------------------------------------------------------------------------- +# no real need to edit anything past this point unless you need to add additional +# rules for different file extensions +#--------------------------------------------------------------------------------- +ifneq ($(BUILD),$(notdir $(CURDIR))) +#--------------------------------------------------------------------------------- + +export OUTPUT := $(CURDIR)/$(TARGET) + +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + +export DEPSDIR := $(CURDIR)/$(BUILD) + +#--------------------------------------------------------------------------------- +# automatically build a list of object files for our project +#--------------------------------------------------------------------------------- +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) +sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) + +#--------------------------------------------------------------------------------- +# use CXX for linking C++ projects, CC for standard C +#--------------------------------------------------------------------------------- +ifeq ($(strip $(CPPFILES)),) + export LD := $(CC) +else + export LD := $(CXX) +endif + +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o) +export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) + +export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) + +#--------------------------------------------------------------------------------- +# build a list of include paths +#--------------------------------------------------------------------------------- +export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) \ + -I$(LIBOGC_INC) + +#--------------------------------------------------------------------------------- +# build a list of library paths +#--------------------------------------------------------------------------------- +export LIBPATHS := -L$(LIBOGC_LIB) $(foreach dir,$(LIBDIRS),-L$(dir)/lib) + +export OUTPUT := $(CURDIR)/$(TARGET) +.PHONY: $(BUILD) clean + +#--------------------------------------------------------------------------------- +$(BUILD): + @[ -d $@ ] || mkdir -p $@ + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol + +#--------------------------------------------------------------------------------- +run: + wiiload $(TARGET).dol + + +#--------------------------------------------------------------------------------- +else + +DEPENDS := $(OFILES:.o=.d) + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- +$(OUTPUT).dol: $(OUTPUT).elf +$(OUTPUT).elf: $(OFILES) + +$(OFILES_SOURCES) : $(HFILES) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .jpg extension +#--------------------------------------------------------------------------------- +%.jpg.o : %.jpg +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .png extension +#--------------------------------------------------------------------------------- +%.png.o : %.png +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +-include $(DEPENDS) + +#--------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------- diff --git a/examples/gamecube/3D_CubedTileDemo/data/bg.png b/examples/gamecube/3D_CubedTileDemo/data/bg.png new file mode 100644 index 0000000..164e7e4 Binary files /dev/null and b/examples/gamecube/3D_CubedTileDemo/data/bg.png differ diff --git a/examples/gamecube/3D_CubedTileDemo/data/logo.png b/examples/gamecube/3D_CubedTileDemo/data/logo.png new file mode 100644 index 0000000..8dd44d8 Binary files /dev/null and b/examples/gamecube/3D_CubedTileDemo/data/logo.png differ diff --git a/examples/gamecube/3D_CubedTileDemo/data/nonameno.png b/examples/gamecube/3D_CubedTileDemo/data/nonameno.png new file mode 100644 index 0000000..6d55046 Binary files /dev/null and b/examples/gamecube/3D_CubedTileDemo/data/nonameno.png differ diff --git a/examples/gamecube/3D_CubedTileDemo/data/perso.png b/examples/gamecube/3D_CubedTileDemo/data/perso.png new file mode 100644 index 0000000..142856c Binary files /dev/null and b/examples/gamecube/3D_CubedTileDemo/data/perso.png differ diff --git a/examples/gamecube/3D_CubedTileDemo/data/tile1.png b/examples/gamecube/3D_CubedTileDemo/data/tile1.png new file mode 100644 index 0000000..cb87f40 Binary files /dev/null and b/examples/gamecube/3D_CubedTileDemo/data/tile1.png differ diff --git a/examples/gamecube/3D_CubedTileDemo/source/main.c b/examples/gamecube/3D_CubedTileDemo/source/main.c new file mode 100644 index 0000000..df38e01 --- /dev/null +++ b/examples/gamecube/3D_CubedTileDemo/source/main.c @@ -0,0 +1,349 @@ +/*=========================================== + NoNameNo CubedTileDemo + A sample code to show how to use Dynamic Texturing + Have a look a TileDemo sources for diff ;) +============================================*/ +#include + +#include +#include +#include + +#include "tile1_png.h" +#include "perso_png.h" +#include "bg_png.h" +#include "nonameno_png.h" + +#define TileMap1Width (32) +#define TileMap1Height (32) +#define Map1Width (87) +#define Map1Height (51) + +signed short Map1Data[53][87] = +{{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,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 0, 0, 0, 0, 1, 1,17,16, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3,18,19, 3,18,19, 3, 4,20,21, 0,22, 0, 0, 0, 0, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 0, 1, 1, 1, 0,17,16,17,16,17,16,17,16,17,16,17,16,17,16,17,16,17,16,17,16,17}, + {23,23,24,23,24,23,24,23,24,23,22,22, 0, 1, 1, 1, 1, 0,24,23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,25,26, 0,27,28,28,28,28,28,28,28,28,28,29,30,31,22, 0, 0, 0, 2, 3,32,33, 3,34,35, 3,36,37, 3, 4, 0, 1, 0, 0,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23,22,22, 0, 1, 1, 1, 1, 0,24,23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,38,39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,13,14, 0,22,13,14, 0, 2, 3,11,12, 3,11,12, 3,11,12, 3, 4, 1, 1, 0, 0,24,23,40,41,40,41,40,41,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23,27,28,28,31, 1, 1, 1, 0,24,23,13,14, 0, 0, 0, 0, 0, 0, 0, 0,42,43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,20,21, 0,22,20,21, 0, 2, 3,18,19, 3,18,19, 3,18,19, 3, 4, 1, 0, 0, 0,24,23,44,45,46,44, 0, 0,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23,27,28,28,31, 1, 0, 0, 0,24,23,20,21, 0, 0, 0, 0, 0, 0, 0,22,47,48,22, 0, 0, 0, 0, 0, 0, 0, 0, 0,27,28,28,28,28,29,30,28,28,28,28,28,28,28,28,28,28,28,28,28,28,31, 0, 0,24,23,44,11,12,44,13,14,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0,27,28,28,31, 0, 0, 0,24,23,13,14, 0, 0, 0,13,14, 0,42,43,42,43,42,43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,13,14,17,16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,24,23,44,18,19,44,20,21,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23,27,28,28,31, 0, 0, 0, 0,24,23,20,21, 0, 0, 0,20,21,22,47,48,47,48,47,48,22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,20,21,24,23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,24,23,27,28,28,31,13,14,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0,27,28,28,31, 0, 0,27,28,28,29,30,28,28,28,29,30,28,28,28,28,28,28,28,31, 0, 0, 0, 0, 0, 0, 0, 2, 3, 3, 4, 0,13,14,24,23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,24,23,40,41,40,41,20,21,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23,27,28,28,31, 0, 0, 0, 0, 0, 0,20,21, 0, 0, 0,13,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3,49,50, 3, 4,13,14,24,23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,24,23,24,23,24,23,13,14,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0,27,28,28,31, 0, 0, 0, 0, 0,13,14, 0, 0, 0,20,21, 0, 0, 0, 0,20,21, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3,11,12, 3, 4,20,21,24,23, 0, 0, 0, 0,27,28,28,31, 0, 0, 2, 3, 3, 4, 0,40,41,40,41,40,41,20,21,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 0,27,28,28,31, 0, 0, 0,20,21, 0, 0, 0,13,14, 0, 0, 0, 0,13,14, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3,18,19, 3, 4,13,14,24,23, 0, 0,17,16, 0,27,28,31, 0, 2, 3,51,52, 3, 4, 0, 0, 0, 0, 0, 0,13,14,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 0, 2, 3, 3, 4, 0, 0, 0,13,14, 0, 0, 0,20,21, 0, 0, 0,27,29,30,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,31, 2,53,54, 4, 0,22, 0, 0, 2, 3,11,12, 3, 4, 0, 0, 0, 0, 0, 0,20,21,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 2, 3,55,56, 3, 4, 0, 0,20,21, 0, 0, 0,13,14, 0, 0, 0, 0,13,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3,11,12, 3, 4,22, 0, 0, 2, 3,18,19, 3, 4, 0, 0, 0, 0, 0, 0,13,14,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 2, 3,11,12, 3, 4, 0, 0,13,14, 0, 0, 0,20,21, 0, 0, 0, 0,20,21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3,18,19, 3, 4,22, 0, 0,27,28,28,28,28,28,28,28,28,28,28,31,20,21,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 2, 3,18,19, 3, 4, 0, 0,20,21, 0, 0, 0,13,14, 0, 0, 0, 0,13,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,27,28,28,31, 0,22, 0, 0, 0, 0, 0, 0, 0, 0,17,16,17,16,17,16,13,14,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0,27,28,28,28,28,28,28,28,28,28,28,31, 0, 0,20,21, 0, 0, 0,27,29,30,28,28,28,28,28,28,28,28,28,31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,22, 0, 0, 0, 0, 0, 0, 0, 0,24,23,24,23,24,23,20,21,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,13,14, 0, 0, 0, 0,13,14, 0, 0, 0, 0, 0, 0, 0, 0, 0,57,57, 0,57,57, 0,57,57, 0,42,43, 0,42,43, 0, 0, 0, 2, 3, 3, 4, 0, 0, 0,24,23,24,23,24,23,13,14,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 0, 2, 3, 3, 4, 0, 0, 0, 0, 0, 0,27,28,28,28,28,28,28,28,29,30,31, 0, 0, 0, 0, 0, 0, 0, 0,57,57, 0,57,57, 0,57,57, 0,47,48, 0,47,48, 0, 0, 2, 3,58,59, 3, 4, 0, 0,24,23,24,23,24,23,13,14,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 2, 3,60,61, 3, 4,13,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,13,14, 0, 0, 0, 0, 0, 0, 0, 0, 0,57,57, 0,57,57, 0,57,57, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3,11,12, 3, 4, 0, 0,24,23,24,23,24,23,20,21,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 2, 3,11,12, 3, 4,20,21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,20,21, 0, 0, 0, 0, 0, 0, 0, 0, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0, 0, 2, 3,18,19, 3, 4, 0, 0,24,23,24,23,24,23,13,14,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 2, 3,18,19, 3, 4,13,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,13,14, 0, 0, 0, 0, 0, 0, 0, 0, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0, 0,27,28,28,28,28,31, 0, 0,24,23,24,23,24,23,20,21,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0,27,28,28,28,28,28,29,30,28,28,31, 0, 0, 0, 0, 0, 0, 0, 0,20,21, 0, 0, 0, 0, 0, 0, 0, 0, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,24,23,24,23,24,23,13,14,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 0, 0, 0, 0, 0, 0,13,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,13,14, 0, 0, 0, 0, 2, 3, 3, 4, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0, 0,42,43, 0, 0, 0, 0, 0, 0,24,23,24,23,24,23,20,21,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 0, 0, 0, 0, 0, 0,20,21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,20,21, 0, 0, 0, 0, 3,62,63, 3, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0, 0,47,48, 0, 0, 0, 0, 0, 0,24,23,40,41,40,41,13,14,40,41,40,41,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 0, 0, 0, 0, 0, 0,13,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,13,14, 0, 0, 0, 2, 3,11,12, 3, 4, 0,57,57,57,57,57,57, 0, 0,57,57, 0,57,57, 0, 0,25,26, 0, 0,20,21, 0, 0,24,23, 2, 3, 3, 4,20,21, 0, 0, 0, 0,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 0, 0, 0, 0, 0, 0,20,21, 0, 0, 0, 2, 3, 3, 4, 0, 0, 0, 0,20,21, 0, 0, 0, 2, 3,18,19, 3, 4, 0, 0,57, 0, 0,57, 0, 0, 0,57,57, 0,57,57, 0, 0,38,39, 0, 0,13,14, 0, 0,24,23, 3,64,65, 3,13,14, 0, 0, 0, 5,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 0, 0, 0, 0, 0, 0,13,14, 0, 0, 2, 3,66,67, 3, 4, 0, 0, 0,13,14, 0, 0,27,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,29,30,31, 0,24,23, 3,11,12, 3,20,21, 0,42,43,10,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 0, 0, 0, 0, 0, 0,20,21, 0, 0, 2, 3,11,12, 3, 4, 0, 0, 0,20,21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,13,14, 0, 0,24,23, 3,18,19, 3,13,14, 0,47,48,15,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 0,68, 0, 0, 0, 0,13,14, 0, 0, 2, 3,18,19, 3, 4, 0,68, 0,13,14, 0, 0,57,57,57,57, 0, 0, 0,57,57,57, 0, 0, 0, 0,57, 0, 0,57, 0, 0, 0,57,57,57,57, 0, 0,20,21, 0, 0,24,23,27,28,28,28,28,28,28,28,28,31,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0,27,28,28,28,28,28,28,29,30,28,28,28,28,28,28,28,28,28,28,28,28,28,28,31,57,57,57,57,57, 0,57,57,57,57,57, 0, 0,57,57,57,57,57,57, 0, 0,57,57,57,57,57, 0,13,14, 0, 0,24,23,17,16,17,16,17,16,17,16,17,16,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 0,17,16,17,16, 0,13,14, 0, 0, 0, 0, 0, 0, 0,44, 0, 0, 0, 0, 0, 0, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,20,21, 0, 0,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 0,24,23,24,23, 0,20,21, 0, 0, 0, 0, 0, 0, 0,44, 0, 0, 0, 0, 0, 0, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,13,14, 0, 0,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 0,24,23,24,23, 0,13,14, 0, 0, 0, 0, 0, 0, 0,44, 0, 0, 0, 0, 0, 0, 0,57,57,57,57, 0, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57,57,57, 0, 0,20,21, 0, 0,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23,22, 0, 0,24,23,24,23, 0,20,21, 0, 0, 0, 0, 0, 0, 0,44, 0, 0, 0, 0, 0, 0, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,13,14, 0, 0,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23,22, 0, 0,24,23,24,23, 0,13,14, 0, 0, 2, 3, 3, 4, 0,44, 0, 0, 0, 0, 0, 0, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,13,14, 0, 0,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23,22, 0, 0,17,69,70,16, 0,20,21, 0, 2, 3,71,72, 3, 4,44, 0, 0, 0, 0, 0, 0, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,13,14, 0, 0,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23,42,43, 0,44,11,12,44, 0,13,14, 0, 2, 3,11,12, 3, 4,44, 0, 0, 0, 0, 0, 0, 0,57,57,57,57,57, 0,57,57,57,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57,57,57,57, 0,20,21, 0, 0,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {41,41,40,41,40,41,40,41,40,41,47,48,22,44,18,19,44, 0,13,14, 0, 2, 3,18,19, 3, 4,44, 0, 0,68,68, 0, 0, 0,57,57,57,57, 0, 0, 0,57,57,57, 0, 0,57,57, 0,57,57, 0,57,57, 0,57,57,57,57, 0, 0,13,14, 0, 0,40,41,40,41,40,41,40,41,40,41,40,41,40,41,40,41,40,41,40,41,40}, + {73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73}, + {74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74}, + {74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74}, + {74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74}, + {74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74}, + {74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74}, + {74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74}, + {74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74}, + {74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74}}; + +signed int Map1Info[53][87] = +{{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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1, 1, 1, 0, 0, 0, 0, 2, 8,43521,43521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,43521,43521, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 2, 8, 0, 0, 0, 0,43521,43521, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2}, + { 8, 8, 2, 8, 2, 8, 2, 8, 2, 8, 0, 1, 1, 1, 1, 0, 0, 0, 2, 8,43521,43521, 0, 0, 0,43521,43521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 2, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 8, 0,64512,64512, 0,43521,43521, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2}, + { 8, 8, 2, 8, 2, 8, 2, 8, 2, 8, 1, 1, 1, 1, 0, 0, 0, 0, 2, 8,43521,43521, 0, 0, 0,43521,43521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 2, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 8, 1, 1, 1, 1,43521,43521, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2}, + { 8, 8, 2, 8, 2, 8, 2, 8, 2, 8, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1,43521,43521, 1, 1, 1,43521,43521, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 2, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 8, 0, 0, 0, 8,43521,43521, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2}, + { 8, 8, 2, 8, 2, 8, 2, 8, 2, 8, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,43521,43521, 0, 0, 0,43521,43521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 2, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 8, 2, 8, 2, 8,43521,43521, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2}, + { 8, 8, 2, 8, 2, 8, 2, 8, 2, 8, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0,43521,43521, 0, 0, 0,43521,43521, 0, 0, 0, 0,43521,43521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 2, 8, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8,43521,43521, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2}, + { 8, 8, 2, 8, 2, 8, 2, 8, 2, 8, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0,43521,43521, 0, 0, 0,43521,43521, 0, 0, 0, 0,43521,43521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,62976,62976, 0, 0,43521,43521, 2, 8, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2}, + { 8, 8, 2, 8, 2, 8, 2, 8, 2, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 0, 0, 0,43521,43521, 0, 0, 0, 1,43521,43521, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2}, + { 8, 8, 2, 8, 2, 8, 2, 8, 2, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 0, 0, 0,43521,43521, 0, 0, 0, 0,43521,43521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,65024,65024, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2}, + { 8, 8, 2, 8, 2, 8, 2, 8, 2, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 0, 0, 0,43521,43521, 0, 0, 0, 0,43521,43521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,64768,64768, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,43521,43521, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2}, + { 8, 8, 2, 8, 2, 8, 2, 8, 2, 8, 0, 0, 0, 0,61440,61440, 0, 0, 0, 0,43521,43521, 0, 0, 0,43521,43521, 0, 0, 0, 0,43521,43521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 8,43521,43521, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2}, + { 8, 8, 2, 8, 2, 8, 2, 8, 2, 8, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0,43521,43521, 0, 0, 0, 1,43521,43521, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 8, 0, 0, 0, 8,43521,43521, 2, 0, 0, 0, 2, 8, 2, 8, 2, 8, 2, 8, 2}, + { 8, 8, 2, 8, 2, 8, 2, 8, 2, 8, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 0, 0, 2, 8, 0, 0, 0, 0,43521,43521, 0, 0, 0, 0, 2, 8, 2, 8, 2, 8, 2, 8, 2}, + { 8, 8, 2, 8, 2, 8, 2, 8, 2, 8, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 0, 0, 0, 0, 0,62720,62720, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 0, 0, 2, 8, 0, 0, 0, 0,43521,43521, 0, 0, 0, 0, 2, 8, 2, 8, 2, 8, 2, 8, 2}, + { 8, 8, 2, 8, 2, 8, 2, 8, 2, 8, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,43521,43521, 1, 0, 2, 8, 0, 0, 0, 0,43521,43521, 0, 0, 0, 0, 2, 8, 2, 8, 2, 8, 2, 8, 2}, + { 8, 8, 2, 8, 2, 8, 2, 8, 2, 8, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 0, 0, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + +int main() { + int startx=0, starty=0; + int x, y; + int dirx=0, diry=0; + int cptx=0, cpty=0; + int bgx=-32, bgy=-32; + float idperso=0; + int i; + float sinnonameno=0; + float camZ=1400.0f; + float a=0; + + GRRLIB_Init(); + GRRLIB_Settings.antialias = false; + PAD_Init(); + GRRLIB_ClipDrawing(0,0,rmode->fbWidth,rmode->efbHeight); + GRRLIB_texImg *tex_tile1 = GRRLIB_LoadTexture(tile1_png); + GRRLIB_InitTileSet(tex_tile1, TileMap1Width, TileMap1Height, 0); + GRRLIB_texImg *tex_perso = GRRLIB_LoadTexture(perso_png); + GRRLIB_InitTileSet(tex_perso, 64, 64, 0); + GRRLIB_texImg *tex_bg = GRRLIB_LoadTexture(bg_png); + GRRLIB_texImg *tex_nonameno = GRRLIB_LoadTexture(nonameno_png); + GRRLIB_InitTileSet(tex_nonameno, 32, 32, 0); + + GRRLIB_texImg *tex_screen = GRRLIB_CreateEmptyTexture(rmode->fbWidth, rmode->efbHeight); + + GRRLIB_SetBackgroundColour(0x00, 0x00, 0x00, 0xFF); + + while(1) { + GRRLIB_2dMode(); + PAD_ScanPads(); + if (PAD_ButtonsDown(0) & PAD_BUTTON_START) break; + if (PAD_ButtonsHeld(0) & PAD_BUTTON_X) camZ+=20.0f; + if (PAD_ButtonsHeld(0) & PAD_BUTTON_Y) camZ-=20.0f; + + if((dirx==0) && (diry==0)) { + if (PAD_ButtonsHeld(0) & PAD_BUTTON_DOWN) { diry=-4; idperso=15;} + else if (PAD_ButtonsHeld(0) & PAD_BUTTON_UP) { diry=4; idperso=15;} + else if (PAD_ButtonsHeld(0) & PAD_BUTTON_RIGHT) { dirx=-4; idperso=1;} + else if (PAD_ButtonsHeld(0) & PAD_BUTTON_LEFT) { dirx=4; idperso=8;} + } + + if((dirx==0) && (diry==0)) { + idperso=0; + } + + if(((Map1Info[9+starty][10+startx]==1) || (Map1Info[9+starty][11+startx]==1)) || ((Map1Info[9+starty][10+startx]==43521) || (Map1Info[9+starty][11+startx]==43521))) { + } + else{ + dirx=0; + diry=-4; + } + + if(dirx<0) { + if((Map1Info[7+starty][12+startx]==8) || (Map1Info[7+starty][12+startx]==2) || (Map1Info[8+starty][12+startx]==8) || (Map1Info[8+starty][12+startx]==2)) { + dirx=0; + } + else { + idperso++; + if(idperso>7) + idperso=1; + } + } + + if(dirx>0) { + if((Map1Info[7+starty][9+startx]==8) || (Map1Info[7+starty][9+startx]==2) || (Map1Info[8+starty][9+startx]==8) || (Map1Info[8+starty][9+startx]==2)) { + dirx=0; + } + else { + idperso++; + if(idperso>14) + idperso=8; + } + } + + if(diry<0) { + if((Map1Info[9+starty][10+startx]==1) || (Map1Info[9+starty][11+startx]==1)) { + diry=0; + } + } + + if(diry!=0) { + idperso++; + if(idperso>22) + idperso=16; + } + + cptx+=dirx; + if(dirx>0) + bgx++; + else if(dirx<0) + bgx--; + if((bgx>-1) || (bgx<-63)) + bgx=-32; + + if(cptx==32) { + cptx=0; + dirx=0; + startx--; + } + else if(cptx==-32) { + cptx=0; + dirx=0; + startx++; + } + + cpty+=diry; + if(diry>0) + bgy++; + else if(diry<0) + bgy--; + if((bgy>-1) ||(bgy<-63)) + bgy=-32; + + if(cpty==32) { + cpty=0; + diry=0; + starty--; + } + else if(cpty==-32) { + cpty=0; + if(((Map1Info[9+starty][10+startx]==1) || (Map1Info[9+starty][11+startx]==1)) || ((Map1Info[9+starty][10+startx]==43521) || (Map1Info[9+starty][11+startx]==43521))) { + diry=0; + } + starty++; + } + GRRLIB_DrawImg(bgx, bgy, tex_bg, 0, 1, 1, 0xFFFFFFFF); + + for(y=0; y<=17; y++) { + for(x=0; x<=21; x++) { + if(Map1Data[y+starty][x+startx] != 0) { + GRRLIB_DrawTile(x*TileMap1Width+cptx-TileMap1Width,y*TileMap1Height+cpty-TileMap1Height,tex_tile1,0,1,1,0xFFFFFFFF,Map1Data[y+starty][x+startx]-1); + } + } + } + GRRLIB_DrawTile(TileMap1Width*9,TileMap1Height*6,tex_perso,0,1,1,0xFFFFFFFF,(int)idperso); + + const float oldsinnonameno=sinnonameno; + for(i=0; i<8; i++) { + GRRLIB_DrawTile(TileMap1Width*(6+i),(TileMap1Height*10)+sin(sinnonameno)*64,tex_nonameno,0,1,1,0xFFFFFFFF,i); + sinnonameno+=0.4F; + } + sinnonameno=oldsinnonameno+0.08F; + + GRRLIB_Screen2Texture(0, 0, tex_screen, GX_TRUE); + + + GRRLIB_Camera3dSettings(0.0f,0.0f,camZ, 0,1,0, 0,0,0); + GRRLIB_3dMode(0.1,3000,45,1,0); + GRRLIB_SetTexture(tex_screen,0); + GRRLIB_ObjectView(0,0,0, a,a*2,a*3,1,1,1); + GX_Begin(GX_QUADS, GX_VTXFMT0, 16); + GX_Position3f32(-rmode->fbWidth/2,rmode->efbHeight/2,rmode->fbWidth/2); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,0.0f); + GX_Position3f32(rmode->fbWidth/2,rmode->efbHeight/2,rmode->fbWidth/2); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,0.0f); + GX_Position3f32(rmode->fbWidth/2,-rmode->efbHeight/2,rmode->fbWidth/2); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,1.0f); + GX_Position3f32(-rmode->fbWidth/2,-rmode->efbHeight/2,rmode->fbWidth/2); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,1.0f); + + GX_Position3f32(rmode->fbWidth/2,rmode->efbHeight/2,-rmode->fbWidth/2); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,0.0f); + GX_Position3f32(-rmode->fbWidth/2,rmode->efbHeight/2,-rmode->fbWidth/2); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,0.0f); + GX_Position3f32(-rmode->fbWidth/2,-rmode->efbHeight/2,-rmode->fbWidth/2); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,1.0f); + GX_Position3f32(rmode->fbWidth/2,-rmode->efbHeight/2,-rmode->fbWidth/2); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,1.0f); + + GX_Position3f32(rmode->fbWidth/2,rmode->efbHeight/2,rmode->fbWidth/2); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,0.0f); + GX_Position3f32(rmode->fbWidth/2,rmode->efbHeight/2,-rmode->fbWidth/2); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,0.0f); + GX_Position3f32(rmode->fbWidth/2,-rmode->efbHeight/2,-rmode->fbWidth/2); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,1.0f); + GX_Position3f32(rmode->fbWidth/2,-rmode->efbHeight/2,rmode->fbWidth/2); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,1.0f); + + GX_Position3f32(-rmode->fbWidth/2,rmode->efbHeight/2,-rmode->fbWidth/2); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,0.0f); + GX_Position3f32(-rmode->fbWidth/2,rmode->efbHeight/2,rmode->fbWidth/2); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,0.0f); + GX_Position3f32(-rmode->fbWidth/2,-rmode->efbHeight/2,rmode->fbWidth/2); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,1.0f); + GX_Position3f32(-rmode->fbWidth/2,-rmode->efbHeight/2,-rmode->fbWidth/2); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,1.0f); + GX_End(); + + a+=0.2f; + + GRRLIB_Render(); + } + + GRRLIB_FreeTexture(tex_tile1); + GRRLIB_FreeTexture(tex_perso); + GRRLIB_FreeTexture(tex_bg); + GRRLIB_FreeTexture(tex_nonameno); + GRRLIB_FreeTexture(tex_screen); + GRRLIB_Exit(); + exit(0); +} diff --git a/examples/gamecube/3D_Light1/Makefile b/examples/gamecube/3D_Light1/Makefile new file mode 100644 index 0000000..1a18e66 --- /dev/null +++ b/examples/gamecube/3D_Light1/Makefile @@ -0,0 +1,146 @@ +#--------------------------------------------------------------------------------- +# Clear the implicit built in rules +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- +ifeq ($(strip $(DEVKITPPC)),) +$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") +endif + +include $(DEVKITPPC)/gamecube_rules + +#--------------------------------------------------------------------------------- +# TARGET is the name of the output +# BUILD is the directory where object files & intermediate files will be placed +# SOURCES is a list of directories containing source code +# INCLUDES is a list of directories containing extra header files +#--------------------------------------------------------------------------------- +TARGET := $(notdir $(CURDIR)) +BUILD := build +SOURCES := source +DATA := data +INCLUDES := + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- + +CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) +CXXFLAGS = $(CFLAGS) + +LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -lgrrlib -lfreetype -lbz2 -lpngu -lpng -ljpeg -lz -lfat -logc -lm + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(CURDIR)/$(GRRLIB) $(PORTLIBS) + +#--------------------------------------------------------------------------------- +# no real need to edit anything past this point unless you need to add additional +# rules for different file extensions +#--------------------------------------------------------------------------------- +ifneq ($(BUILD),$(notdir $(CURDIR))) +#--------------------------------------------------------------------------------- + +export OUTPUT := $(CURDIR)/$(TARGET) + +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + +export DEPSDIR := $(CURDIR)/$(BUILD) + +#--------------------------------------------------------------------------------- +# automatically build a list of object files for our project +#--------------------------------------------------------------------------------- +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) +sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) + +#--------------------------------------------------------------------------------- +# use CXX for linking C++ projects, CC for standard C +#--------------------------------------------------------------------------------- +ifeq ($(strip $(CPPFILES)),) + export LD := $(CC) +else + export LD := $(CXX) +endif + +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o) +export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) + +export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) + +#--------------------------------------------------------------------------------- +# build a list of include paths +#--------------------------------------------------------------------------------- +export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) \ + -I$(LIBOGC_INC) + +#--------------------------------------------------------------------------------- +# build a list of library paths +#--------------------------------------------------------------------------------- +export LIBPATHS := -L$(LIBOGC_LIB) $(foreach dir,$(LIBDIRS),-L$(dir)/lib) + +export OUTPUT := $(CURDIR)/$(TARGET) +.PHONY: $(BUILD) clean + +#--------------------------------------------------------------------------------- +$(BUILD): + @[ -d $@ ] || mkdir -p $@ + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol + +#--------------------------------------------------------------------------------- +run: + wiiload $(TARGET).dol + + +#--------------------------------------------------------------------------------- +else + +DEPENDS := $(OFILES:.o=.d) + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- +$(OUTPUT).dol: $(OUTPUT).elf +$(OUTPUT).elf: $(OFILES) + +$(OFILES_SOURCES) : $(HFILES) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .jpg extension +#--------------------------------------------------------------------------------- +%.jpg.o : %.jpg +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .png extension +#--------------------------------------------------------------------------------- +%.png.o : %.png +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +-include $(DEPENDS) + +#--------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------- diff --git a/examples/gamecube/3D_Light1/data/Letter_Gothic_Std_14_Bold.png b/examples/gamecube/3D_Light1/data/Letter_Gothic_Std_14_Bold.png new file mode 100644 index 0000000..0561972 Binary files /dev/null and b/examples/gamecube/3D_Light1/data/Letter_Gothic_Std_14_Bold.png differ diff --git a/examples/gamecube/3D_Light1/source/main.c b/examples/gamecube/3D_Light1/source/main.c new file mode 100644 index 0000000..5497961 --- /dev/null +++ b/examples/gamecube/3D_Light1/source/main.c @@ -0,0 +1,86 @@ +/*=========================================== + NoNameNo + Simple Diffuse light sample code +============================================*/ +#include + +#include +#include +#include + + +#include "Letter_Gothic_Std_14_Bold_png.h" + +int main() { + float l1=0, l2=0; + float a=0; + int camZ=13.0f; + + GRRLIB_Init(); + PAD_Init(); + + + GRRLIB_texImg *tex_font = GRRLIB_LoadTexture(Letter_Gothic_Std_14_Bold_png); + GRRLIB_InitTileSet(tex_font, 11, 24, 32); + + + GRRLIB_Settings.antialias = true; + + GRRLIB_SetBackgroundColour(0x00, 0x00, 0x00, 0xFF); + + while(1) { + GRRLIB_2dMode(); + PAD_ScanPads(); + if(PAD_ButtonsDown(0) & PAD_BUTTON_START) break; + if(PAD_ButtonsHeld(0) & PAD_BUTTON_X) camZ++; + if(PAD_ButtonsHeld(0) & PAD_BUTTON_Y) camZ--; + + GRRLIB_Camera3dSettings(0.0f,0.0f,camZ, 0,1,0, 0,0,0); + GRRLIB_SetLightAmbient(0x333333FF); + + GRRLIB_3dMode(0.1, 1000, 45, 0, 1); + + if(PAD_ButtonsHeld(0) & PAD_BUTTON_A) { + // Set all light off to get the sphere no light sourced (only get the vertex color) + GRRLIB_SetLightOff(); + GRRLIB_ObjectView(sin(l1)*4.0f,0.0f,cos(l1)*4.0f, 0,0,0,1,1,1); + GRRLIB_DrawSphere(0.2f, 20, 20, true, 0xFF0000FF); + } + + if(PAD_ButtonsHeld(0) & PAD_BUTTON_B) { + // Set all light off to get the sphere no light sourced (only get the vertex color) + GRRLIB_SetLightOff(); + GRRLIB_ObjectView(0.0f,sin(l2)*4.0f,cos(l2)*4.0f, 0,0,0,1,1,1); + GRRLIB_DrawSphere(0.2f, 20, 20, true, 0x00FF00FF); + } + + // Set a dummy black light to get the ambient one when no light is selected + GRRLIB_SetLightDiff(0,(guVector){0.0f,0.0f,0.0f},20.0f,1.0f,0x000000FF); + + if(PAD_ButtonsHeld(0) & PAD_BUTTON_A) { + GRRLIB_SetLightDiff(0,(guVector){sin(l1)*4.0f,0.0f,cos(l1)*4.0f},20.0f,1.0f,0xFF0000FF); + l1+=0.03f; + } + + if(PAD_ButtonsHeld(0) & PAD_BUTTON_B) { + GRRLIB_SetLightDiff(1,(guVector){0.0f,sin(l2)*4.0f,cos(l2)*4.0f},20.0f,1.0f,0x00FF00FF); + l2+=0.05f; + } + + GRRLIB_ObjectView(0,0,0, a,a*2,a*3,1,1,1); + GRRLIB_DrawTorus(1, 2, 60, 60, true, 0xFFFFFFFF); + + a+=0.5f; + + // Switch to 2D Mode to display text + GRRLIB_2dMode(); + GRRLIB_Printf((640-(16*29))/2, 20, tex_font, 0xFFFFFFFF, 1, "PRESS Y OR X TO ZOOM"); + GRRLIB_Printf((640-(16*29))/2, 40, tex_font, 0xFFFFFFFF, 1, "HOLD A - RED / B - GREEN"); + + GRRLIB_Render(); + } + GRRLIB_FreeTexture(tex_font); + GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB + + exit(0); +} diff --git a/examples/gamecube/3D_Light2/Makefile b/examples/gamecube/3D_Light2/Makefile new file mode 100644 index 0000000..1a18e66 --- /dev/null +++ b/examples/gamecube/3D_Light2/Makefile @@ -0,0 +1,146 @@ +#--------------------------------------------------------------------------------- +# Clear the implicit built in rules +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- +ifeq ($(strip $(DEVKITPPC)),) +$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") +endif + +include $(DEVKITPPC)/gamecube_rules + +#--------------------------------------------------------------------------------- +# TARGET is the name of the output +# BUILD is the directory where object files & intermediate files will be placed +# SOURCES is a list of directories containing source code +# INCLUDES is a list of directories containing extra header files +#--------------------------------------------------------------------------------- +TARGET := $(notdir $(CURDIR)) +BUILD := build +SOURCES := source +DATA := data +INCLUDES := + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- + +CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) +CXXFLAGS = $(CFLAGS) + +LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -lgrrlib -lfreetype -lbz2 -lpngu -lpng -ljpeg -lz -lfat -logc -lm + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(CURDIR)/$(GRRLIB) $(PORTLIBS) + +#--------------------------------------------------------------------------------- +# no real need to edit anything past this point unless you need to add additional +# rules for different file extensions +#--------------------------------------------------------------------------------- +ifneq ($(BUILD),$(notdir $(CURDIR))) +#--------------------------------------------------------------------------------- + +export OUTPUT := $(CURDIR)/$(TARGET) + +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + +export DEPSDIR := $(CURDIR)/$(BUILD) + +#--------------------------------------------------------------------------------- +# automatically build a list of object files for our project +#--------------------------------------------------------------------------------- +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) +sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) + +#--------------------------------------------------------------------------------- +# use CXX for linking C++ projects, CC for standard C +#--------------------------------------------------------------------------------- +ifeq ($(strip $(CPPFILES)),) + export LD := $(CC) +else + export LD := $(CXX) +endif + +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o) +export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) + +export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) + +#--------------------------------------------------------------------------------- +# build a list of include paths +#--------------------------------------------------------------------------------- +export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) \ + -I$(LIBOGC_INC) + +#--------------------------------------------------------------------------------- +# build a list of library paths +#--------------------------------------------------------------------------------- +export LIBPATHS := -L$(LIBOGC_LIB) $(foreach dir,$(LIBDIRS),-L$(dir)/lib) + +export OUTPUT := $(CURDIR)/$(TARGET) +.PHONY: $(BUILD) clean + +#--------------------------------------------------------------------------------- +$(BUILD): + @[ -d $@ ] || mkdir -p $@ + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol + +#--------------------------------------------------------------------------------- +run: + wiiload $(TARGET).dol + + +#--------------------------------------------------------------------------------- +else + +DEPENDS := $(OFILES:.o=.d) + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- +$(OUTPUT).dol: $(OUTPUT).elf +$(OUTPUT).elf: $(OFILES) + +$(OFILES_SOURCES) : $(HFILES) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .jpg extension +#--------------------------------------------------------------------------------- +%.jpg.o : %.jpg +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .png extension +#--------------------------------------------------------------------------------- +%.png.o : %.png +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +-include $(DEPENDS) + +#--------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------- diff --git a/examples/gamecube/3D_Light2/data/Rockwell_Condensed_12_Bold.png b/examples/gamecube/3D_Light2/data/Rockwell_Condensed_12_Bold.png new file mode 100644 index 0000000..9a9f74f Binary files /dev/null and b/examples/gamecube/3D_Light2/data/Rockwell_Condensed_12_Bold.png differ diff --git a/examples/gamecube/3D_Light2/source/main.c b/examples/gamecube/3D_Light2/source/main.c new file mode 100644 index 0000000..111e65b --- /dev/null +++ b/examples/gamecube/3D_Light2/source/main.c @@ -0,0 +1,81 @@ +/*=========================================== + NoNameNo + Simple Lights and GRRLIB_ObjectViewInv sample +============================================*/ +#include + +#include +#include +#include +#include + +#include "Rockwell_Condensed_12_Bold_png.h" + + +int main() { + float a = 0; + float objscal = 0.5f; + int objqual = 20; + + GRRLIB_Init(); + PAD_Init(); + + GRRLIB_texImg *tex_font = GRRLIB_LoadTexture(Rockwell_Condensed_12_Bold_png); + GRRLIB_InitTileSet(tex_font, 12, 19, 32); + + + GRRLIB_Settings.antialias = true; + + GRRLIB_SetBackgroundColour(0x00, 0x00, 0x00, 0xFF); + + + while(1) { + GRRLIB_2dMode(); + PAD_ScanPads(); + if(PAD_ButtonsDown(0) & PAD_BUTTON_START) break; + + GRRLIB_Camera3dSettings(0.0f, 0.0f,13.0f, 0,1,0, 0,0,0); + + GRRLIB_SetLightAmbient(0x333333FF); + GRRLIB_SetLightDiff(0,(guVector){0.0f,0.0f,0.0f},20.0f,1.0f,0x00FFFFFF); + GRRLIB_SetLightDiff(1,(guVector){0.0f,13.0f,3.0f},20.0f,1.0f,0xFF00FFFF); + GRRLIB_SetLightDiff(2,(guVector){0.0f,-13.0f,3.0f},20.0f,1.0f,0xFFFF00FF); + GRRLIB_SetLightDiff(3,(guVector){13.0f,0.0f,3.0f},20.0f,1.0f,0xFF0000FF); + GRRLIB_SetLightDiff(4,(guVector){-13.0f,0.0f,3.0f},20.0f,1.0f,0x00FF00FF); + + GRRLIB_3dMode(0.1,1000,45,0,1); + + GRRLIB_ObjectViewInv(1.0f, -1.0f, 1.0f, a, a*2, a*3, 1.0f, 1.0f, 1.0f); + GRRLIB_DrawSphere(objscal,objqual,objqual,true,0xFFFFFFFF); + GRRLIB_ObjectViewInv(-1.0f, -1.0f, 1.0f, a, a*2, a*3, 1.0f, 1.0f, 1.0f); + GRRLIB_DrawSphere(objscal,objqual,objqual,true,0xFFFFFFFF); + GRRLIB_ObjectViewInv(1.0f, 1.0f, 1.0f, a, a*2, a*3, 1.0f, 1.0f, 1.0f); + GRRLIB_DrawSphere(objscal,objqual,objqual,true,0xFFFFFFFF); + GRRLIB_ObjectViewInv(-1.0f, 1.0f, 1.0f, a, a*2, a*3, 1.0f, 1.0f, 1.0f); + GRRLIB_DrawSphere(objscal,objqual,objqual,true,0xFFFFFFFF); + + GRRLIB_ObjectViewInv(1.0f, -1.0f, -1.0f, a, a*2, a*3, 1.0f, 1.0f, 1.0f); + GRRLIB_DrawSphere(objscal,objqual,objqual,true,0xFFFFFFFF); + GRRLIB_ObjectViewInv(-1.0f, -1.0f, -1.0f, a, a*2, a*3, 1.0f, 1.0f, 1.0f); + GRRLIB_DrawSphere(objscal,objqual,objqual,true,0xFFFFFFFF); + GRRLIB_ObjectViewInv(1.0f, 1.0f, -1.0f, a, a*2, a*3, 1.0f, 1.0f, 1.0f); + GRRLIB_DrawSphere(objscal,objqual,objqual,true,0xFFFFFFFF); + GRRLIB_ObjectViewInv(-1.0f, 1.0f, -1.0f, a, a*2, a*3, 1.0f, 1.0f, 1.0f); + GRRLIB_DrawSphere(objscal,objqual,objqual,true,0xFFFFFFFF); + + GRRLIB_ObjectView(0.0f, 0.0f, -1.0f, a, a*2, a*3, 1.0f, 1.0f, 1.0f); + GRRLIB_DrawCube(3.0, true, 0xFFFFFF44); + + a+=0.6f; + + // Switch To 2D Mode to display text + GRRLIB_2dMode(); + GRRLIB_Printf((640-(16*29))/2, 20, tex_font, 0xFFFFFFFF, 1, "LIGHT SAMPLE CODE 2"); + + GRRLIB_Render(); + } + GRRLIB_FreeTexture(tex_font); + GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB + + exit(0); +} diff --git a/examples/gamecube/3D_Light3/Makefile b/examples/gamecube/3D_Light3/Makefile new file mode 100644 index 0000000..1a18e66 --- /dev/null +++ b/examples/gamecube/3D_Light3/Makefile @@ -0,0 +1,146 @@ +#--------------------------------------------------------------------------------- +# Clear the implicit built in rules +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- +ifeq ($(strip $(DEVKITPPC)),) +$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") +endif + +include $(DEVKITPPC)/gamecube_rules + +#--------------------------------------------------------------------------------- +# TARGET is the name of the output +# BUILD is the directory where object files & intermediate files will be placed +# SOURCES is a list of directories containing source code +# INCLUDES is a list of directories containing extra header files +#--------------------------------------------------------------------------------- +TARGET := $(notdir $(CURDIR)) +BUILD := build +SOURCES := source +DATA := data +INCLUDES := + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- + +CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) +CXXFLAGS = $(CFLAGS) + +LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -lgrrlib -lfreetype -lbz2 -lpngu -lpng -ljpeg -lz -lfat -logc -lm + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(CURDIR)/$(GRRLIB) $(PORTLIBS) + +#--------------------------------------------------------------------------------- +# no real need to edit anything past this point unless you need to add additional +# rules for different file extensions +#--------------------------------------------------------------------------------- +ifneq ($(BUILD),$(notdir $(CURDIR))) +#--------------------------------------------------------------------------------- + +export OUTPUT := $(CURDIR)/$(TARGET) + +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + +export DEPSDIR := $(CURDIR)/$(BUILD) + +#--------------------------------------------------------------------------------- +# automatically build a list of object files for our project +#--------------------------------------------------------------------------------- +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) +sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) + +#--------------------------------------------------------------------------------- +# use CXX for linking C++ projects, CC for standard C +#--------------------------------------------------------------------------------- +ifeq ($(strip $(CPPFILES)),) + export LD := $(CC) +else + export LD := $(CXX) +endif + +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o) +export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) + +export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) + +#--------------------------------------------------------------------------------- +# build a list of include paths +#--------------------------------------------------------------------------------- +export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) \ + -I$(LIBOGC_INC) + +#--------------------------------------------------------------------------------- +# build a list of library paths +#--------------------------------------------------------------------------------- +export LIBPATHS := -L$(LIBOGC_LIB) $(foreach dir,$(LIBDIRS),-L$(dir)/lib) + +export OUTPUT := $(CURDIR)/$(TARGET) +.PHONY: $(BUILD) clean + +#--------------------------------------------------------------------------------- +$(BUILD): + @[ -d $@ ] || mkdir -p $@ + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol + +#--------------------------------------------------------------------------------- +run: + wiiload $(TARGET).dol + + +#--------------------------------------------------------------------------------- +else + +DEPENDS := $(OFILES:.o=.d) + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- +$(OUTPUT).dol: $(OUTPUT).elf +$(OUTPUT).elf: $(OFILES) + +$(OFILES_SOURCES) : $(HFILES) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .jpg extension +#--------------------------------------------------------------------------------- +%.jpg.o : %.jpg +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .png extension +#--------------------------------------------------------------------------------- +%.png.o : %.png +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +-include $(DEPENDS) + +#--------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------- diff --git a/examples/gamecube/3D_Light3/data/font9x12.png b/examples/gamecube/3D_Light3/data/font9x12.png new file mode 100644 index 0000000..c7de790 Binary files /dev/null and b/examples/gamecube/3D_Light3/data/font9x12.png differ diff --git a/examples/gamecube/3D_Light3/source/main.c b/examples/gamecube/3D_Light3/source/main.c new file mode 100644 index 0000000..102f703 --- /dev/null +++ b/examples/gamecube/3D_Light3/source/main.c @@ -0,0 +1,103 @@ +/*=========================================== + NoNameNo + + A little Specular light sample code +============================================*/ +#include + +#include +#include + +#include "font9x12_png.h" + + +int main() { + f32 rot = 0.0f; + float shininess = 10.0f; + + GRRLIB_Init(); + PAD_Init(); + + GRRLIB_texImg *tex_font = GRRLIB_LoadTexture(font9x12_png); + GRRLIB_InitTileSet(tex_font, 9, 12, 32); + + GRRLIB_Settings.antialias = true; + + GRRLIB_SetBackgroundColour(0x40, 0x40, 0x40, 0xFF); + + while(1) { + GRRLIB_Camera3dSettings(0.0f,0.0f,10.0f, 0,1,0, 0,0,0); + + PAD_ScanPads(); + + if(PAD_ButtonsDown(0) & PAD_BUTTON_START) break; + if(PAD_ButtonsHeld(0) & PAD_BUTTON_A) shininess+=1; + if(PAD_ButtonsHeld(0) & PAD_BUTTON_B) shininess-=1; + + GRRLIB_3dMode(0.1,1000,45,0,1); + + // dir param of GRRLIB_SetLightSpec function have to be a crazy 0,0,0 value + // there is a bug in libogc about this + // https://devkitpro.org/viewtopic.php?f=7&t=1933 + // we are waiting for a fix from libogc devs + GRRLIB_SetLightAmbient(0x404040FF); + GRRLIB_SetLightSpec(0, (guVector){0.0f,0.0f,0.0f}, shininess, 0xFFFFFFFF, 0xFFFFFFFF); + + GRRLIB_ObjectViewBegin(); + GRRLIB_ObjectViewTrans(0.0f,1.3f,0.0f); + GRRLIB_ObjectViewRotate(rot,rot*2,rot*3); + GRRLIB_ObjectViewEnd(); + GRRLIB_DrawCone(0.6f, 2.6f, 60,true, 0x502010FF); + + GRRLIB_ObjectViewBegin(); + GRRLIB_ObjectViewRotate(0.0f,0.0f,90.0f); + GRRLIB_ObjectViewTrans(-1.3f,0.0f,0.0f); + GRRLIB_ObjectViewRotate(rot,rot*2,rot*3); + GRRLIB_ObjectViewEnd(); + GRRLIB_DrawCone(0.6f, 2.6f, 60,true, 0x502010FF); + + GRRLIB_ObjectViewBegin(); + GRRLIB_ObjectViewRotate(0.0f,0.0f,180.0f); + GRRLIB_ObjectViewTrans(0.0f,-1.3f,0.0f); + GRRLIB_ObjectViewRotate(rot,rot*2,rot*3); + GRRLIB_ObjectViewEnd(); + GRRLIB_DrawCone(0.6f, 2.6f, 60,true, 0x502010FF); + + GRRLIB_ObjectViewBegin(); + GRRLIB_ObjectViewRotate(0.0f,0.0f,-90.0f); + GRRLIB_ObjectViewTrans(1.3f,0.0f,0.0f); + GRRLIB_ObjectViewRotate(rot,rot*2,rot*3); + GRRLIB_ObjectViewEnd(); + GRRLIB_DrawCone(0.6f, 2.6f, 60,true, 0x502010FF); + + GRRLIB_ObjectViewBegin(); + GRRLIB_ObjectViewRotate(-90.0f,0.0f,0.0f); + GRRLIB_ObjectViewTrans(0.0f,0.0f,-1.3f); + GRRLIB_ObjectViewRotate(rot,rot*2,rot*3); + GRRLIB_ObjectViewEnd(); + GRRLIB_DrawCone(0.6f, 2.6f, 60,true, 0x502010FF); + + GRRLIB_ObjectViewBegin(); + GRRLIB_ObjectViewRotate(90.0f,0.0f,0.0f); + GRRLIB_ObjectViewTrans(0.0f,0.0f,1.3f); + GRRLIB_ObjectViewRotate(rot,rot*2,rot*3); + GRRLIB_ObjectViewEnd(); + GRRLIB_DrawCone(0.6f, 2.6f, 60,true, 0x502010FF); + + GRRLIB_ObjectViewBegin(); + GRRLIB_ObjectViewRotate(rot,rot*2,rot*3); + GRRLIB_ObjectViewEnd(); + GRRLIB_DrawCube( 0.6f, true, 0x102050FF); + + + rot+=0.8f; + + GRRLIB_2dMode(); + GRRLIB_Printf(50, 60, tex_font, 0xFFFFFFFF, 1, "Use ( A / B ) to change the shininess value: %d", (int)shininess); + GRRLIB_Render(); + } + GRRLIB_FreeTexture(tex_font); + GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB + + exit(0); +} diff --git a/examples/gamecube/3D_Light4/Makefile b/examples/gamecube/3D_Light4/Makefile new file mode 100644 index 0000000..26d41a9 --- /dev/null +++ b/examples/gamecube/3D_Light4/Makefile @@ -0,0 +1,149 @@ +#--------------------------------------------------------------------------------- +# Clear the implicit built in rules +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- +ifeq ($(strip $(DEVKITPPC)),) +$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") +endif + +include $(DEVKITPPC)/gamecube_rules + +#--------------------------------------------------------------------------------- +# TARGET is the name of the output +# BUILD is the directory where object files & intermediate files will be placed +# SOURCES is a list of directories containing source code +# INCLUDES is a list of directories containing extra header files +#--------------------------------------------------------------------------------- +TARGET := $(notdir $(CURDIR)) +BUILD := build +SOURCES := source +DATA := data +INCLUDES := + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- + +CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) +CXXFLAGS = $(CFLAGS) + +LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +# the order can-be/is critical +#--------------------------------------------------------------------------------- +LIBS := -lgrrlib -lfreetype -lbz2 -lpngu -lpng -ljpeg -lz -lfat +#LIBS += -lmodplay -laesnd +LIBS += -logc -lm + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(PORTLIBS) + +#--------------------------------------------------------------------------------- +# no real need to edit anything past this point unless you need to add additional +# rules for different file extensions +#--------------------------------------------------------------------------------- +ifneq ($(BUILD),$(notdir $(CURDIR))) +#--------------------------------------------------------------------------------- + +export OUTPUT := $(CURDIR)/$(TARGET) + +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + +export DEPSDIR := $(CURDIR)/$(BUILD) + +#--------------------------------------------------------------------------------- +# automatically build a list of object files for our project +#--------------------------------------------------------------------------------- +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) +sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) + +#--------------------------------------------------------------------------------- +# use CXX for linking C++ projects, CC for standard C +#--------------------------------------------------------------------------------- +ifeq ($(strip $(CPPFILES)),) + export LD := $(CC) +else + export LD := $(CXX) +endif + +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o) +export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) + +export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) + +#--------------------------------------------------------------------------------- +# build a list of include paths +#--------------------------------------------------------------------------------- +export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) \ + -I$(LIBOGC_INC) + +#--------------------------------------------------------------------------------- +# build a list of library paths +#--------------------------------------------------------------------------------- +export LIBPATHS := -L$(LIBOGC_LIB) $(foreach dir,$(LIBDIRS),-L$(dir)/lib) + +export OUTPUT := $(CURDIR)/$(TARGET) +.PHONY: $(BUILD) clean + +#--------------------------------------------------------------------------------- +$(BUILD): + @[ -d $@ ] || mkdir -p $@ + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol + +#--------------------------------------------------------------------------------- +run: + wiiload $(TARGET).dol + + +#--------------------------------------------------------------------------------- +else + +DEPENDS := $(OFILES:.o=.d) + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- +$(OUTPUT).dol: $(OUTPUT).elf +$(OUTPUT).elf: $(OFILES) + +$(OFILES_SOURCES) : $(HFILES) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .jpg extension +#--------------------------------------------------------------------------------- +%.jpg.o : %.jpg +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .png extension +#--------------------------------------------------------------------------------- +%.png.o : %.png +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +-include $(DEPENDS) + +#--------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------- diff --git a/examples/gamecube/3D_Light4/data/Snap_ITC_12.png b/examples/gamecube/3D_Light4/data/Snap_ITC_12.png new file mode 100644 index 0000000..9e32b1b Binary files /dev/null and b/examples/gamecube/3D_Light4/data/Snap_ITC_12.png differ diff --git a/examples/gamecube/3D_Light4/source/main.c b/examples/gamecube/3D_Light4/source/main.c new file mode 100644 index 0000000..b3cc5de --- /dev/null +++ b/examples/gamecube/3D_Light4/source/main.c @@ -0,0 +1,54 @@ +/*=========================================== + GRRLIB + Spot Light Sample Code +============================================*/ +#include + +#include +#include +#include + +#include "Snap_ITC_12_png.h" + +int main(int argc, char **argv) { + f32 lightx=0.0f; + + GRRLIB_Init(); + + GRRLIB_texImg *tex_font = GRRLIB_LoadTexture(Snap_ITC_12_png); + GRRLIB_InitTileSet(tex_font, 17, 22, 32); + + PAD_Init(); + + GRRLIB_SetBackgroundColour(0x40, 0x40, 0x40, 0xFF); + + while(1) { + GRRLIB_2dMode(); + PAD_ScanPads(); + if (PAD_ButtonsDown(0) & PAD_BUTTON_START) break; + + GRRLIB_Camera3dSettings(0.0f,0.0f,3.0f, 0,1,0, 0,0,0); + + GRRLIB_SetLightAmbient(0x404040FF); + + GRRLIB_SetLightSpot(1, (guVector){ sin(lightx)*2.5f, 0.8f, 0 }, (guVector){ sin(lightx)*2.5f, 0.0f, 0.0f }, -4.0f, 5.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0x0000FFFF); + GRRLIB_SetLightSpot(2, (guVector){ -sin(lightx)*2.5f, 0.8f, 0 }, (guVector){ -sin(lightx)*2.5f, 0.0f, 0.0f }, -4.0f, 5.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0xFF0000FF); + + GRRLIB_3dMode(0.1,1000,45,0,1); + GRRLIB_ObjectView(0,-0.8,0, -90,0,0,1,1,1); + GRRLIB_DrawTessPanel(6.2f,0.17f,3.7f,0.1f,0,0xFFFFFFFF); + + lightx+=0.05f; + + GRRLIB_2dMode(); + GRRLIB_Printf((640-(17*26))/2, 480-25, tex_font, 0xFFFFFFFF, 1, "GRRLIB SPOT LIGHT SAMPLE 1"); + + + GRRLIB_Render(); + } + + GRRLIB_FreeTexture(tex_font); + GRRLIB_Exit(); + + exit(0); +} diff --git a/examples/gamecube/3D_sample1/Makefile b/examples/gamecube/3D_sample1/Makefile new file mode 100644 index 0000000..1a18e66 --- /dev/null +++ b/examples/gamecube/3D_sample1/Makefile @@ -0,0 +1,146 @@ +#--------------------------------------------------------------------------------- +# Clear the implicit built in rules +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- +ifeq ($(strip $(DEVKITPPC)),) +$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") +endif + +include $(DEVKITPPC)/gamecube_rules + +#--------------------------------------------------------------------------------- +# TARGET is the name of the output +# BUILD is the directory where object files & intermediate files will be placed +# SOURCES is a list of directories containing source code +# INCLUDES is a list of directories containing extra header files +#--------------------------------------------------------------------------------- +TARGET := $(notdir $(CURDIR)) +BUILD := build +SOURCES := source +DATA := data +INCLUDES := + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- + +CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) +CXXFLAGS = $(CFLAGS) + +LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -lgrrlib -lfreetype -lbz2 -lpngu -lpng -ljpeg -lz -lfat -logc -lm + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(CURDIR)/$(GRRLIB) $(PORTLIBS) + +#--------------------------------------------------------------------------------- +# no real need to edit anything past this point unless you need to add additional +# rules for different file extensions +#--------------------------------------------------------------------------------- +ifneq ($(BUILD),$(notdir $(CURDIR))) +#--------------------------------------------------------------------------------- + +export OUTPUT := $(CURDIR)/$(TARGET) + +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + +export DEPSDIR := $(CURDIR)/$(BUILD) + +#--------------------------------------------------------------------------------- +# automatically build a list of object files for our project +#--------------------------------------------------------------------------------- +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) +sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) + +#--------------------------------------------------------------------------------- +# use CXX for linking C++ projects, CC for standard C +#--------------------------------------------------------------------------------- +ifeq ($(strip $(CPPFILES)),) + export LD := $(CC) +else + export LD := $(CXX) +endif + +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o) +export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) + +export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) + +#--------------------------------------------------------------------------------- +# build a list of include paths +#--------------------------------------------------------------------------------- +export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) \ + -I$(LIBOGC_INC) + +#--------------------------------------------------------------------------------- +# build a list of library paths +#--------------------------------------------------------------------------------- +export LIBPATHS := -L$(LIBOGC_LIB) $(foreach dir,$(LIBDIRS),-L$(dir)/lib) + +export OUTPUT := $(CURDIR)/$(TARGET) +.PHONY: $(BUILD) clean + +#--------------------------------------------------------------------------------- +$(BUILD): + @[ -d $@ ] || mkdir -p $@ + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol + +#--------------------------------------------------------------------------------- +run: + wiiload $(TARGET).dol + + +#--------------------------------------------------------------------------------- +else + +DEPENDS := $(OFILES:.o=.d) + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- +$(OUTPUT).dol: $(OUTPUT).elf +$(OUTPUT).elf: $(OFILES) + +$(OFILES_SOURCES) : $(HFILES) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .jpg extension +#--------------------------------------------------------------------------------- +%.jpg.o : %.jpg +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .png extension +#--------------------------------------------------------------------------------- +%.png.o : %.png +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +-include $(DEPENDS) + +#--------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------- diff --git a/examples/gamecube/3D_sample1/data/font.png b/examples/gamecube/3D_sample1/data/font.png new file mode 100644 index 0000000..ac5131a Binary files /dev/null and b/examples/gamecube/3D_sample1/data/font.png differ diff --git a/examples/gamecube/3D_sample1/source/main.c b/examples/gamecube/3D_sample1/source/main.c new file mode 100644 index 0000000..810ea75 --- /dev/null +++ b/examples/gamecube/3D_sample1/source/main.c @@ -0,0 +1,106 @@ +/*=========================================== + NoNameNo + Simple Flat 3D cube +============================================*/ +#include + +#include +#include +#include +#include + +#include "font_png.h" + +int main() { + float a=0; + u32 col[3] = {0xFFFFFFFF, 0xAAAAAAFF, 0x666666FF}; + int cubeZ=0; + + GRRLIB_Init(); + PAD_Init(); + + GRRLIB_texImg *tex_font = GRRLIB_LoadTexture(font_png); + GRRLIB_InitTileSet(tex_font, 16, 16, 32); + + GRRLIB_Settings.antialias = true; + + GRRLIB_SetBackgroundColour(0x00, 0x00, 0x00, 0xFF); + GRRLIB_Camera3dSettings(0.0f,0.0f,13.0f, 0,1,0, 0,0,0); + + while(1) { + GRRLIB_2dMode(); + PAD_ScanPads(); + if(PAD_ButtonsDown(0) & PAD_BUTTON_START) exit(0); + if(PAD_ButtonsHeld(0) & PAD_BUTTON_A) cubeZ++; + if(PAD_ButtonsHeld(0) & PAD_BUTTON_B) cubeZ--; + + GRRLIB_3dMode(0.1,1000,45,0,0); + GRRLIB_ObjectView(0,0,cubeZ, a,a*2,a*3,1,1,1); + GX_Begin(GX_QUADS, GX_VTXFMT0, 24); + GX_Position3f32(-1.0f,1.0f,-1.0f); + GX_Color1u32(col[0]); + GX_Position3f32(-1.0f,-1.0f,-1.0f); + GX_Color1u32(col[0]); + GX_Position3f32(1.0f,-1.0f,-1.0f); + GX_Color1u32(col[0]); + GX_Position3f32(1.0f,1.0f,-1.0f); + GX_Color1u32(col[0]); + + GX_Position3f32(-1.0f,1.0f,1.0f); + GX_Color1u32(col[0]); + GX_Position3f32(-1.0f,-1.0f,1.0f); + GX_Color1u32(col[0]); + GX_Position3f32(1.0f,-1.0f,1.0f); + GX_Color1u32(col[0]); + GX_Position3f32(1.0f,1.0f,1.0f); + GX_Color1u32(col[0]); + + GX_Position3f32(-1.0f,1.0f,1.0f); + GX_Color1u32(col[1]); + GX_Position3f32(1.0f,1.0f,1.0f); + GX_Color1u32(col[1]); + GX_Position3f32(1.0f,1.0f,-1.0f); + GX_Color1u32(col[1]); + GX_Position3f32(-1.0f,1.0f,-1.0f); + GX_Color1u32(col[1]); + + GX_Position3f32(-1.0f,-1.0f,1.0f); + GX_Color1u32(col[1]); + GX_Position3f32(1.0f,-1.0f,1.0f); + GX_Color1u32(col[1]); + GX_Position3f32(1.0f,-1.0f,-1.0f); + GX_Color1u32(col[1]); + GX_Position3f32(-1.0f,-1.0f,-1.0f); + GX_Color1u32(col[1]); + + GX_Position3f32(-1.0f,1.0f,1.0f); + GX_Color1u32(col[2]); + GX_Position3f32(-1.0f,1.0f,-1.0f); + GX_Color1u32(col[2]); + GX_Position3f32(-1.0f,-1.0f,-1.0f); + GX_Color1u32(col[2]); + GX_Position3f32(-1.0f,-1.0f,1.0f); + GX_Color1u32(col[2]); + + GX_Position3f32(1.0f,1.0f,1.0f); + GX_Color1u32(col[2]); + GX_Position3f32(1.0f,1.0f,-1.0f); + GX_Color1u32(col[2]); + GX_Position3f32(1.0f,-1.0f,-1.0f); + GX_Color1u32(col[2]); + GX_Position3f32(1.0f,-1.0f,1.0f); + GX_Color1u32(col[2]); + GX_End(); + a+=0.5f; + + // Switch To 2D Mode to display text + GRRLIB_2dMode(); + GRRLIB_Printf((640-(16*29))/2, 20, tex_font, 0xFFFFFFFF, 1, "PRESS A OR B TO ZOOM THE CUBE"); + + GRRLIB_Render(); + } + GRRLIB_FreeTexture(tex_font); + GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB + + exit(0); +} diff --git a/examples/gamecube/3D_sample2/Makefile b/examples/gamecube/3D_sample2/Makefile new file mode 100644 index 0000000..1a18e66 --- /dev/null +++ b/examples/gamecube/3D_sample2/Makefile @@ -0,0 +1,146 @@ +#--------------------------------------------------------------------------------- +# Clear the implicit built in rules +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- +ifeq ($(strip $(DEVKITPPC)),) +$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") +endif + +include $(DEVKITPPC)/gamecube_rules + +#--------------------------------------------------------------------------------- +# TARGET is the name of the output +# BUILD is the directory where object files & intermediate files will be placed +# SOURCES is a list of directories containing source code +# INCLUDES is a list of directories containing extra header files +#--------------------------------------------------------------------------------- +TARGET := $(notdir $(CURDIR)) +BUILD := build +SOURCES := source +DATA := data +INCLUDES := + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- + +CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) +CXXFLAGS = $(CFLAGS) + +LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -lgrrlib -lfreetype -lbz2 -lpngu -lpng -ljpeg -lz -lfat -logc -lm + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(CURDIR)/$(GRRLIB) $(PORTLIBS) + +#--------------------------------------------------------------------------------- +# no real need to edit anything past this point unless you need to add additional +# rules for different file extensions +#--------------------------------------------------------------------------------- +ifneq ($(BUILD),$(notdir $(CURDIR))) +#--------------------------------------------------------------------------------- + +export OUTPUT := $(CURDIR)/$(TARGET) + +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + +export DEPSDIR := $(CURDIR)/$(BUILD) + +#--------------------------------------------------------------------------------- +# automatically build a list of object files for our project +#--------------------------------------------------------------------------------- +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) +sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) + +#--------------------------------------------------------------------------------- +# use CXX for linking C++ projects, CC for standard C +#--------------------------------------------------------------------------------- +ifeq ($(strip $(CPPFILES)),) + export LD := $(CC) +else + export LD := $(CXX) +endif + +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o) +export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) + +export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) + +#--------------------------------------------------------------------------------- +# build a list of include paths +#--------------------------------------------------------------------------------- +export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) \ + -I$(LIBOGC_INC) + +#--------------------------------------------------------------------------------- +# build a list of library paths +#--------------------------------------------------------------------------------- +export LIBPATHS := -L$(LIBOGC_LIB) $(foreach dir,$(LIBDIRS),-L$(dir)/lib) + +export OUTPUT := $(CURDIR)/$(TARGET) +.PHONY: $(BUILD) clean + +#--------------------------------------------------------------------------------- +$(BUILD): + @[ -d $@ ] || mkdir -p $@ + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol + +#--------------------------------------------------------------------------------- +run: + wiiload $(TARGET).dol + + +#--------------------------------------------------------------------------------- +else + +DEPENDS := $(OFILES:.o=.d) + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- +$(OUTPUT).dol: $(OUTPUT).elf +$(OUTPUT).elf: $(OFILES) + +$(OFILES_SOURCES) : $(HFILES) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .jpg extension +#--------------------------------------------------------------------------------- +%.jpg.o : %.jpg +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .png extension +#--------------------------------------------------------------------------------- +%.png.o : %.png +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +-include $(DEPENDS) + +#--------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------- diff --git a/examples/gamecube/3D_sample2/data/font.png b/examples/gamecube/3D_sample2/data/font.png new file mode 100644 index 0000000..ac5131a Binary files /dev/null and b/examples/gamecube/3D_sample2/data/font.png differ diff --git a/examples/gamecube/3D_sample2/data/girl.png b/examples/gamecube/3D_sample2/data/girl.png new file mode 100644 index 0000000..9758a2b Binary files /dev/null and b/examples/gamecube/3D_sample2/data/girl.png differ diff --git a/examples/gamecube/3D_sample2/source/main.c b/examples/gamecube/3D_sample2/source/main.c new file mode 100644 index 0000000..b2904b3 --- /dev/null +++ b/examples/gamecube/3D_sample2/source/main.c @@ -0,0 +1,136 @@ +/*=========================================== + NoNameNo + Simple Textured 3D cube +============================================*/ +#include + +#include +#include +#include +#include + + +#include "font_png.h" +#include "girl_png.h" + +int main() { + float a=0; + int cubeZ=0; + + GRRLIB_Init(); + PAD_Init(); + + GRRLIB_texImg *tex_girl= GRRLIB_LoadTexture(girl_png); + + GRRLIB_texImg *tex_font = GRRLIB_LoadTexture(font_png); + GRRLIB_InitTileSet(tex_font, 16, 16, 32); + + + GRRLIB_Settings.antialias = true; + + GRRLIB_SetBackgroundColour(0x00, 0x00, 0x00, 0xFF); + GRRLIB_Camera3dSettings(0.0f,0.0f,13.0f, 0,1,0, 0,0,0); + + while(1) { + GRRLIB_2dMode(); + PAD_ScanPads(); + if(PAD_ButtonsDown(0) & PAD_BUTTON_START) exit(0); + if(PAD_ButtonsHeld(0) & PAD_BUTTON_A) cubeZ++; + if(PAD_ButtonsHeld(0) & PAD_BUTTON_B) cubeZ--; + + GRRLIB_3dMode(0.1,1000,45,1,0); + GRRLIB_SetTexture(tex_girl,0); + GRRLIB_ObjectView(0,0,cubeZ, a,a*2,a*3,1,1,1); + GX_Begin(GX_QUADS, GX_VTXFMT0, 24); + GX_Position3f32(-1.0f,1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,0.0f); + GX_Position3f32(1.0f,1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,0.0f); + GX_Position3f32(1.0f,-1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,1.0f); + GX_Position3f32(-1.0f,-1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,1.0f); + + GX_Position3f32(1.0f,1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,0.0f); + GX_Position3f32(-1.0f,1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,0.0f); + GX_Position3f32(-1.0f,-1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,1.0f); + GX_Position3f32(1.0f,-1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,1.0f); + + GX_Position3f32(1.0f,1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,0.0f); + GX_Position3f32(1.0f,1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,0.0f); + GX_Position3f32(1.0f,-1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,1.0f); + GX_Position3f32(1.0f,-1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,1.0f); + + GX_Position3f32(-1.0f,1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,0.0f); + GX_Position3f32(-1.0f,1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,0.0f); + GX_Position3f32(-1.0f,-1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,1.0f); + GX_Position3f32(-1.0f,-1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,1.0f); + + GX_Position3f32(-1.0f,1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,0.0f); + GX_Position3f32(1.0f,1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,0.0f); + GX_Position3f32(1.0f,1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,1.0f); + GX_Position3f32(-1.0f,1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,1.0f); + + GX_Position3f32(1.0f,-1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,0.0f); + GX_Position3f32(-1.0f,-1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,0.0f); + GX_Position3f32(-1.0f,-1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,1.0f); + GX_Position3f32(1.0f,-1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,1.0f); + GX_End(); + a+=0.5f; + + // Switch To 2D Mode to display text + GRRLIB_2dMode(); + GRRLIB_Printf((640-(16*29))/2, 20, tex_font, 0xFFFFFFFF, 1, "PRESS A OR B TO ZOOM THE CUBE"); + + GRRLIB_Render(); + } + GRRLIB_FreeTexture(tex_girl); + GRRLIB_FreeTexture(tex_font); + GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB + + exit(0); +} diff --git a/examples/gamecube/3D_sample3/Makefile b/examples/gamecube/3D_sample3/Makefile new file mode 100644 index 0000000..1a18e66 --- /dev/null +++ b/examples/gamecube/3D_sample3/Makefile @@ -0,0 +1,146 @@ +#--------------------------------------------------------------------------------- +# Clear the implicit built in rules +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- +ifeq ($(strip $(DEVKITPPC)),) +$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") +endif + +include $(DEVKITPPC)/gamecube_rules + +#--------------------------------------------------------------------------------- +# TARGET is the name of the output +# BUILD is the directory where object files & intermediate files will be placed +# SOURCES is a list of directories containing source code +# INCLUDES is a list of directories containing extra header files +#--------------------------------------------------------------------------------- +TARGET := $(notdir $(CURDIR)) +BUILD := build +SOURCES := source +DATA := data +INCLUDES := + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- + +CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) +CXXFLAGS = $(CFLAGS) + +LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -lgrrlib -lfreetype -lbz2 -lpngu -lpng -ljpeg -lz -lfat -logc -lm + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(CURDIR)/$(GRRLIB) $(PORTLIBS) + +#--------------------------------------------------------------------------------- +# no real need to edit anything past this point unless you need to add additional +# rules for different file extensions +#--------------------------------------------------------------------------------- +ifneq ($(BUILD),$(notdir $(CURDIR))) +#--------------------------------------------------------------------------------- + +export OUTPUT := $(CURDIR)/$(TARGET) + +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + +export DEPSDIR := $(CURDIR)/$(BUILD) + +#--------------------------------------------------------------------------------- +# automatically build a list of object files for our project +#--------------------------------------------------------------------------------- +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) +sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) + +#--------------------------------------------------------------------------------- +# use CXX for linking C++ projects, CC for standard C +#--------------------------------------------------------------------------------- +ifeq ($(strip $(CPPFILES)),) + export LD := $(CC) +else + export LD := $(CXX) +endif + +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o) +export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) + +export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) + +#--------------------------------------------------------------------------------- +# build a list of include paths +#--------------------------------------------------------------------------------- +export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) \ + -I$(LIBOGC_INC) + +#--------------------------------------------------------------------------------- +# build a list of library paths +#--------------------------------------------------------------------------------- +export LIBPATHS := -L$(LIBOGC_LIB) $(foreach dir,$(LIBDIRS),-L$(dir)/lib) + +export OUTPUT := $(CURDIR)/$(TARGET) +.PHONY: $(BUILD) clean + +#--------------------------------------------------------------------------------- +$(BUILD): + @[ -d $@ ] || mkdir -p $@ + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol + +#--------------------------------------------------------------------------------- +run: + wiiload $(TARGET).dol + + +#--------------------------------------------------------------------------------- +else + +DEPENDS := $(OFILES:.o=.d) + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- +$(OUTPUT).dol: $(OUTPUT).elf +$(OUTPUT).elf: $(OFILES) + +$(OFILES_SOURCES) : $(HFILES) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .jpg extension +#--------------------------------------------------------------------------------- +%.jpg.o : %.jpg +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .png extension +#--------------------------------------------------------------------------------- +%.png.o : %.png +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +-include $(DEPENDS) + +#--------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------- diff --git a/examples/gamecube/3D_sample3/data/font.png b/examples/gamecube/3D_sample3/data/font.png new file mode 100644 index 0000000..ac5131a Binary files /dev/null and b/examples/gamecube/3D_sample3/data/font.png differ diff --git a/examples/gamecube/3D_sample3/data/girl.png b/examples/gamecube/3D_sample3/data/girl.png new file mode 100644 index 0000000..9758a2b Binary files /dev/null and b/examples/gamecube/3D_sample3/data/girl.png differ diff --git a/examples/gamecube/3D_sample3/source/main.c b/examples/gamecube/3D_sample3/source/main.c new file mode 100644 index 0000000..3cbfd2a --- /dev/null +++ b/examples/gamecube/3D_sample3/source/main.c @@ -0,0 +1,151 @@ +/*=========================================== + NoNameNo + Simple Textured 3D cube and Compositing + to make a nice sin wave on it ;) +============================================*/ +#include + +#include +#include +#include +#include + + +#include "font_png.h" +#include "girl_png.h" + + +int main() { + float a=0; + int cubeZ=5; + int i; + float sinx=0; + + GRRLIB_Init(); + PAD_Init(); + + GRRLIB_texImg *tex_screen = GRRLIB_CreateEmptyTexture(rmode->fbWidth,rmode->efbHeight); + GRRLIB_InitTileSet(tex_screen, rmode->fbWidth, 1, 0); + + GRRLIB_texImg *tex_girl= GRRLIB_LoadTexture(girl_png); + + GRRLIB_texImg *tex_font = GRRLIB_LoadTexture(font_png); + GRRLIB_InitTileSet(tex_font, 16, 16, 32); + + + GRRLIB_Settings.antialias = true; + + GRRLIB_SetBackgroundColour(0x00, 0x00, 0x00, 0xFF); + GRRLIB_Camera3dSettings(0.0f,0.0f,13.0f, 0,1,0, 0,0,0); + + while(1) { + GRRLIB_2dMode(); + PAD_ScanPads(); + if(PAD_ButtonsDown(0) & PAD_BUTTON_START) exit(0); + if(PAD_ButtonsHeld(0) & PAD_BUTTON_A) cubeZ++; + if(PAD_ButtonsHeld(0) & PAD_BUTTON_B) cubeZ--; + + GRRLIB_3dMode(0.1,1000,45,1,0); + GRRLIB_SetTexture(tex_girl,0); + GRRLIB_ObjectView(0,0,cubeZ, a,a*2,a*3,1,1,1); + GX_Begin(GX_QUADS, GX_VTXFMT0, 24); + GX_Position3f32(-1.0f,1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,0.0f); + GX_Position3f32(1.0f,1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,0.0f); + GX_Position3f32(1.0f,-1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,1.0f); + GX_Position3f32(-1.0f,-1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,1.0f); + + GX_Position3f32(1.0f,1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,0.0f); + GX_Position3f32(-1.0f,1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,0.0f); + GX_Position3f32(-1.0f,-1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,1.0f); + GX_Position3f32(1.0f,-1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,1.0f); + + GX_Position3f32(1.0f,1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,0.0f); + GX_Position3f32(1.0f,1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,0.0f); + GX_Position3f32(1.0f,-1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,1.0f); + GX_Position3f32(1.0f,-1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,1.0f); + + GX_Position3f32(-1.0f,1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,0.0f); + GX_Position3f32(-1.0f,1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,0.0f); + GX_Position3f32(-1.0f,-1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,1.0f); + GX_Position3f32(-1.0f,-1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,1.0f); + + GX_Position3f32(-1.0f,1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,0.0f); + GX_Position3f32(1.0f,1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,0.0f); + GX_Position3f32(1.0f,1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,1.0f); + GX_Position3f32(-1.0f,1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,1.0f); + + GX_Position3f32(1.0f,-1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,0.0f); + GX_Position3f32(-1.0f,-1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,0.0f); + GX_Position3f32(-1.0f,-1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,1.0f); + GX_Position3f32(1.0f,-1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,1.0f); + GX_End(); + GRRLIB_Screen2Texture(0,0,tex_screen,1); + a+=0.5f; + + // Switch To 2D Mode to display text + GRRLIB_2dMode(); + const float oldsinx=sinx; + for(i=0; iefbHeight; i++) { + GRRLIB_DrawTile(0+sin(sinx)*60,i,tex_screen,0,1,1,0xFFFFFFFF,i); + sinx+=0.02f; + } + sinx=oldsinx+0.02f; + + GRRLIB_Printf((640-(16*29))/2, 20, tex_font, 0xFFFFFFFF, 1, "PRESS A OR B TO ZOOM THE CUBE"); + + GRRLIB_Render(); + } + GRRLIB_FreeTexture(tex_girl); + GRRLIB_FreeTexture(tex_font); + GRRLIB_FreeTexture(tex_screen); + GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB + exit(0); +} diff --git a/examples/gamecube/3D_sample4/Makefile b/examples/gamecube/3D_sample4/Makefile new file mode 100644 index 0000000..91187dc --- /dev/null +++ b/examples/gamecube/3D_sample4/Makefile @@ -0,0 +1,146 @@ +#--------------------------------------------------------------------------------- +# Clear the implicit built in rules +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- +ifeq ($(strip $(DEVKITPPC)),) +$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") +endif + +include $(DEVKITPPC)/gamecube_rules + +#--------------------------------------------------------------------------------- +# TARGET is the name of the output +# BUILD is the directory where object files & intermediate files will be placed +# SOURCES is a list of directories containing source code +# INCLUDES is a list of directories containing extra header files +#--------------------------------------------------------------------------------- +TARGET := $(notdir $(CURDIR)) +BUILD := build +SOURCES := source source/gfx +DATA := data +INCLUDES := + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- + +CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) +CXXFLAGS = $(CFLAGS) + +LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -lgrrlib -lfreetype -lbz2 -lpngu -lpng -ljpeg -lz -lfat -logc -lm + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(CURDIR)/$(GRRLIB) $(PORTLIBS) + +#--------------------------------------------------------------------------------- +# no real need to edit anything past this point unless you need to add additional +# rules for different file extensions +#--------------------------------------------------------------------------------- +ifneq ($(BUILD),$(notdir $(CURDIR))) +#--------------------------------------------------------------------------------- + +export OUTPUT := $(CURDIR)/$(TARGET) + +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + +export DEPSDIR := $(CURDIR)/$(BUILD) + +#--------------------------------------------------------------------------------- +# automatically build a list of object files for our project +#--------------------------------------------------------------------------------- +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) +sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) + +#--------------------------------------------------------------------------------- +# use CXX for linking C++ projects, CC for standard C +#--------------------------------------------------------------------------------- +ifeq ($(strip $(CPPFILES)),) + export LD := $(CC) +else + export LD := $(CXX) +endif + +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o) +export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) + +export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) + +#--------------------------------------------------------------------------------- +# build a list of include paths +#--------------------------------------------------------------------------------- +export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) \ + -I$(LIBOGC_INC) + +#--------------------------------------------------------------------------------- +# build a list of library paths +#--------------------------------------------------------------------------------- +export LIBPATHS := -L$(LIBOGC_LIB) $(foreach dir,$(LIBDIRS),-L$(dir)/lib) + +export OUTPUT := $(CURDIR)/$(TARGET) +.PHONY: $(BUILD) clean + +#--------------------------------------------------------------------------------- +$(BUILD): + @[ -d $@ ] || mkdir -p $@ + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol + +#--------------------------------------------------------------------------------- +run: + wiiload $(TARGET).dol + + +#--------------------------------------------------------------------------------- +else + +DEPENDS := $(OFILES:.o=.d) + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- +$(OUTPUT).dol: $(OUTPUT).elf +$(OUTPUT).elf: $(OFILES) + +$(OFILES_SOURCES) : $(HFILES) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .jpg extension +#--------------------------------------------------------------------------------- +%.jpg.o : %.jpg +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .png extension +#--------------------------------------------------------------------------------- +%.png.o : %.png +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +-include $(DEPENDS) + +#--------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------- diff --git a/examples/gamecube/3D_sample4/source/gfx/logo.h b/examples/gamecube/3D_sample4/source/gfx/logo.h new file mode 100644 index 0000000..f2ad34d --- /dev/null +++ b/examples/gamecube/3D_sample4/source/gfx/logo.h @@ -0,0 +1,1997 @@ +int logoNbFace = 992; + + +guVector logoPos[]={{-22,3,-2}, +{-21,3,-2}, +{-21,4,-2}, +{-14,4,-2}, +{-14,2,-2}, +{-19,2,-2}, +{-19,-2,-2}, +{-17,-2,-2}, +{-17,-0.999999,-2}, +{-18,-1.000001,-2}, +{-17.999994,1,-2}, +{-14,1,-2}, +{-14,-3,-2}, +{-15,-3,-2}, +{-15,-4,-2}, +{-21,-4,-2}, +{-21,-3,-2}, +{-22,-3,-2}, +{-10,1,-2}, +{-9,1,-2}, +{-9,2,-2}, +{-10,2,-2}, +{-13,4,-2}, +{-13,-4,-2}, +{-10,-4,-2}, +{-10,-1,-2}, +{-9,-1,-2}, +{-9,-4,-2}, +{-6,-4,-2}, +{-6,0,-2}, +{-7,0,-2}, +{-7,1,-2}, +{-6,1,-2}, +{-6,3,-2}, +{-7,3,-2}, +{-7,4,-2}, +{-2,1,-2}, +{-1,1,-2}, +{-1,2,-2}, +{-2,2,-2}, +{-5,4,-2}, +{-5,-4,-2}, +{-2,-4,-2}, +{-2,-1,-2}, +{-1,-1,-2}, +{-1,-4,-2}, +{2,-4,-2}, +{2,0,-2}, +{1,0,-2}, +{1,1,-2}, +{2,1,-2}, +{2,3,-2}, +{1,3,-2}, +{1,4,-2}, +{3,4,-2}, +{3,-3,-2}, +{4,-3,-2}, +{4,-4,-2}, +{10,-4,-2}, +{10,-2,-2}, +{6,-2,-2}, +{6,4,-2}, +{11,-4,-2}, +{11,4,-2}, +{14,4,-2}, +{14,-4,-2}, +{18,-1,-2}, +{19,-1,-2}, +{19,-2,-2}, +{18,-2,-2}, +{18,2,-2}, +{19,2,-2}, +{19,1,-2}, +{18,1,-2}, +{15,4,-2}, +{15,-4,-2}, +{21,-4,-2}, +{21,-3,-2}, +{22,-3,-2}, +{22,0,-2}, +{21,0,-2}, +{21,1,-2}, +{22,1,-2}, +{22,3,-2}, +{21,3,-2}, +{21,4,-2}, +{-20.999615,4.999909,-2}, +{-13.999743,4.999909,-2}, +{-13.999743,3.999927,-2}, +{-12.999762,3.999927,-2}, +{-12.999762,4.999909,-2}, +{-6.999871,4.999909,-2}, +{-6.999871,3.999927,-2}, +{-4.999909,3.999927,-2}, +{-4.999909,4.999909,-2}, +{0.999982,4.999909,-2}, +{0.999982,3.999927,-2}, +{2.999945,3.999927,-2}, +{2.999945,4.999909,-2}, +{5.99989,4.999909,-2}, +{5.99989,3.999927,-2}, +{6.999871,3.999927,-2}, +{6.999871,-0.999982,-2}, +{9.999818,-0.999982,-2}, +{9.999818,3.999927,-2}, +{10.999798,3.999927,-2}, +{10.999798,4.999909,-2}, +{13.999743,4.999909,-2}, +{13.999743,3.999927,-2}, +{14.999724,3.999927,-2}, +{14.999724,4.999909,-2}, +{20.999615,4.999909,-2}, +{20.999615,3.999927,-2}, +{21.999596,3.999927,-2}, +{21.999596,2.999945,-2}, +{22.999578,2.999945,-2}, +{22.999578,0.999982,-2}, +{21.999596,0.999982,-2}, +{21.999596,0,-2}, +{22.999578,0,-2}, +{22.999578,-2.999945,-2}, +{21.999596,-2.999945,-2}, +{21.999596,-3.999927,-2}, +{20.999615,-3.999927,-2}, +{20.999615,-4.999909,-2}, +{14.999724,-4.999909,-2}, +{14.999724,-3.999927,-2}, +{13.999743,-3.999826,-2}, +{13.999743,-4.999909,-2}, +{10.999798,-4.999909,-2}, +{10.999798,-3.999927,-2}, +{9.999818,-3.999823,-2}, +{9.999818,-4.999909,-2}, +{3.999927,-4.999909,-2}, +{3.999927,-3.999927,-2}, +{1.999963,-3.999927,-2}, +{1.999963,-4.999909,-2}, +{-0.999982,-4.999909,-2}, +{-0.999982,-3.999927,-2}, +{-1.999963,-3.999927,-2}, +{-1.999963,-4.999909,-2}, +{-4.999909,-4.999909,-2}, +{-4.999909,-3.999927,-2}, +{-5.99989,-3.999927,-2}, +{-5.99989,-4.999909,-2}, +{-8.999835,-4.999909,-2}, +{-8.999835,-3.999927,-2}, +{-9.999818,-3.999927,-2}, +{-9.999818,-4.999909,-2}, +{-12.999762,-4.999909,-2}, +{-12.999762,-3.999927,-2}, +{-14.999724,-3.999927,-2}, +{-14.999724,-4.999909,-2}, +{-20.999615,-4.999909,-2}, +{-20.999615,-3.999927,-2}, +{-21.999596,-3.999927,-2}, +{-21.999596,-2.999945,-2}, +{-22.999578,-2.999945,-2}, +{-22.999578,2.999945,-2}, +{-21.999596,2.999945,-2}, +{-21.999596,3.999927,-2}, +{-20.999615,3.999927,-2}, +{-21,6,-2}, +{-14,6,-2}, +{-14,5,-2}, +{-13,5,-2}, +{-13,6,-2}, +{-7,6,-2}, +{-7,5,-2}, +{-5,5,-2}, +{-5,6,-2}, +{1,6,-2}, +{1,5,-2}, +{3,5,-2}, +{3,6,-2}, +{6,6,-2}, +{6,5,-2}, +{7,5,-2}, +{7,4,-2}, +{8,4,-2}, +{8,0,-2}, +{9,0,-2}, +{9,4,-2}, +{10,4,-2}, +{10,5,-2}, +{11,5,-2}, +{11,6,-2}, +{14,6,-2}, +{14,5,-2}, +{15,5,-2}, +{15,6,-2}, +{21,6,-2}, +{21,5,-2}, +{22,5,-2}, +{22,4,-2}, +{23,4,-2}, +{23,3,-2}, +{24,3,-2}, +{24,1,-2}, +{23,1,-2}, +{23,0,-2}, +{24,0,-2}, +{24,-3,-2}, +{23,-3,-2}, +{23,-4,-2}, +{22,-4,-2}, +{22,-5,-2}, +{21,-5,-2}, +{21,-6,-2}, +{15,-6,-2}, +{15,-5,-2}, +{14,-4.999899,-2}, +{14,-6,-2}, +{11,-6,-2}, +{11,-5,-2}, +{10,-4.999896,-2}, +{10,-6,-2}, +{4,-6,-2}, +{4,-5,-2}, +{2,-5,-2}, +{2,-6,-2}, +{-1,-6,-2}, +{-1,-5,-2}, +{-2,-5,-2}, +{-2,-6,-2}, +{-5,-6,-2}, +{-5,-5,-2}, +{-6,-5,-2}, +{-6,-6,-2}, +{-9,-6,-2}, +{-9,-5,-2}, +{-10,-5,-2}, +{-10,-6,-2}, +{-13,-6,-2}, +{-13,-5,-2}, +{-15,-5,-2}, +{-15,-6,-2}, +{-21,-6,-2}, +{-21,-5,-2}, +{-22,-5,-2}, +{-22,-4,-2}, +{-23,-4,-2}, +{-23,-3,-2}, +{-24,-3,-2}, +{-24,3,-2}, +{-23,3,-2}, +{-23,4,-2}, +{-22,4,-2}, +{-22,5,-2}, +{-21,5,-2}, +{-22,3,0}, +{-21,3,0}, +{-21,4,0}, +{-14,4,0}, +{-14,2,0}, +{-19,2,0}, +{-19,-2,0}, +{-17,-2,0}, +{-17,-0.999999,0}, +{-18,-1.000001,0}, +{-17.999994,1,0}, +{-14,1,0}, +{-14,-3,0}, +{-15,-3,0}, +{-15,-4,0}, +{-21,-4,0}, +{-21,-3,0}, +{-22,-3,0}, +{-10,1,0}, +{-9,1,0}, +{-9,2,0}, +{-10,2,0}, +{-13,4,0}, +{-13,-4,0}, +{-10,-4,0}, +{-10,-1,0}, +{-9,-1,0}, +{-9,-4,0}, +{-6,-4,0}, +{-6,0,0}, +{-7,0,0}, +{-7,1,0}, +{-6,1,0}, +{-6,3,0}, +{-7,3,0}, +{-7,4,0}, +{-2,1,0}, +{-1,1,0}, +{-1,2,0}, +{-2,2,0}, +{-5,4,0}, +{-5,-4,0}, +{-2,-4,0}, +{-2,-1,0}, +{-1,-1,0}, +{-1,-4,0}, +{2,-4,0}, +{2,0,0}, +{1,0,0}, +{1,1,0}, +{2,1,0}, +{2,3,0}, +{1,3,0}, +{1,4,0}, +{3,4,0}, +{3,-3,0}, +{4,-3,0}, +{4,-4,0}, +{10,-4,0}, +{10,-2,0}, +{6,-2,0}, +{6,4,0}, +{11,-4,0}, +{11,4,0}, +{14,4,0}, +{14,-4,0}, +{18,-1,0}, +{19,-1,0}, +{19,-2,0}, +{18,-2,0}, +{18,2,0}, +{19,2,0}, +{19,1,0}, +{18,1,0}, +{15,4,0}, +{15,-4,0}, +{21,-4,0}, +{21,-3,0}, +{22,-3,0}, +{22,0,0}, +{21,0,0}, +{21,1,0}, +{22,1,0}, +{22,3,0}, +{21,3,0}, +{21,4,0}, +{-20.999615,4.999909,0}, +{-13.999743,4.999909,0}, +{-13.999743,3.999927,0}, +{-12.999762,3.999927,0}, +{-12.999762,4.999909,0}, +{-6.999871,4.999909,0}, +{-6.999871,3.999927,0}, +{-4.999909,3.999927,0}, +{-4.999909,4.999909,0}, +{0.999982,4.999909,0}, +{0.999982,3.999927,0}, +{2.999945,3.999927,0}, +{2.999945,4.999909,0}, +{5.99989,4.999909,0}, +{5.99989,3.999927,0}, +{6.999871,3.999927,0}, +{6.999871,-0.999982,0}, +{9.999818,-0.999982,0}, +{9.999818,3.999927,0}, +{10.999798,3.999927,0}, +{10.999798,4.999909,0}, +{13.999743,4.999909,0}, +{13.999743,3.999927,0}, +{14.999724,3.999927,0}, +{14.999724,4.999909,0}, +{20.999615,4.999909,0}, +{20.999615,3.999927,0}, +{21.999596,3.999927,0}, +{21.999596,2.999945,0}, +{22.999578,2.999945,0}, +{22.999578,0.999982,0}, +{21.999596,0.999982,0}, +{21.999596,0,0}, +{22.999578,0,0}, +{22.999578,-2.999945,0}, +{21.999596,-2.999945,0}, +{21.999596,-3.999927,0}, +{20.999615,-3.999927,0}, +{20.999615,-4.999909,0}, +{14.999724,-4.999909,0}, +{14.999724,-3.999927,0}, +{13.999743,-3.999826,0}, +{13.999743,-4.999909,0}, +{10.999798,-4.999909,0}, +{10.999798,-3.999927,0}, +{9.999818,-3.999823,0}, +{9.999818,-4.999909,0}, +{3.999927,-4.999909,0}, +{3.999927,-3.999927,0}, +{1.999963,-3.999927,0}, +{1.999963,-4.999909,0}, +{-0.999982,-4.999909,0}, +{-0.999982,-3.999927,0}, +{-1.999963,-3.999927,0}, +{-1.999963,-4.999909,0}, +{-4.999909,-4.999909,0}, +{-4.999909,-3.999927,0}, +{-5.99989,-3.999927,0}, +{-5.99989,-4.999909,0}, +{-8.999835,-4.999909,0}, +{-8.999835,-3.999927,0}, +{-9.999818,-3.999927,0}, +{-9.999818,-4.999909,0}, +{-12.999762,-4.999909,0}, +{-12.999762,-3.999927,0}, +{-14.999724,-3.999927,0}, +{-14.999724,-4.999909,0}, +{-20.999615,-4.999909,0}, +{-20.999615,-3.999927,0}, +{-21.999596,-3.999927,0}, +{-21.999596,-2.999945,0}, +{-22.999578,-2.999945,0}, +{-22.999578,2.999945,0}, +{-21.999596,2.999945,0}, +{-21.999596,3.999927,0}, +{-20.999615,3.999927,0}, +{-21,6,0}, +{-14,6,0}, +{-14,5,0}, +{-13,5,0}, +{-13,6,0}, +{-7,6,0}, +{-7,5,0}, +{-5,5,0}, +{-5,6,0}, +{1,6,0}, +{1,5,0}, +{3,5,0}, +{3,6,0}, +{6,6,0}, +{6,5,0}, +{7,5,0}, +{7,4,0}, +{8,4,0}, +{8,0,0}, +{9,0,0}, +{9,4,0}, +{10,4,0}, +{10,5,0}, +{11,5,0}, +{11,6,0}, +{14,6,0}, +{14,5,0}, +{15,5,0}, +{15,6,0}, +{21,6,0}, +{21,5,0}, +{22,5,0}, +{22,4,0}, +{23,4,0}, +{23,3,0}, +{24,3,0}, +{24,1,0}, +{23,1,0}, +{23,0,0}, +{24,0,0}, +{24,-3,0}, +{23,-3,0}, +{23,-4,0}, +{22,-4,0}, +{22,-5,0}, +{21,-5,0}, +{21,-6,0}, +{15,-6,0}, +{15,-5,0}, +{14,-4.999899,0}, +{14,-6,0}, +{11,-6,0}, +{11,-5,0}, +{10,-4.999896,0}, +{10,-6,0}, +{4,-6,0}, +{4,-5,0}, +{2,-5,0}, +{2,-6,0}, +{-1,-6,0}, +{-1,-5,0}, +{-2,-5,0}, +{-2,-6,0}, +{-5,-6,0}, +{-5,-5,0}, +{-6,-5,0}, +{-6,-6,0}, +{-9,-6,0}, +{-9,-5,0}, +{-10,-5,0}, +{-10,-6,0}, +{-13,-6,0}, +{-13,-5,0}, +{-15,-5,0}, +{-15,-6,0}, +{-21,-6,0}, +{-21,-5,0}, +{-22,-5,0}, +{-22,-4,0}, +{-23,-4,0}, +{-23,-3,0}, +{-24,-3,0}, +{-24,3,0}, +{-23,3,0}, +{-23,4,0}, +{-22,4,0}, +{-22,5,0}, +{-21,5,0}, +{-20.999615,4.999909,0}, +{-13.999743,4.999909,0}, +{-13.999743,3.999927,0}, +{-12.999762,3.999927,0}, +{-12.999762,4.999909,0}, +{-6.999871,4.999909,0}, +{-6.999871,3.999927,0}, +{-4.999909,3.999927,0}, +{-4.999909,4.999909,0}, +{0.999982,4.999909,0}, +{0.999982,3.999927,0}, +{2.999945,3.999927,0}, +{2.999945,4.999909,0}, +{5.99989,4.999909,0}, +{5.99989,3.999927,0}, +{6.999871,3.999927,0}, +{6.999871,-0.999982,0}, +{9.999818,-0.999982,0}, +{9.999818,3.999927,0}, +{10.999798,3.999927,0}, +{10.999798,4.999909,0}, +{13.999743,4.999909,0}, +{13.999743,3.999927,0}, +{14.999724,3.999927,0}, +{14.999724,4.999909,0}, +{20.999615,4.999909,0}, +{20.999615,3.999927,0}, +{21.999596,3.999927,0}, +{21.999596,2.999945,0}, +{22.999578,2.999945,0}, +{22.999578,0.999982,0}, +{21.999596,0.999982,0}, +{21.999596,0,0}, +{22.999578,0,0}, +{22.999578,-2.999945,0}, +{21.999596,-2.999945,0}, +{21.999596,-3.999927,0}, +{20.999615,-3.999927,0}, +{20.999615,-4.999909,0}, +{14.999724,-4.999909,0}, +{14.999724,-3.999927,0}, +{13.999743,-3.999826,0}, +{13.999743,-4.999909,0}, +{10.999798,-4.999909,0}, +{10.999798,-3.999927,0}, +{9.999818,-3.999823,0}, +{9.999818,-4.999909,0}, +{3.999927,-4.999909,0}, +{3.999927,-3.999927,0}, +{1.999963,-3.999927,0}, +{1.999963,-4.999909,0}, +{-0.999982,-4.999909,0}, +{-0.999982,-3.999927,0}, +{-1.999963,-3.999927,0}, +{-1.999963,-4.999909,0}, +{-4.999909,-4.999909,0}, +{-4.999909,-3.999927,0}, +{-5.99989,-3.999927,0}, +{-5.99989,-4.999909,0}, +{-8.999835,-4.999909,0}, +{-8.999835,-3.999927,0}, +{-9.999818,-3.999927,0}, +{-9.999818,-4.999909,0}, +{-12.999762,-4.999909,0}, +{-12.999762,-3.999927,0}, +{-14.999724,-3.999927,0}, +{-14.999724,-4.999909,0}, +{-20.999615,-4.999909,0}, +{-20.999615,-3.999927,0}, +{-21.999596,-3.999927,0}, +{-21.999596,-2.999945,0}, +{-22.999578,-2.999945,0}, +{-22.999578,2.999945,0}, +{-21.999596,2.999945,0}, +{-21.999596,3.999927,0}, +{-20.999615,3.999927,0}, +{-21,6,0}, +{-14,6,0}, +{-14,5,0}, +{-13,5,0}, +{-13,6,0}, +{-7,6,0}, +{-7,5,0}, +{-5,5,0}, +{-5,6,0}, +{1,6,0}, +{1,5,0}, +{3,5,0}, +{3,6,0}, +{6,6,0}, +{6,5,0}, +{7,5,0}, +{7,4,0}, +{8,4,0}, +{8,0,0}, +{9,0,0}, +{9,4,0}, +{10,4,0}, +{10,5,0}, +{11,5,0}, +{11,6,0}, +{14,6,0}, +{14,5,0}, +{15,5,0}, +{15,6,0}, +{21,6,0}, +{21,5,0}, +{22,5,0}, +{22,4,0}, +{23,4,0}, +{23,3,0}, +{24,3,0}, +{24,1,0}, +{23,1,0}, +{23,0,0}, +{24,0,0}, +{24,-3,0}, +{23,-3,0}, +{23,-4,0}, +{22,-4,0}, +{22,-5,0}, +{21,-5,0}, +{21,-6,0}, +{15,-6,0}, +{15,-5,0}, +{14,-4.999899,0}, +{14,-6,0}, +{11,-6,0}, +{11,-5,0}, +{10,-4.999896,0}, +{10,-6,0}, +{4,-6,0}, +{4,-5,0}, +{2,-5,0}, +{2,-6,0}, +{-1,-6,0}, +{-1,-5,0}, +{-2,-5,0}, +{-2,-6,0}, +{-5,-6,0}, +{-5,-5,0}, +{-6,-5,0}, +{-6,-6,0}, +{-9,-6,0}, +{-9,-5,0}, +{-10,-5,0}, +{-10,-6,0}, +{-13,-6,0}, +{-13,-5,0}, +{-15,-5,0}, +{-15,-6,0}, +{-21,-6,0}, +{-21,-5,0}, +{-22,-5,0}, +{-22,-4,0}, +{-23,-4,0}, +{-23,-3,0}, +{-24,-3,0}, +{-24,3,0}, +{-23,3,0}, +{-23,4,0}, +{-22,4,0}, +{-22,5,0}, +{-21,5,0}, +{-20.999615,4.999909,-2}, +{-13.999743,4.999909,-2}, +{-13.999743,3.999927,-2}, +{-12.999762,3.999927,-2}, +{-12.999762,4.999909,-2}, +{-6.999871,4.999909,-2}, +{-6.999871,3.999927,-2}, +{-4.999909,3.999927,-2}, +{-4.999909,4.999909,-2}, +{0.999982,4.999909,-2}, +{0.999982,3.999927,-2}, +{2.999945,3.999927,-2}, +{2.999945,4.999909,-2}, +{5.99989,4.999909,-2}, +{5.99989,3.999927,-2}, +{6.999871,3.999927,-2}, +{6.999871,-0.999982,-2}, +{9.999818,-0.999982,-2}, +{9.999818,3.999927,-2}, +{10.999798,3.999927,-2}, +{10.999798,4.999909,-2}, +{13.999743,4.999909,-2}, +{13.999743,3.999927,-2}, +{14.999724,3.999927,-2}, +{14.999724,4.999909,-2}, +{20.999615,4.999909,-2}, +{20.999615,3.999927,-2}, +{21.999596,3.999927,-2}, +{21.999596,2.999945,-2}, +{22.999578,2.999945,-2}, +{22.999578,0.999982,-2}, +{21.999596,0.999982,-2}, +{21.999596,0,-2}, +{22.999578,0,-2}, +{22.999578,-2.999945,-2}, +{21.999596,-2.999945,-2}, +{21.999596,-3.999927,-2}, +{20.999615,-3.999927,-2}, +{20.999615,-4.999909,-2}, +{14.999724,-4.999909,-2}, +{14.999724,-3.999927,-2}, +{13.999743,-3.999826,-2}, +{13.999743,-4.999909,-2}, +{10.999798,-4.999909,-2}, +{10.999798,-3.999927,-2}, +{9.999818,-3.999823,-2}, +{9.999818,-4.999909,-2}, +{3.999927,-4.999909,-2}, +{3.999927,-3.999927,-2}, +{1.999963,-3.999927,-2}, +{1.999963,-4.999909,-2}, +{-0.999982,-4.999909,-2}, +{-0.999982,-3.999927,-2}, +{-1.999963,-3.999927,-2}, +{-1.999963,-4.999909,-2}, +{-4.999909,-4.999909,-2}, +{-4.999909,-3.999927,-2}, +{-5.99989,-3.999927,-2}, +{-5.99989,-4.999909,-2}, +{-8.999835,-4.999909,-2}, +{-8.999835,-3.999927,-2}, +{-9.999818,-3.999927,-2}, +{-9.999818,-4.999909,-2}, +{-12.999762,-4.999909,-2}, +{-12.999762,-3.999927,-2}, +{-14.999724,-3.999927,-2}, +{-14.999724,-4.999909,-2}, +{-20.999615,-4.999909,-2}, +{-20.999615,-3.999927,-2}, +{-21.999596,-3.999927,-2}, +{-21.999596,-2.999945,-2}, +{-22.999578,-2.999945,-2}, +{-22.999578,2.999945,-2}, +{-21.999596,2.999945,-2}, +{-21.999596,3.999927,-2}, +{-20.999615,3.999927,-2}, +{-21,6,-2}, +{-14,6,-2}, +{-14,5,-2}, +{-13,5,-2}, +{-13,6,-2}, +{-7,6,-2}, +{-7,5,-2}, +{-5,5,-2}, +{-5,6,-2}, +{1,6,-2}, +{1,5,-2}, +{3,5,-2}, +{3,6,-2}, +{6,6,-2}, +{6,5,-2}, +{7,5,-2}, +{7,4,-2}, +{8,4,-2}, +{8,0,-2}, +{9,0,-2}, +{9,4,-2}, +{10,4,-2}, +{10,5,-2}, +{11,5,-2}, +{11,6,-2}, +{14,6,-2}, +{14,5,-2}, +{15,5,-2}, +{15,6,-2}, +{21,6,-2}, +{21,5,-2}, +{22,5,-2}, +{22,4,-2}, +{23,4,-2}, +{23,3,-2}, +{24,3,-2}, +{24,1,-2}, +{23,1,-2}, +{23,0,-2}, +{24,0,-2}, +{24,-3,-2}, +{23,-3,-2}, +{23,-4,-2}, +{22,-4,-2}, +{22,-5,-2}, +{21,-5,-2}, +{21,-6,-2}, +{15,-6,-2}, +{15,-5,-2}, +{14,-4.999899,-2}, +{14,-6,-2}, +{11,-6,-2}, +{11,-5,-2}, +{10,-4.999896,-2}, +{10,-6,-2}, +{4,-6,-2}, +{4,-5,-2}, +{2,-5,-2}, +{2,-6,-2}, +{-1,-6,-2}, +{-1,-5,-2}, +{-2,-5,-2}, +{-2,-6,-2}, +{-5,-6,-2}, +{-5,-5,-2}, +{-6,-5,-2}, +{-6,-6,-2}, +{-9,-6,-2}, +{-9,-5,-2}, +{-10,-5,-2}, +{-10,-6,-2}, +{-13,-6,-2}, +{-13,-5,-2}, +{-15,-5,-2}, +{-15,-6,-2}, +{-21,-6,-2}, +{-21,-5,-2}, +{-22,-5,-2}, +{-22,-4,-2}, +{-23,-4,-2}, +{-23,-3,-2}, +{-24,-3,-2}, +{-24,3,-2}, +{-23,3,-2}, +{-23,4,-2}, +{-22,4,-2}, +{-22,5,-2}, +{-21,5,-2}, +{18,-1,0}, +{19,-1,0}, +{19,-2,0}, +{18,-2,0}, +{18,2,0}, +{19,2,0}, +{19,1,0}, +{18,1,0}, +{15,4,0}, +{15,-4,0}, +{21,-4,0}, +{21,-3,0}, +{22,-3,0}, +{22,0,0}, +{21,0,0}, +{21,1,0}, +{22,1,0}, +{22,3,0}, +{21,3,0}, +{21,4,0}, +{18,-1,-2}, +{19,-1,-2}, +{19,-2,-2}, +{18,-2,-2}, +{18,2,-2}, +{19,2,-2}, +{19,1,-2}, +{18,1,-2}, +{15,4,-2}, +{15,-4,-2}, +{21,-4,-2}, +{21,-3,-2}, +{22,-3,-2}, +{22,0,-2}, +{21,0,-2}, +{21,1,-2}, +{22,1,-2}, +{22,3,-2}, +{21,3,-2}, +{21,4,-2}, +{11,-4,0}, +{11,4,0}, +{14,4,0}, +{14,-4,0}, +{11,-4,-2}, +{11,4,-2}, +{14,4,-2}, +{14,-4,-2}, +{3,4,0}, +{3,-3,0}, +{4,-3,0}, +{4,-4,0}, +{10,-4,0}, +{10,-2,0}, +{6,-2,0}, +{6,4,0}, +{3,4,-2}, +{3,-3,-2}, +{4,-3,-2}, +{4,-4,-2}, +{10,-4,-2}, +{10,-2,-2}, +{6,-2,-2}, +{6,4,-2}, +{-2,1,0}, +{-1,1,0}, +{-1,2,0}, +{-2,2,0}, +{-5,4,0}, +{-5,-4,0}, +{-2,-4,0}, +{-2,-1,0}, +{-1,-1,0}, +{-1,-4,0}, +{2,-4,0}, +{2,0,0}, +{1,0,0}, +{1,1,0}, +{2,1,0}, +{2,3,0}, +{1,3,0}, +{1,4,0}, +{-2,1,-2}, +{-1,1,-2}, +{-1,2,-2}, +{-2,2,-2}, +{-5,4,-2}, +{-5,-4,-2}, +{-2,-4,-2}, +{-2,-1,-2}, +{-1,-1,-2}, +{-1,-4,-2}, +{2,-4,-2}, +{2,0,-2}, +{1,0,-2}, +{1,1,-2}, +{2,1,-2}, +{2,3,-2}, +{1,3,-2}, +{1,4,-2}, +{-10,1,0}, +{-9,1,0}, +{-9,2,0}, +{-10,2,0}, +{-13,4,0}, +{-13,-4,0}, +{-10,-4,0}, +{-10,-1,0}, +{-9,-1,0}, +{-9,-4,0}, +{-6,-4,0}, +{-6,0,0}, +{-7,0,0}, +{-7,1,0}, +{-6,1,0}, +{-6,3,0}, +{-7,3,0}, +{-7,4,0}, +{-10,1,-2}, +{-9,1,-2}, +{-9,2,-2}, +{-10,2,-2}, +{-13,4,-2}, +{-13,-4,-2}, +{-10,-4,-2}, +{-10,-1,-2}, +{-9,-1,-2}, +{-9,-4,-2}, +{-6,-4,-2}, +{-6,0,-2}, +{-7,0,-2}, +{-7,1,-2}, +{-6,1,-2}, +{-6,3,-2}, +{-7,3,-2}, +{-7,4,-2}, +{-22,3,0}, +{-21,3,0}, +{-21,4,0}, +{-14,4,0}, +{-14,2,0}, +{-19,2,0}, +{-19,-2,0}, +{-17,-2,0}, +{-17,-0.999999,0}, +{-18,-1.000001,0}, +{-17.999994,1,0}, +{-14,1,0}, +{-14,-3,0}, +{-15,-3,0}, +{-15,-4,0}, +{-21,-4,0}, +{-21,-3,0}, +{-22,-3,0}, +{-22,3,-2}, +{-21,3,-2}, +{-21,4,-2}, +{-14,4,-2}, +{-14,2,-2}, +{-19,2,-2}, +{-19,-2,-2}, +{-17,-2,-2}, +{-17,-0.999999,-2}, +{-18,-1.000001,-2}, +{-17.999994,1,-2}, +{-14,1,-2}, +{-14,-3,-2}, +{-15,-3,-2}, +{-15,-4,-2}, +{-21,-4,-2}, +{-21,-3,-2}, +{-22,-3,-2}}; + +int logoFac[][1]={{2},{17},{18}, +{1},{2},{18}, +{7},{16},{17}, +{2},{7},{17}, +{8},{15},{16}, +{7},{8},{16}, +{8},{14},{15}, +{12},{13},{14}, +{9},{12},{14}, +{8},{9},{14}, +{9},{11},{12}, +{9},{10},{11}, +{2},{6},{7}, +{4},{5},{6}, +{3},{4},{6}, +{2},{3},{6}, +{26},{24},{23}, +{19},{26},{23}, +{22},{19},{23}, +{36},{22},{23}, +{26},{25},{24}, +{20},{27},{26}, +{19},{20},{26}, +{29},{28},{27}, +{31},{29},{27}, +{20},{31},{27}, +{31},{30},{29}, +{20},{32},{31}, +{34},{33},{32}, +{35},{34},{32}, +{21},{35},{32}, +{20},{21},{32}, +{21},{36},{35}, +{21},{22},{36}, +{44},{42},{41}, +{37},{44},{41}, +{40},{37},{41}, +{54},{40},{41}, +{44},{43},{42}, +{38},{45},{44}, +{37},{38},{44}, +{47},{46},{45}, +{49},{47},{45}, +{38},{49},{45}, +{49},{48},{47}, +{38},{50},{49}, +{52},{51},{50}, +{53},{52},{50}, +{39},{53},{50}, +{38},{39},{50}, +{39},{54},{53}, +{39},{40},{54}, +{57},{56},{55}, +{61},{57},{55}, +{62},{61},{55}, +{61},{58},{57}, +{61},{59},{58}, +{61},{60},{59}, +{63},{65},{66}, +{63},{64},{65}, +{67},{76},{75}, +{74},{67},{75}, +{71},{74},{75}, +{86},{71},{75}, +{70},{77},{76}, +{67},{70},{76}, +{69},{78},{77}, +{70},{69},{77}, +{80},{79},{78}, +{81},{80},{78}, +{69},{81},{78}, +{73},{82},{81}, +{68},{73},{81}, +{69},{68},{81}, +{84},{83},{82}, +{85},{84},{82}, +{72},{85},{82}, +{73},{72},{82}, +{72},{86},{85}, +{72},{71},{86}, +{73},{68},{67}, +{74},{73},{67}, +{87},{162},{250}, +{163},{87},{250}, +{161},{249},{250}, +{162},{161},{250}, +{161},{248},{249}, +{161},{160},{248}, +{159},{247},{248}, +{160},{159},{248}, +{159},{246},{247}, +{158},{243},{246}, +{159},{158},{246}, +{244},{245},{246}, +{243},{244},{246}, +{158},{242},{243}, +{158},{241},{242}, +{156},{240},{241}, +{157},{156},{241}, +{158},{157},{241}, +{156},{239},{240}, +{154},{238},{239}, +{155},{154},{239}, +{156},{155},{239}, +{154},{237},{238}, +{154},{236},{237}, +{153},{235},{236}, +{154},{153},{236}, +{150},{234},{235}, +{151},{150},{235}, +{152},{151},{235}, +{153},{152},{235}, +{150},{233},{234}, +{150},{232},{233}, +{149},{231},{232}, +{150},{149},{232}, +{146},{230},{231}, +{147},{146},{231}, +{148},{147},{231}, +{149},{148},{231}, +{146},{229},{230}, +{146},{228},{229}, +{145},{227},{228}, +{146},{145},{228}, +{142},{226},{227}, +{145},{142},{227}, +{142},{225},{226}, +{142},{224},{225}, +{141},{223},{224}, +{142},{141},{224}, +{137},{222},{223}, +{138},{137},{223}, +{141},{138},{223}, +{137},{221},{222}, +{137},{220},{221}, +{134},{219},{220}, +{137},{134},{220}, +{133},{218},{219}, +{134},{133},{219}, +{133},{217},{218}, +{133},{216},{217}, +{130},{215},{216}, +{131},{130},{216}, +{132},{131},{216}, +{133},{132},{216}, +{129},{214},{215}, +{130},{129},{215}, +{129},{213},{214}, +{129},{212},{213}, +{126},{211},{212}, +{127},{126},{212}, +{128},{127},{212}, +{129},{128},{212}, +{125},{210},{211}, +{126},{125},{211}, +{125},{209},{210}, +{125},{208},{209}, +{123},{207},{208}, +{124},{123},{208}, +{125},{124},{208}, +{123},{206},{207}, +{121},{205},{206}, +{122},{121},{206}, +{123},{122},{206}, +{121},{204},{205}, +{201},{203},{204}, +{121},{201},{204}, +{201},{202},{203}, +{117},{200},{201}, +{120},{117},{201}, +{121},{120},{201}, +{197},{199},{200}, +{116},{197},{200}, +{117},{116},{200}, +{197},{198},{199}, +{116},{196},{197}, +{116},{195},{196}, +{114},{194},{195}, +{115},{114},{195}, +{116},{115},{195}, +{114},{193},{194}, +{112},{192},{193}, +{113},{112},{193}, +{114},{113},{193}, +{112},{191},{192}, +{112},{190},{191}, +{111},{189},{190}, +{112},{111},{190}, +{111},{110},{189}, +{108},{188},{189}, +{109},{108},{189}, +{110},{109},{189}, +{108},{187},{188}, +{108},{186},{187}, +{107},{185},{186}, +{108},{107},{186}, +{107},{184},{185}, +{107},{106},{184}, +{105},{183},{184}, +{106},{105},{184}, +{105},{182},{183}, +{105},{104},{182}, +{104},{181},{182}, +{102},{180},{181}, +{103},{102},{181}, +{104},{103},{181}, +{102},{179},{180}, +{102},{178},{179}, +{102},{177},{178}, +{100},{176},{177}, +{101},{100},{177}, +{102},{101},{177}, +{100},{175},{176}, +{100},{174},{175}, +{99},{173},{174}, +{100},{99},{174}, +{96},{172},{173}, +{99},{96},{173}, +{95},{171},{172}, +{96},{95},{172}, +{95},{170},{171}, +{95},{94},{170}, +{92},{169},{170}, +{93},{92},{170}, +{94},{93},{170}, +{91},{168},{169}, +{92},{91},{169}, +{91},{167},{168}, +{91},{166},{167}, +{91},{90},{166}, +{88},{165},{166}, +{89},{88},{166}, +{90},{89},{166}, +{87},{164},{165}, +{88},{87},{165}, +{87},{163},{164}, +{99},{97},{96}, +{99},{98},{97}, +{119},{118},{117}, +{120},{119},{117}, +{137},{135},{134}, +{137},{136},{135}, +{141},{139},{138}, +{141},{140},{139}, +{145},{143},{142}, +{145},{144},{143}, +{267},{252},{251}, +{268},{267},{251}, +{256},{253},{252}, +{267},{256},{252}, +{256},{254},{253}, +{256},{255},{254}, +{267},{257},{256}, +{265},{258},{257}, +{266},{265},{257}, +{267},{266},{257}, +{264},{259},{258}, +{265},{264},{258}, +{264},{262},{259}, +{261},{260},{259}, +{262},{261},{259}, +{264},{263},{262}, +{271},{285},{286}, +{272},{271},{286}, +{273},{272},{286}, +{283},{284},{285}, +{282},{283},{285}, +{271},{282},{285}, +{270},{281},{282}, +{271},{270},{282}, +{279},{280},{281}, +{277},{279},{281}, +{270},{277},{281}, +{277},{278},{279}, +{269},{276},{277}, +{270},{269},{277}, +{274},{275},{276}, +{269},{274},{276}, +{269},{273},{274}, +{269},{272},{273}, +{289},{303},{304}, +{290},{289},{304}, +{291},{290},{304}, +{301},{302},{303}, +{300},{301},{303}, +{289},{300},{303}, +{288},{299},{300}, +{289},{288},{300}, +{297},{298},{299}, +{295},{297},{299}, +{288},{295},{299}, +{295},{296},{297}, +{287},{294},{295}, +{288},{287},{295}, +{292},{293},{294}, +{287},{292},{294}, +{287},{291},{292}, +{287},{290},{291}, +{305},{311},{312}, +{309},{310},{311}, +{308},{309},{311}, +{307},{308},{311}, +{305},{307},{311}, +{305},{306},{307}, +{316},{314},{313}, +{316},{315},{314}, +{322},{335},{336}, +{321},{322},{336}, +{325},{321},{336}, +{333},{334},{335}, +{332},{333},{335}, +{322},{332},{335}, +{323},{331},{332}, +{322},{323},{332}, +{329},{330},{331}, +{328},{329},{331}, +{318},{328},{331}, +{323},{318},{331}, +{319},{327},{328}, +{318},{319},{328}, +{320},{326},{327}, +{319},{320},{327}, +{324},{325},{326}, +{317},{324},{326}, +{320},{317},{326}, +{324},{321},{325}, +{324},{317},{318}, +{323},{324},{318}, +{337},{414},{413}, +{500},{337},{413}, +{337},{415},{414}, +{338},{416},{415}, +{337},{338},{415}, +{341},{417},{416}, +{340},{341},{416}, +{339},{340},{416}, +{338},{339},{416}, +{341},{418},{417}, +{341},{419},{418}, +{342},{420},{419}, +{341},{342},{419}, +{345},{421},{420}, +{344},{345},{420}, +{343},{344},{420}, +{342},{343},{420}, +{345},{422},{421}, +{346},{423},{422}, +{345},{346},{422}, +{349},{424},{423}, +{346},{349},{423}, +{350},{425},{424}, +{349},{350},{424}, +{350},{426},{425}, +{350},{427},{426}, +{352},{428},{427}, +{351},{352},{427}, +{350},{351},{427}, +{352},{429},{428}, +{352},{430},{429}, +{352},{431},{430}, +{354},{432},{431}, +{353},{354},{431}, +{352},{353},{431}, +{355},{433},{432}, +{354},{355},{432}, +{355},{434},{433}, +{357},{435},{434}, +{356},{357},{434}, +{355},{356},{434}, +{357},{436},{435}, +{358},{437},{436}, +{357},{358},{436}, +{358},{438},{437}, +{358},{439},{438}, +{361},{440},{439}, +{360},{361},{439}, +{359},{360},{439}, +{358},{359},{439}, +{362},{441},{440}, +{361},{362},{440}, +{362},{442},{441}, +{362},{443},{442}, +{364},{444},{443}, +{363},{364},{443}, +{362},{363},{443}, +{364},{445},{444}, +{366},{446},{445}, +{365},{366},{445}, +{364},{365},{445}, +{366},{447},{446}, +{450},{448},{447}, +{366},{450},{447}, +{450},{449},{448}, +{367},{451},{450}, +{366},{367},{450}, +{454},{452},{451}, +{371},{454},{451}, +{370},{371},{451}, +{367},{370},{451}, +{454},{453},{452}, +{371},{455},{454}, +{371},{456},{455}, +{373},{457},{456}, +{372},{373},{456}, +{371},{372},{456}, +{373},{458},{457}, +{375},{459},{458}, +{374},{375},{458}, +{373},{374},{458}, +{375},{460},{459}, +{375},{461},{460}, +{376},{462},{461}, +{375},{376},{461}, +{376},{377},{462}, +{379},{463},{462}, +{378},{379},{462}, +{377},{378},{462}, +{379},{464},{463}, +{379},{465},{464}, +{380},{466},{465}, +{379},{380},{465}, +{380},{381},{466}, +{383},{467},{466}, +{382},{383},{466}, +{381},{382},{466}, +{383},{468},{467}, +{383},{469},{468}, +{384},{470},{469}, +{383},{384},{469}, +{387},{471},{470}, +{384},{387},{470}, +{387},{472},{471}, +{387},{473},{472}, +{387},{388},{473}, +{391},{474},{473}, +{388},{391},{473}, +{392},{475},{474}, +{391},{392},{474}, +{392},{476},{475}, +{392},{477},{476}, +{395},{478},{477}, +{392},{395},{477}, +{396},{479},{478}, +{395},{396},{478}, +{396},{480},{479}, +{396},{481},{480}, +{396},{397},{481}, +{399},{482},{481}, +{398},{399},{481}, +{397},{398},{481}, +{400},{483},{482}, +{399},{400},{482}, +{400},{484},{483}, +{400},{485},{484}, +{400},{401},{485}, +{403},{486},{485}, +{402},{403},{485}, +{401},{402},{485}, +{404},{487},{486}, +{403},{404},{486}, +{404},{488},{487}, +{404},{489},{488}, +{404},{405},{489}, +{406},{490},{489}, +{405},{406},{489}, +{406},{491},{490}, +{406},{407},{491}, +{408},{492},{491}, +{407},{408},{491}, +{408},{493},{492}, +{409},{496},{493}, +{408},{409},{493}, +{495},{494},{493}, +{496},{495},{493}, +{409},{497},{496}, +{409},{498},{497}, +{411},{499},{498}, +{410},{411},{498}, +{409},{410},{498}, +{411},{500},{499}, +{412},{337},{500}, +{411},{412},{500}, +{392},{394},{395}, +{392},{393},{394}, +{388},{390},{391}, +{388},{389},{390}, +{384},{386},{387}, +{384},{385},{386}, +{368},{369},{370}, +{367},{368},{370}, +{346},{348},{349}, +{346},{347},{348}, +{666},{502},{501}, +{667},{503},{502}, +{668},{504},{503}, +{669},{505},{504}, +{670},{506},{505}, +{671},{507},{506}, +{672},{508},{507}, +{673},{509},{508}, +{674},{510},{509}, +{675},{511},{510}, +{676},{512},{511}, +{677},{513},{512}, +{678},{514},{513}, +{679},{515},{514}, +{680},{516},{515}, +{681},{517},{516}, +{682},{518},{517}, +{683},{519},{518}, +{684},{520},{519}, +{685},{521},{520}, +{686},{522},{521}, +{687},{523},{522}, +{688},{524},{523}, +{689},{525},{524}, +{690},{526},{525}, +{691},{527},{526}, +{692},{528},{527}, +{693},{529},{528}, +{694},{530},{529}, +{695},{531},{530}, +{696},{532},{531}, +{697},{533},{532}, +{698},{534},{533}, +{699},{535},{534}, +{700},{536},{535}, +{701},{537},{536}, +{702},{538},{537}, +{703},{539},{538}, +{704},{540},{539}, +{705},{541},{540}, +{706},{542},{541}, +{707},{543},{542}, +{708},{544},{543}, +{709},{545},{544}, +{710},{546},{545}, +{711},{547},{546}, +{712},{548},{547}, +{713},{549},{548}, +{714},{550},{549}, +{715},{551},{550}, +{716},{552},{551}, +{717},{553},{552}, +{718},{554},{553}, +{719},{555},{554}, +{720},{556},{555}, +{721},{557},{556}, +{722},{558},{557}, +{723},{559},{558}, +{724},{560},{559}, +{725},{561},{560}, +{726},{562},{561}, +{727},{563},{562}, +{728},{564},{563}, +{729},{565},{564}, +{730},{566},{565}, +{731},{567},{566}, +{732},{568},{567}, +{733},{569},{568}, +{734},{570},{569}, +{735},{571},{570}, +{736},{572},{571}, +{737},{573},{572}, +{738},{574},{573}, +{739},{575},{574}, +{740},{576},{575}, +{665},{501},{576}, +{742},{741},{577}, +{743},{742},{578}, +{744},{743},{579}, +{745},{744},{580}, +{746},{745},{581}, +{747},{746},{582}, +{748},{747},{583}, +{749},{748},{584}, +{750},{749},{585}, +{751},{750},{586}, +{752},{751},{587}, +{753},{752},{588}, +{754},{753},{589}, +{755},{754},{590}, +{756},{755},{591}, +{757},{756},{592}, +{758},{757},{593}, +{759},{758},{594}, +{760},{759},{595}, +{761},{760},{596}, +{762},{761},{597}, +{763},{762},{598}, +{764},{763},{599}, +{765},{764},{600}, +{766},{765},{601}, +{767},{766},{602}, +{768},{767},{603}, +{769},{768},{604}, +{770},{769},{605}, +{771},{770},{606}, +{772},{771},{607}, +{773},{772},{608}, +{774},{773},{609}, +{775},{774},{610}, +{776},{775},{611}, +{777},{776},{612}, +{778},{777},{613}, +{779},{778},{614}, +{780},{779},{615}, +{781},{780},{616}, +{782},{781},{617}, +{783},{782},{618}, +{784},{783},{619}, +{785},{784},{620}, +{786},{785},{621}, +{787},{786},{622}, +{788},{787},{623}, +{789},{788},{624}, +{790},{789},{625}, +{791},{790},{626}, +{792},{791},{627}, +{793},{792},{628}, +{794},{793},{629}, +{795},{794},{630}, +{796},{795},{631}, +{797},{796},{632}, +{798},{797},{633}, +{799},{798},{634}, +{800},{799},{635}, +{801},{800},{636}, +{802},{801},{637}, +{803},{802},{638}, +{804},{803},{639}, +{805},{804},{640}, +{806},{805},{641}, +{807},{806},{642}, +{808},{807},{643}, +{809},{808},{644}, +{810},{809},{645}, +{811},{810},{646}, +{812},{811},{647}, +{813},{812},{648}, +{814},{813},{649}, +{815},{814},{650}, +{816},{815},{651}, +{817},{816},{652}, +{818},{817},{653}, +{819},{818},{654}, +{820},{819},{655}, +{821},{820},{656}, +{822},{821},{657}, +{823},{822},{658}, +{824},{823},{659}, +{825},{824},{660}, +{826},{825},{661}, +{827},{826},{662}, +{828},{827},{663}, +{741},{828},{664}, +{850},{830},{829}, +{851},{831},{830}, +{852},{832},{831}, +{849},{829},{832}, +{854},{834},{833}, +{855},{835},{834}, +{856},{836},{835}, +{853},{833},{836}, +{858},{838},{837}, +{859},{839},{838}, +{860},{840},{839}, +{861},{841},{840}, +{862},{842},{841}, +{863},{843},{842}, +{864},{844},{843}, +{865},{845},{844}, +{866},{846},{845}, +{867},{847},{846}, +{868},{848},{847}, +{857},{837},{848}, +{874},{873},{869}, +{875},{874},{870}, +{876},{875},{871}, +{873},{876},{872}, +{886},{878},{877}, +{887},{879},{878}, +{888},{880},{879}, +{889},{881},{880}, +{890},{882},{881}, +{891},{883},{882}, +{892},{884},{883}, +{885},{877},{884}, +{912},{911},{893}, +{913},{912},{894}, +{914},{913},{895}, +{911},{914},{896}, +{916},{898},{897}, +{917},{899},{898}, +{918},{900},{899}, +{919},{901},{900}, +{920},{902},{901}, +{921},{903},{902}, +{922},{904},{903}, +{923},{905},{904}, +{924},{906},{905}, +{925},{907},{906}, +{926},{908},{907}, +{927},{909},{908}, +{928},{910},{909}, +{915},{897},{910}, +{948},{947},{929}, +{949},{948},{930}, +{950},{949},{931}, +{947},{950},{932}, +{952},{934},{933}, +{953},{935},{934}, +{954},{936},{935}, +{955},{937},{936}, +{956},{938},{937}, +{957},{939},{938}, +{958},{940},{939}, +{959},{941},{940}, +{960},{942},{941}, +{961},{943},{942}, +{962},{944},{943}, +{963},{945},{944}, +{964},{946},{945}, +{951},{933},{946}, +{984},{983},{965}, +{985},{984},{966}, +{986},{985},{967}, +{987},{986},{968}, +{988},{987},{969}, +{989},{988},{970}, +{990},{989},{971}, +{991},{990},{972}, +{992},{991},{973}, +{993},{992},{974}, +{994},{993},{975}, +{995},{994},{976}, +{996},{995},{977}, +{997},{996},{978}, +{998},{997},{979}, +{999},{998},{980}, +{1000},{999},{981}, +{983},{1000},{982}, +{665},{666},{501}, +{666},{667},{502}, +{667},{668},{503}, +{668},{669},{504}, +{669},{670},{505}, +{670},{671},{506}, +{671},{672},{507}, +{672},{673},{508}, +{673},{674},{509}, +{674},{675},{510}, +{675},{676},{511}, +{676},{677},{512}, +{677},{678},{513}, +{678},{679},{514}, +{679},{680},{515}, +{680},{681},{516}, +{681},{682},{517}, +{682},{683},{518}, +{683},{684},{519}, +{684},{685},{520}, +{685},{686},{521}, +{686},{687},{522}, +{687},{688},{523}, +{688},{689},{524}, +{689},{690},{525}, +{690},{691},{526}, +{691},{692},{527}, +{692},{693},{528}, +{693},{694},{529}, +{694},{695},{530}, +{695},{696},{531}, +{696},{697},{532}, +{697},{698},{533}, +{698},{699},{534}, +{699},{700},{535}, +{700},{701},{536}, +{701},{702},{537}, +{702},{703},{538}, +{703},{704},{539}, +{704},{705},{540}, +{705},{706},{541}, +{706},{707},{542}, +{707},{708},{543}, +{708},{709},{544}, +{709},{710},{545}, +{710},{711},{546}, +{711},{712},{547}, +{712},{713},{548}, +{713},{714},{549}, +{714},{715},{550}, +{715},{716},{551}, +{716},{717},{552}, +{717},{718},{553}, +{718},{719},{554}, +{719},{720},{555}, +{720},{721},{556}, +{721},{722},{557}, +{722},{723},{558}, +{723},{724},{559}, +{724},{725},{560}, +{725},{726},{561}, +{726},{727},{562}, +{727},{728},{563}, +{728},{729},{564}, +{729},{730},{565}, +{730},{731},{566}, +{731},{732},{567}, +{732},{733},{568}, +{733},{734},{569}, +{734},{735},{570}, +{735},{736},{571}, +{736},{737},{572}, +{737},{738},{573}, +{738},{739},{574}, +{739},{740},{575}, +{740},{665},{576}, +{578},{742},{577}, +{579},{743},{578}, +{580},{744},{579}, +{581},{745},{580}, +{582},{746},{581}, +{583},{747},{582}, +{584},{748},{583}, +{585},{749},{584}, +{586},{750},{585}, +{587},{751},{586}, +{588},{752},{587}, +{589},{753},{588}, +{590},{754},{589}, +{591},{755},{590}, +{592},{756},{591}, +{593},{757},{592}, +{594},{758},{593}, +{595},{759},{594}, +{596},{760},{595}, +{597},{761},{596}, +{598},{762},{597}, +{599},{763},{598}, +{600},{764},{599}, +{601},{765},{600}, +{602},{766},{601}, +{603},{767},{602}, +{604},{768},{603}, +{605},{769},{604}, +{606},{770},{605}, +{607},{771},{606}, +{608},{772},{607}, +{609},{773},{608}, +{610},{774},{609}, +{611},{775},{610}, +{612},{776},{611}, +{613},{777},{612}, +{614},{778},{613}, +{615},{779},{614}, +{616},{780},{615}, +{617},{781},{616}, +{618},{782},{617}, +{619},{783},{618}, +{620},{784},{619}, +{621},{785},{620}, +{622},{786},{621}, +{623},{787},{622}, +{624},{788},{623}, +{625},{789},{624}, +{626},{790},{625}, +{627},{791},{626}, +{628},{792},{627}, +{629},{793},{628}, +{630},{794},{629}, +{631},{795},{630}, +{632},{796},{631}, +{633},{797},{632}, +{634},{798},{633}, +{635},{799},{634}, +{636},{800},{635}, +{637},{801},{636}, +{638},{802},{637}, +{639},{803},{638}, +{640},{804},{639}, +{641},{805},{640}, +{642},{806},{641}, +{643},{807},{642}, +{644},{808},{643}, +{645},{809},{644}, +{646},{810},{645}, +{647},{811},{646}, +{648},{812},{647}, +{649},{813},{648}, +{650},{814},{649}, +{651},{815},{650}, +{652},{816},{651}, +{653},{817},{652}, +{654},{818},{653}, +{655},{819},{654}, +{656},{820},{655}, +{657},{821},{656}, +{658},{822},{657}, +{659},{823},{658}, +{660},{824},{659}, +{661},{825},{660}, +{662},{826},{661}, +{663},{827},{662}, +{664},{828},{663}, +{577},{741},{664}, +{849},{850},{829}, +{850},{851},{830}, +{851},{852},{831}, +{852},{849},{832}, +{853},{854},{833}, +{854},{855},{834}, +{855},{856},{835}, +{856},{853},{836}, +{857},{858},{837}, +{858},{859},{838}, +{859},{860},{839}, +{860},{861},{840}, +{861},{862},{841}, +{862},{863},{842}, +{863},{864},{843}, +{864},{865},{844}, +{865},{866},{845}, +{866},{867},{846}, +{867},{868},{847}, +{868},{857},{848}, +{870},{874},{869}, +{871},{875},{870}, +{872},{876},{871}, +{869},{873},{872}, +{885},{886},{877}, +{886},{887},{878}, +{887},{888},{879}, +{888},{889},{880}, +{889},{890},{881}, +{890},{891},{882}, +{891},{892},{883}, +{892},{885},{884}, +{894},{912},{893}, +{895},{913},{894}, +{896},{914},{895}, +{893},{911},{896}, +{915},{916},{897}, +{916},{917},{898}, +{917},{918},{899}, +{918},{919},{900}, +{919},{920},{901}, +{920},{921},{902}, +{921},{922},{903}, +{922},{923},{904}, +{923},{924},{905}, +{924},{925},{906}, +{925},{926},{907}, +{926},{927},{908}, +{927},{928},{909}, +{928},{915},{910}, +{930},{948},{929}, +{931},{949},{930}, +{932},{950},{931}, +{929},{947},{932}, +{951},{952},{933}, +{952},{953},{934}, +{953},{954},{935}, +{954},{955},{936}, +{955},{956},{937}, +{956},{957},{938}, +{957},{958},{939}, +{958},{959},{940}, +{959},{960},{941}, +{960},{961},{942}, +{961},{962},{943}, +{962},{963},{944}, +{963},{964},{945}, +{964},{951},{946}, +{966},{984},{965}, +{967},{985},{966}, +{968},{986},{967}, +{969},{987},{968}, +{970},{988},{969}, +{971},{989},{970}, +{972},{990},{971}, +{973},{991},{972}, +{974},{992},{973}, +{975},{993},{974}, +{976},{994},{975}, +{977},{995},{976}, +{978},{996},{977}, +{979},{997},{978}, +{980},{998},{979}, +{981},{999},{980}, +{982},{1000},{981}, +{965},{983},{982}}; + diff --git a/examples/gamecube/3D_sample4/source/main.c b/examples/gamecube/3D_sample4/source/main.c new file mode 100644 index 0000000..41584e7 --- /dev/null +++ b/examples/gamecube/3D_sample4/source/main.c @@ -0,0 +1,61 @@ +/*=========================================== + NoNameNo Simple 3D object rotating ;) + object have to be triangulated to be used + with this source. +============================================*/ +#include + +#include +#include +#include +#include + +#include "gfx/logo.h" + +int main() { + int i; + float a=0; + u32 col; + + GRRLIB_Init(); + PAD_Init(); + + GRRLIB_Settings.antialias = true; + + + GRRLIB_SetBackgroundColour(0x00, 0x00, 0x00, 0xFF); + GRRLIB_Camera3dSettings(0.0f,0.0f,13.0f, 0,1,0, 0,0,0); + + while(1) { + GRRLIB_2dMode(); + PAD_ScanPads(); + if(PAD_ButtonsDown(0) & PAD_BUTTON_START) exit(0); + + + GRRLIB_3dMode(0.1,1000,45,0,0); + GRRLIB_ObjectView(0,0,-30, a,a*2,a*3,1,1,1); + GX_Begin(GX_TRIANGLES, GX_VTXFMT0, logoNbFace * 3); + for(i=0; idevkitPPC") +endif + +include $(DEVKITPPC)/gamecube_rules + +#--------------------------------------------------------------------------------- +# TARGET is the name of the output +# BUILD is the directory where object files & intermediate files will be placed +# SOURCES is a list of directories containing source code +# INCLUDES is a list of directories containing extra header files +#--------------------------------------------------------------------------------- +TARGET := $(notdir $(CURDIR)) +BUILD := build +SOURCES := source +DATA := data +INCLUDES := + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- + +CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) +CXXFLAGS = $(CFLAGS) + +LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -lgrrlib -lfreetype -lbz2 -lpngu -lpng -ljpeg -lz -lfat -logc -lm + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(CURDIR)/$(GRRLIB) $(PORTLIBS) + +#--------------------------------------------------------------------------------- +# no real need to edit anything past this point unless you need to add additional +# rules for different file extensions +#--------------------------------------------------------------------------------- +ifneq ($(BUILD),$(notdir $(CURDIR))) +#--------------------------------------------------------------------------------- + +export OUTPUT := $(CURDIR)/$(TARGET) + +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + +export DEPSDIR := $(CURDIR)/$(BUILD) + +#--------------------------------------------------------------------------------- +# automatically build a list of object files for our project +#--------------------------------------------------------------------------------- +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) +sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) + +#--------------------------------------------------------------------------------- +# use CXX for linking C++ projects, CC for standard C +#--------------------------------------------------------------------------------- +ifeq ($(strip $(CPPFILES)),) + export LD := $(CC) +else + export LD := $(CXX) +endif + +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o) +export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) + +export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) + +#--------------------------------------------------------------------------------- +# build a list of include paths +#--------------------------------------------------------------------------------- +export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) \ + -I$(LIBOGC_INC) + +#--------------------------------------------------------------------------------- +# build a list of library paths +#--------------------------------------------------------------------------------- +export LIBPATHS := -L$(LIBOGC_LIB) $(foreach dir,$(LIBDIRS),-L$(dir)/lib) + +export OUTPUT := $(CURDIR)/$(TARGET) +.PHONY: $(BUILD) clean + +#--------------------------------------------------------------------------------- +$(BUILD): + @[ -d $@ ] || mkdir -p $@ + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol + +#--------------------------------------------------------------------------------- +run: + wiiload $(TARGET).dol + + +#--------------------------------------------------------------------------------- +else + +DEPENDS := $(OFILES:.o=.d) + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- +$(OUTPUT).dol: $(OUTPUT).elf +$(OUTPUT).elf: $(OFILES) + +$(OFILES_SOURCES) : $(HFILES) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .jpg extension +#--------------------------------------------------------------------------------- +%.jpg.o : %.jpg +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .png extension +#--------------------------------------------------------------------------------- +%.png.o : %.png +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +-include $(DEPENDS) + +#--------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------- diff --git a/examples/gamecube/3D_sample5/data/font.png b/examples/gamecube/3D_sample5/data/font.png new file mode 100644 index 0000000..ac5131a Binary files /dev/null and b/examples/gamecube/3D_sample5/data/font.png differ diff --git a/examples/gamecube/3D_sample5/source/main.c b/examples/gamecube/3D_sample5/source/main.c new file mode 100644 index 0000000..de10149 --- /dev/null +++ b/examples/gamecube/3D_sample5/source/main.c @@ -0,0 +1,103 @@ +/*=========================================== + NoNameNo + Simple Flat 3D cube +============================================*/ +#include + +#include +#include +#include +#include + +#include "font_png.h" + +int main(void){ + f32 a = 0; + f32 offset = 1.5f; + f32 rotpas = 60.0f; + + GRRLIB_Init(); + PAD_Init(); + + GRRLIB_texImg *tex_font = GRRLIB_LoadTexture(font_png); + GRRLIB_InitTileSet(tex_font, 16, 16, 32); + + GRRLIB_Settings.antialias = true; + + GRRLIB_SetBackgroundColour(0x00, 0x00, 0x00, 0xFF); + GRRLIB_Camera3dSettings(0.0f,0.0f,5.0f, 0,1,0, 0,0,0); + + + while(1) { + GRRLIB_2dMode(); + PAD_ScanPads(); + if(PAD_ButtonsDown(0) & PAD_BUTTON_START) exit(0); + + + GRRLIB_3dMode(0.1,1000,45,0,1); + GRRLIB_SetLightAmbient(0x111111FF); + GRRLIB_SetLightDiff(0,(guVector){0.0f,3.0f,3.0f},20.0f,1.0f,0xFFFFFFFF); + + + GRRLIB_ObjectViewBegin(); + GRRLIB_ObjectViewRotate(0,a*3,0); + GRRLIB_ObjectViewTrans(0,offset,0); + GRRLIB_ObjectViewRotate(a,a*3,a*2+0*rotpas); + GRRLIB_ObjectViewEnd(); + GRRLIB_DrawCube(0.8f,1,0xFFFFFFFF); + + GRRLIB_ObjectViewBegin(); + GRRLIB_ObjectViewRotate(0,a*3,0); + GRRLIB_ObjectViewTrans(0,offset,0); + GRRLIB_ObjectViewRotate(a,a*3,a*2+1*rotpas); + GRRLIB_ObjectViewEnd(); + GRRLIB_DrawCube(0.8f,1,0xFFFFFFFF); + + GRRLIB_ObjectViewBegin(); + GRRLIB_ObjectViewRotate(0,a*3,0); + GRRLIB_ObjectViewTrans(0,offset,0); + GRRLIB_ObjectViewRotate(a,a*3,a*2+2*rotpas); + GRRLIB_ObjectViewEnd(); + GRRLIB_DrawCube(0.8f,1,0xFFFFFFFF); + + GRRLIB_ObjectViewBegin(); + GRRLIB_ObjectViewRotate(0,a*3,0); + GRRLIB_ObjectViewTrans(0,offset,0); + GRRLIB_ObjectViewRotate(a,a*3,a*2+3*rotpas); + GRRLIB_ObjectViewEnd(); + GRRLIB_DrawCube(0.8f,1,0xFFFFFFFF); + + GRRLIB_ObjectViewBegin(); + GRRLIB_ObjectViewRotate(0,a*3,0); + GRRLIB_ObjectViewTrans(0,offset,0); + GRRLIB_ObjectViewRotate(a,a*3,a*2+4*rotpas); + GRRLIB_ObjectViewEnd(); + GRRLIB_DrawCube(0.8f,1,0xFFFFFFFF); + + GRRLIB_ObjectViewBegin(); + GRRLIB_ObjectViewRotate(0,a*3,0); + GRRLIB_ObjectViewTrans(0,offset,0); + GRRLIB_ObjectViewRotate(a,a*3,a*2+5*rotpas); + GRRLIB_ObjectViewEnd(); + GRRLIB_DrawCube(0.8f,1,0xFFFFFFFF); + + GRRLIB_ObjectViewBegin(); + GRRLIB_ObjectViewRotate(0,a*3,0); + GRRLIB_ObjectViewTrans(0,offset,0); + GRRLIB_ObjectViewRotate(a,a*3,a*2+6*rotpas); + GRRLIB_ObjectViewEnd(); + GRRLIB_DrawCube(0.8f,1,0xFFFFFFFF); + + a+=0.8; + GRRLIB_2dMode(); + + // Switch To 2D Mode to display text + GRRLIB_2dMode(); + GRRLIB_Printf((640-(16*29))/2, 20, tex_font, 0xFFFFFFFF, 1, "JUST ANOTHER 3D SAMPLE"); + GRRLIB_Render(); + } + GRRLIB_FreeTexture(tex_font); + GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB + + exit(0); +} diff --git a/examples/gamecube/Makefile b/examples/gamecube/Makefile new file mode 100644 index 0000000..8b42aa7 --- /dev/null +++ b/examples/gamecube/Makefile @@ -0,0 +1,12 @@ +MAKEFILES := $(shell find . -mindepth 2 -maxdepth 2 -name Makefile) + +all: + @for i in $(MAKEFILES); do \ + echo "-----------------------------------------------------------"; \ + $(MAKE) -C `dirname $$i` || exit 1; \ + done; + +clean: + @for i in $(MAKEFILES); do \ + $(MAKE) -C `dirname $$i` clean || exit 1; \ + done; diff --git a/examples/gamecube/TileDemo/Makefile b/examples/gamecube/TileDemo/Makefile new file mode 100644 index 0000000..1a18e66 --- /dev/null +++ b/examples/gamecube/TileDemo/Makefile @@ -0,0 +1,146 @@ +#--------------------------------------------------------------------------------- +# Clear the implicit built in rules +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- +ifeq ($(strip $(DEVKITPPC)),) +$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") +endif + +include $(DEVKITPPC)/gamecube_rules + +#--------------------------------------------------------------------------------- +# TARGET is the name of the output +# BUILD is the directory where object files & intermediate files will be placed +# SOURCES is a list of directories containing source code +# INCLUDES is a list of directories containing extra header files +#--------------------------------------------------------------------------------- +TARGET := $(notdir $(CURDIR)) +BUILD := build +SOURCES := source +DATA := data +INCLUDES := + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- + +CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) +CXXFLAGS = $(CFLAGS) + +LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -lgrrlib -lfreetype -lbz2 -lpngu -lpng -ljpeg -lz -lfat -logc -lm + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(CURDIR)/$(GRRLIB) $(PORTLIBS) + +#--------------------------------------------------------------------------------- +# no real need to edit anything past this point unless you need to add additional +# rules for different file extensions +#--------------------------------------------------------------------------------- +ifneq ($(BUILD),$(notdir $(CURDIR))) +#--------------------------------------------------------------------------------- + +export OUTPUT := $(CURDIR)/$(TARGET) + +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + +export DEPSDIR := $(CURDIR)/$(BUILD) + +#--------------------------------------------------------------------------------- +# automatically build a list of object files for our project +#--------------------------------------------------------------------------------- +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) +sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) + +#--------------------------------------------------------------------------------- +# use CXX for linking C++ projects, CC for standard C +#--------------------------------------------------------------------------------- +ifeq ($(strip $(CPPFILES)),) + export LD := $(CC) +else + export LD := $(CXX) +endif + +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o) +export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) + +export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) + +#--------------------------------------------------------------------------------- +# build a list of include paths +#--------------------------------------------------------------------------------- +export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) \ + -I$(LIBOGC_INC) + +#--------------------------------------------------------------------------------- +# build a list of library paths +#--------------------------------------------------------------------------------- +export LIBPATHS := -L$(LIBOGC_LIB) $(foreach dir,$(LIBDIRS),-L$(dir)/lib) + +export OUTPUT := $(CURDIR)/$(TARGET) +.PHONY: $(BUILD) clean + +#--------------------------------------------------------------------------------- +$(BUILD): + @[ -d $@ ] || mkdir -p $@ + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol + +#--------------------------------------------------------------------------------- +run: + wiiload $(TARGET).dol + + +#--------------------------------------------------------------------------------- +else + +DEPENDS := $(OFILES:.o=.d) + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- +$(OUTPUT).dol: $(OUTPUT).elf +$(OUTPUT).elf: $(OFILES) + +$(OFILES_SOURCES) : $(HFILES) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .jpg extension +#--------------------------------------------------------------------------------- +%.jpg.o : %.jpg +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .png extension +#--------------------------------------------------------------------------------- +%.png.o : %.png +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +-include $(DEPENDS) + +#--------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------- diff --git a/examples/gamecube/TileDemo/data/bg.png b/examples/gamecube/TileDemo/data/bg.png new file mode 100644 index 0000000..164e7e4 Binary files /dev/null and b/examples/gamecube/TileDemo/data/bg.png differ diff --git a/examples/gamecube/TileDemo/data/logo.png b/examples/gamecube/TileDemo/data/logo.png new file mode 100644 index 0000000..8dd44d8 Binary files /dev/null and b/examples/gamecube/TileDemo/data/logo.png differ diff --git a/examples/gamecube/TileDemo/data/nonameno.png b/examples/gamecube/TileDemo/data/nonameno.png new file mode 100644 index 0000000..6d55046 Binary files /dev/null and b/examples/gamecube/TileDemo/data/nonameno.png differ diff --git a/examples/gamecube/TileDemo/data/perso.png b/examples/gamecube/TileDemo/data/perso.png new file mode 100644 index 0000000..142856c Binary files /dev/null and b/examples/gamecube/TileDemo/data/perso.png differ diff --git a/examples/gamecube/TileDemo/data/tile1.png b/examples/gamecube/TileDemo/data/tile1.png new file mode 100644 index 0000000..cb87f40 Binary files /dev/null and b/examples/gamecube/TileDemo/data/tile1.png differ diff --git a/examples/gamecube/TileDemo/source/main.c b/examples/gamecube/TileDemo/source/main.c new file mode 100644 index 0000000..6673b24 --- /dev/null +++ b/examples/gamecube/TileDemo/source/main.c @@ -0,0 +1,274 @@ +/*=========================================== + NoNameNo TileDemo + A sample code to show how to use tile/tileset + The map have been drawn with the mega mighty + TileStudio (http://tilestudio.sourceforge.net/) + Special Greetings to TLB for some GFx ;=) +============================================*/ +#include + +#include +#include +#include + +#include "tile1_png.h" +#include "perso_png.h" +#include "bg_png.h" +#include "nonameno_png.h" + +#define TileMap1Width (32) +#define TileMap1Height (32) +#define Map1Width (87) +#define Map1Height (51) + +signed short Map1Data[51][87] = +{{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0,15, 1,15, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {16,16,17,16,17,16,17,16,17,16, 0, 0, 0, 0, 0, 0, 1, 1,17,16, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3,18,19, 3,18,19, 3, 4,20,21, 0,22, 0, 0, 0, 0, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 0, 1, 1, 1, 0,17,16,17,16,17,16,17,16,17,16,17,16,17,16,17,16,17,16,17,16,17}, + {23,23,24,23,24,23,24,23,24,23,22,22, 0, 1, 1, 1, 1, 0,24,23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,25,26, 0,27,28,28,28,28,28,28,28,28,28,29,30,31,22, 0, 0, 0, 2, 3,32,33, 3,34,35, 3,36,37, 3, 4, 0, 1, 0, 0,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23,22,22, 0, 1, 1, 1, 1, 0,24,23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,38,39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,13,14, 0,22,13,14, 0, 2, 3,11,12, 3,11,12, 3,11,12, 3, 4, 1, 1, 0, 0,24,23,40,41,40,41,40,41,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23,27,28,28,31, 1, 1, 1, 0,24,23,13,14, 0, 0, 0, 0, 0, 0, 0, 0,42,43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,20,21, 0,22,20,21, 0, 2, 3,18,19, 3,18,19, 3,18,19, 3, 4, 1, 0, 0, 0,24,23,44,45,46,44, 0, 0,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23,27,28,28,31, 1, 0, 0, 0,24,23,20,21, 0, 0, 0, 0, 0, 0, 0,22,47,48,22, 0, 0, 0, 0, 0, 0, 0, 0, 0,27,28,28,28,28,29,30,28,28,28,28,28,28,28,28,28,28,28,28,28,28,31, 0, 0,24,23,44,11,12,44,13,14,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0,27,28,28,31, 0, 0, 0,24,23,13,14, 0, 0, 0,13,14, 0,42,43,42,43,42,43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,13,14,17,16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,24,23,44,18,19,44,20,21,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23,27,28,28,31, 0, 0, 0, 0,24,23,20,21, 0, 0, 0,20,21,22,47,48,47,48,47,48,22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,20,21,24,23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,24,23,27,28,28,31,13,14,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0,27,28,28,31, 0, 0,27,28,28,29,30,28,28,28,29,30,28,28,28,28,28,28,28,31, 0, 0, 0, 0, 0, 0, 0, 2, 3, 3, 4, 0,13,14,24,23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,24,23,40,41,40,41,20,21,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23,27,28,28,31, 0, 0, 0, 0, 0, 0,20,21, 0, 0, 0,13,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3,49,50, 3, 4,13,14,24,23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,24,23,24,23,24,23,13,14,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0,27,28,28,31, 0, 0, 0, 0, 0,13,14, 0, 0, 0,20,21, 0, 0, 0, 0,20,21, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3,11,12, 3, 4,20,21,24,23, 0, 0, 0, 0,27,28,28,31, 0, 0, 2, 3, 3, 4, 0,40,41,40,41,40,41,20,21,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 0,27,28,28,31, 0, 0, 0,20,21, 0, 0, 0,13,14, 0, 0, 0, 0,13,14, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3,18,19, 3, 4,13,14,24,23, 0, 0,17,16, 0,27,28,31, 0, 2, 3,51,52, 3, 4, 0, 0, 0, 0, 0, 0,13,14,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 0, 2, 3, 3, 4, 0, 0, 0,13,14, 0, 0, 0,20,21, 0, 0, 0,27,29,30,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,31, 2,53,54, 4, 0,22, 0, 0, 2, 3,11,12, 3, 4, 0, 0, 0, 0, 0, 0,20,21,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 2, 3,55,56, 3, 4, 0, 0,20,21, 0, 0, 0,13,14, 0, 0, 0, 0,13,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3,11,12, 3, 4,22, 0, 0, 2, 3,18,19, 3, 4, 0, 0, 0, 0, 0, 0,13,14,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 2, 3,11,12, 3, 4, 0, 0,13,14, 0, 0, 0,20,21, 0, 0, 0, 0,20,21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3,18,19, 3, 4,22, 0, 0,27,28,28,28,28,28,28,28,28,28,28,31,20,21,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 2, 3,18,19, 3, 4, 0, 0,20,21, 0, 0, 0,13,14, 0, 0, 0, 0,13,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,27,28,28,31, 0,22, 0, 0, 0, 0, 0, 0, 0, 0,17,16,17,16,17,16,13,14,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0,27,28,28,28,28,28,28,28,28,28,28,31, 0, 0,20,21, 0, 0, 0,27,29,30,28,28,28,28,28,28,28,28,28,31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,22, 0, 0, 0, 0, 0, 0, 0, 0,24,23,24,23,24,23,20,21,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,13,14, 0, 0, 0, 0,13,14, 0, 0, 0, 0, 0, 0, 0, 0, 0,57,57, 0,57,57, 0,57,57, 0,42,43, 0,42,43, 0, 0, 0, 2, 3, 3, 4, 0, 0, 0,24,23,24,23,24,23,13,14,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 0, 2, 3, 3, 4, 0, 0, 0, 0, 0, 0,27,28,28,28,28,28,28,28,29,30,31, 0, 0, 0, 0, 0, 0, 0, 0,57,57, 0,57,57, 0,57,57, 0,47,48, 0,47,48, 0, 0, 2, 3,58,59, 3, 4, 0, 0,24,23,24,23,24,23,13,14,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 2, 3,60,61, 3, 4,13,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,13,14, 0, 0, 0, 0, 0, 0, 0, 0, 0,57,57, 0,57,57, 0,57,57, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3,11,12, 3, 4, 0, 0,24,23,24,23,24,23,20,21,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 2, 3,11,12, 3, 4,20,21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,20,21, 0, 0, 0, 0, 0, 0, 0, 0, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0, 0, 2, 3,18,19, 3, 4, 0, 0,24,23,24,23,24,23,13,14,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 2, 3,18,19, 3, 4,13,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,13,14, 0, 0, 0, 0, 0, 0, 0, 0, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0, 0,27,28,28,28,28,31, 0, 0,24,23,24,23,24,23,20,21,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0,27,28,28,28,28,28,29,30,28,28,31, 0, 0, 0, 0, 0, 0, 0, 0,20,21, 0, 0, 0, 0, 0, 0, 0, 0, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,24,23,24,23,24,23,13,14,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 0, 0, 0, 0, 0, 0,13,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,13,14, 0, 0, 0, 0, 2, 3, 3, 4, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0, 0,42,43, 0, 0, 0, 0, 0, 0,24,23,24,23,24,23,20,21,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 0, 0, 0, 0, 0, 0,20,21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,20,21, 0, 0, 0, 0, 3,62,63, 3, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0, 0,47,48, 0, 0, 0, 0, 0, 0,24,23,40,41,40,41,13,14,40,41,40,41,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 0, 0, 0, 0, 0, 0,13,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,13,14, 0, 0, 0, 2, 3,11,12, 3, 4, 0,57,57,57,57,57,57, 0, 0,57,57, 0,57,57, 0, 0,25,26, 0, 0,20,21, 0, 0,24,23, 2, 3, 3, 4,20,21, 0, 0, 0, 0,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 0, 0, 0, 0, 0, 0,20,21, 0, 0, 0, 2, 3, 3, 4, 0, 0, 0, 0,20,21, 0, 0, 0, 2, 3,18,19, 3, 4, 0, 0,57, 0, 0,57, 0, 0, 0,57,57, 0,57,57, 0, 0,38,39, 0, 0,13,14, 0, 0,24,23, 3,64,65, 3,13,14, 0, 0, 0, 5,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 0, 0, 0, 0, 0, 0,13,14, 0, 0, 2, 3,66,67, 3, 4, 0, 0, 0,13,14, 0, 0,27,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,29,30,31, 0,24,23, 3,11,12, 3,20,21, 0,42,43,10,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 0, 0, 0, 0, 0, 0,20,21, 0, 0, 2, 3,11,12, 3, 4, 0, 0, 0,20,21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,13,14, 0, 0,24,23, 3,18,19, 3,13,14, 0,47,48,15,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 0,68, 0, 0, 0, 0,13,14, 0, 0, 2, 3,18,19, 3, 4, 0,68, 0,13,14, 0, 0,57,57,57,57, 0, 0, 0,57,57,57, 0, 0, 0, 0,57, 0, 0,57, 0, 0, 0,57,57,57,57, 0, 0,20,21, 0, 0,24,23,27,28,28,28,28,28,28,28,28,31,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0,27,28,28,28,28,28,28,29,30,28,28,28,28,28,28,28,28,28,28,28,28,28,28,31,57,57,57,57,57, 0,57,57,57,57,57, 0, 0,57,57,57,57,57,57, 0, 0,57,57,57,57,57, 0,13,14, 0, 0,24,23,17,16,17,16,17,16,17,16,17,16,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 0,17,16,17,16, 0,13,14, 0, 0, 0, 0, 0, 0, 0,44, 0, 0, 0, 0, 0, 0, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,20,21, 0, 0,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 0,24,23,24,23, 0,20,21, 0, 0, 0, 0, 0, 0, 0,44, 0, 0, 0, 0, 0, 0, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,13,14, 0, 0,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23, 0, 0, 0,24,23,24,23, 0,13,14, 0, 0, 0, 0, 0, 0, 0,44, 0, 0, 0, 0, 0, 0, 0,57,57,57,57, 0, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57,57,57, 0, 0,20,21, 0, 0,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23,22, 0, 0,24,23,24,23, 0,20,21, 0, 0, 0, 0, 0, 0, 0,44, 0, 0, 0, 0, 0, 0, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,13,14, 0, 0,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23,22, 0, 0,24,23,24,23, 0,13,14, 0, 0, 2, 3, 3, 4, 0,44, 0, 0, 0, 0, 0, 0, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,13,14, 0, 0,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23,22, 0, 0,17,69,70,16, 0,20,21, 0, 2, 3,71,72, 3, 4,44, 0, 0, 0, 0, 0, 0, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57, 0,13,14, 0, 0,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {23,23,24,23,24,23,24,23,24,23,42,43, 0,44,11,12,44, 0,13,14, 0, 2, 3,11,12, 3, 4,44, 0, 0, 0, 0, 0, 0, 0,57,57,57,57,57, 0,57,57,57,57,57, 0,57,57, 0,57,57, 0,57,57, 0,57,57,57,57,57, 0,20,21, 0, 0,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24}, + {41,41,40,41,40,41,40,41,40,41,47,48,22,44,18,19,44, 0,13,14, 0, 2, 3,18,19, 3, 4,44, 0, 0,68,68, 0, 0, 0,57,57,57,57, 0, 0, 0,57,57,57, 0, 0,57,57, 0,57,57, 0,57,57, 0,57,57,57,57, 0, 0,13,14, 0, 0,40,41,40,41,40,41,40,41,40,41,40,41,40,41,40,41,40,41,40,41,40}, + {73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73}, + {74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74}, + {74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74}, + {74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74}, + {74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74}, + {74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74}, + {74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74}}; + +signed int Map1Info[51][87] = +{{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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, 8, 2, 8, 2, 8, 2, 8, 2}, + { 8, 8, 2, 8, 2, 8, 2, 8, 2, 8, 0, 1, 1, 1, 1, 0, 0, 0, 2, 8,43521,43521, 0, 0, 0,43521,43521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 2, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 8, 0,64512,64512, 0,43521,43521, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2}, + { 8, 8, 2, 8, 2, 8, 2, 8, 2, 8, 1, 1, 1, 1, 0, 0, 0, 0, 2, 8,43521,43521, 0, 0, 0,43521,43521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 2, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 8, 1, 1, 1, 1,43521,43521, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2}, + { 8, 8, 2, 8, 2, 8, 2, 8, 2, 8, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1,43521,43521, 1, 1, 1,43521,43521, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 2, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 8, 0, 0, 0, 8,43521,43521, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2}, + { 8, 8, 2, 8, 2, 8, 2, 8, 2, 8, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,43521,43521, 0, 0, 0,43521,43521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 2, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 8, 2, 8, 2, 8,43521,43521, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2}, + { 8, 8, 2, 8, 2, 8, 2, 8, 2, 8, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0,43521,43521, 0, 0, 0,43521,43521, 0, 0, 0, 0,43521,43521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 2, 8, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8,43521,43521, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2}, + { 8, 8, 2, 8, 2, 8, 2, 8, 2, 8, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0,43521,43521, 0, 0, 0,43521,43521, 0, 0, 0, 0,43521,43521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,62976,62976, 0, 0,43521,43521, 2, 8, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2}, + { 8, 8, 2, 8, 2, 8, 2, 8, 2, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 0, 0, 0,43521,43521, 0, 0, 0, 1,43521,43521, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2}, + { 8, 8, 2, 8, 2, 8, 2, 8, 2, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 0, 0, 0,43521,43521, 0, 0, 0, 0,43521,43521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,65024,65024, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2}, + { 8, 8, 2, 8, 2, 8, 2, 8, 2, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 0, 0, 0,43521,43521, 0, 0, 0, 0,43521,43521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,64768,64768, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,43521,43521, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2}, + { 8, 8, 2, 8, 2, 8, 2, 8, 2, 8, 0, 0, 0, 0,61440,61440, 0, 0, 0, 0,43521,43521, 0, 0, 0,43521,43521, 0, 0, 0, 0,43521,43521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 8,43521,43521, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2}, + { 8, 8, 2, 8, 2, 8, 2, 8, 2, 8, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0,43521,43521, 0, 0, 0, 1,43521,43521, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 8, 2, 8, 2, 8,43521,43521, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2}, + { 8, 8, 2, 8, 2, 8, 2, 8, 2, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 0, 0, 0, 0,43521,43521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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0, 0, 0, 0, 0, 0,43521,43521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 0, 0, 2, 8, 0, 0, 0, 0,43521,43521, 0, 0, 0, 0, 2, 8, 2, 8, 2, 8, 2, 8, 2}, + { 8, 8, 2, 8, 2, 8, 2, 8, 2, 8, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 0, 0, 0, 0, 0,62720,62720, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 0, 0, 2, 8, 0, 0, 0, 0,43521,43521, 0, 0, 0, 0, 2, 8, 2, 8, 2, 8, 2, 8, 2}, + { 8, 8, 2, 8, 2, 8, 2, 8, 2, 8, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,43521,43521, 1, 0, 2, 8, 0, 0, 0, 0,43521,43521, 0, 0, 0, 0, 2, 8, 2, 8, 2, 8, 2, 8, 2}, + { 8, 8, 2, 8, 2, 8, 2, 8, 2, 8, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 0, 0, 2, 8, 0,61184,61184, 0,43521,43521, 0, 0, 0, 0, 2, 8, 2, 8, 2, 8, 2, 8, 2}, + { 8, 8, 2, 8, 2, 8, 2, 8, 2, 8, 0, 0, 0, 0, 0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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; + +int main() { + int startx=0, starty=0; + int x, y; + int dirx=0, diry=0; + int cptx=0, cpty=0; + int bgx=-32, bgy=-32; + float idperso=0; + int i; + float sinnonameno=0; + + GRRLIB_Init(); + GRRLIB_Settings.antialias = false; + PAD_Init(); + GRRLIB_ClipDrawing(0,0,rmode->fbWidth,rmode->efbHeight); + GRRLIB_texImg *tex_tile1 = GRRLIB_LoadTexture(tile1_png); + GRRLIB_InitTileSet(tex_tile1, TileMap1Width, TileMap1Height, 0); + GRRLIB_texImg *tex_perso = GRRLIB_LoadTexture(perso_png); + GRRLIB_InitTileSet(tex_perso, 64, 64, 0); + GRRLIB_texImg *tex_bg = GRRLIB_LoadTexture(bg_png); + GRRLIB_texImg *tex_nonameno = GRRLIB_LoadTexture(nonameno_png); + GRRLIB_InitTileSet(tex_nonameno, 32, 32, 0); + + while(1) { + PAD_ScanPads(); + if (PAD_ButtonsDown(0) & PAD_BUTTON_START) break; + + if((dirx==0) && (diry==0)) { + if (PAD_ButtonsHeld(0) & PAD_BUTTON_DOWN) { diry=-4; idperso=15;} + else if (PAD_ButtonsHeld(0) & PAD_BUTTON_UP) { diry=4; idperso=15;} + else if (PAD_ButtonsHeld(0) & PAD_BUTTON_RIGHT) { dirx=-4; idperso=1;} + else if (PAD_ButtonsHeld(0) & PAD_BUTTON_LEFT) { dirx=4; idperso=8;} + } + + if((dirx==0) && (diry==0)) { + idperso=0; + } + + if(((Map1Info[9+starty][10+startx]==1) || (Map1Info[9+starty][11+startx]==1)) || ((Map1Info[9+starty][10+startx]==43521) || (Map1Info[9+starty][11+startx]==43521))) { + } + else { + dirx=0; + diry=-4; + } + + if(dirx<0) { + if((Map1Info[7+starty][12+startx]==8) || (Map1Info[7+starty][12+startx]==2) || (Map1Info[8+starty][12+startx]==8) || (Map1Info[8+starty][12+startx]==2)) { + dirx=0; + } + else { + idperso++; + if(idperso>7) + idperso=1; + } + } + else if(dirx>0) { + if((Map1Info[7+starty][9+startx]==8) || (Map1Info[7+starty][9+startx]==2) || (Map1Info[8+starty][9+startx]==8) || (Map1Info[8+starty][9+startx]==2)) { + dirx=0; + } + else { + idperso++; + if(idperso>14) + idperso=8; + } + } + + if(diry<0) { + if((Map1Info[9+starty][10+startx]==1) || (Map1Info[9+starty][11+startx]==1)) { + diry=0; + } + } + if(diry!=0) { + idperso++; + if(idperso>22) + idperso=16; + } + + cptx+=dirx; + if(dirx>0) + bgx++; + else if(dirx<0) + bgx--; + if((bgx>-1) ||(bgx<-63)) + bgx=-32; + + if(cptx==32) { + cptx=0; + dirx=0; + startx--; + } + else if(cptx==-32) { + cptx=0; + dirx=0; + startx++; + } + + cpty+=diry; + if(diry>0) + bgy++; + else if(diry<0) + bgy--; + if((bgy>-1) || (bgy<-63)) + bgy=-32; + + if(cpty==32) { + cpty=0; + diry=0; + starty--; + } + else if(cpty==-32) { + cpty=0; + if(((Map1Info[9+starty][10+startx]==1) || (Map1Info[9+starty][11+startx]==1)) || ((Map1Info[9+starty][10+startx]==43521) || (Map1Info[9+starty][11+startx]==43521))) { + diry=0; + } + starty++; + } + GRRLIB_DrawImg(bgx, bgy, tex_bg, 0, 1, 1, 0xFFFFFFFF); + + for(y=0; y<=16; y++) { + for(x=0; x<=21; x++) { + if(Map1Data[y+starty][x+startx] != 0) { + GRRLIB_DrawTile(x*TileMap1Width+cptx-TileMap1Width,y*TileMap1Height+cpty-TileMap1Height,tex_tile1,0,1,1,0xFFFFFFFF,Map1Data[y+starty][x+startx]-1); + } + } + } + GRRLIB_DrawTile(TileMap1Width*9,TileMap1Height*6,tex_perso,0,1,1,0xFFFFFFFF,(int)idperso); + + const float oldsinnonameno=sinnonameno; + for(i=0; i<8; i++) { + GRRLIB_DrawTile(TileMap1Width*(6+i),(TileMap1Height*10)+sin(sinnonameno)*64,tex_nonameno,0,1,1,0xFFFFFFFF,i); + sinnonameno+=0.4F; + } + sinnonameno=oldsinnonameno+0.08F; + GRRLIB_Render(); + } + + + // Free some textures + GRRLIB_FreeTexture(tex_tile1); + GRRLIB_FreeTexture(tex_perso); + GRRLIB_FreeTexture(tex_bg); + GRRLIB_FreeTexture(tex_nonameno); + GRRLIB_Exit(); + + exit(0); +} diff --git a/examples/gamecube/basic_drawing/Makefile b/examples/gamecube/basic_drawing/Makefile new file mode 100644 index 0000000..81d2a35 --- /dev/null +++ b/examples/gamecube/basic_drawing/Makefile @@ -0,0 +1,162 @@ +#--------------------------------------------------------------------------------- +# Clear the implicit built in rules +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- +ifeq ($(strip $(DEVKITPPC)),) +$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") +endif + +include $(DEVKITPPC)/gamecube_rules + +#--------------------------------------------------------------------------------- +# TARGET is the name of the output +# BUILD is the directory where object files & intermediate files will be placed +# SOURCES is a list of directories containing source code +# INCLUDES is a list of directories containing extra header files +#--------------------------------------------------------------------------------- +TARGET := $(notdir $(CURDIR)) +BUILD := build +SOURCES := source +DATA := data +INCLUDES := + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- + +CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) +CXXFLAGS = $(CFLAGS) + +LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -lgrrlib -lfreetype -lbz2 -lpngu -lpng -ljpeg -lz -lfat -logc -lm + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(CURDIR)/$(GRRLIB) $(PORTLIBS) + +#--------------------------------------------------------------------------------- +# no real need to edit anything past this point unless you need to add additional +# rules for different file extensions +#--------------------------------------------------------------------------------- +ifneq ($(BUILD),$(notdir $(CURDIR))) +#--------------------------------------------------------------------------------- + +export OUTPUT := $(CURDIR)/$(TARGET) + +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + +export DEPSDIR := $(CURDIR)/$(BUILD) + +#--------------------------------------------------------------------------------- +# automatically build a list of object files for our project +#--------------------------------------------------------------------------------- +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) +sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) + +#--------------------------------------------------------------------------------- +# use CXX for linking C++ projects, CC for standard C +#--------------------------------------------------------------------------------- +ifeq ($(strip $(CPPFILES)),) + export LD := $(CC) +else + export LD := $(CXX) +endif + +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o) +export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) + +export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) + +#--------------------------------------------------------------------------------- +# build a list of include paths +#--------------------------------------------------------------------------------- +export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) \ + -I$(LIBOGC_INC) + +#--------------------------------------------------------------------------------- +# build a list of library paths +#--------------------------------------------------------------------------------- +export LIBPATHS := -L$(LIBOGC_LIB) $(foreach dir,$(LIBDIRS),-L$(dir)/lib) + +export OUTPUT := $(CURDIR)/$(TARGET) +.PHONY: $(BUILD) clean + +#--------------------------------------------------------------------------------- +$(BUILD): + @[ -d $@ ] || mkdir -p $@ + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol + +#--------------------------------------------------------------------------------- +run: + wiiload $(TARGET).dol + + +#--------------------------------------------------------------------------------- +else + +DEPENDS := $(OFILES:.o=.d) + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- +$(OUTPUT).dol: $(OUTPUT).elf +$(OUTPUT).elf: $(OFILES) + +$(OFILES_SOURCES) : $(HFILES) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .jpg extension +#--------------------------------------------------------------------------------- +%.jpg.o : %.jpg +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .png extension +#--------------------------------------------------------------------------------- +%.png.o : %.png +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .bmp extension +#--------------------------------------------------------------------------------- +%.bmp.o : %.bmp +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .bmf extension +#--------------------------------------------------------------------------------- +%.bmf.o : %.bmf +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +-include $(DEPENDS) + +#--------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------- diff --git a/examples/gamecube/basic_drawing/data/BMfont1.png b/examples/gamecube/basic_drawing/data/BMfont1.png new file mode 100644 index 0000000..fbc0a17 Binary files /dev/null and b/examples/gamecube/basic_drawing/data/BMfont1.png differ diff --git a/examples/gamecube/basic_drawing/data/BMfont2.png b/examples/gamecube/basic_drawing/data/BMfont2.png new file mode 100644 index 0000000..2812ebc Binary files /dev/null and b/examples/gamecube/basic_drawing/data/BMfont2.png differ diff --git a/examples/gamecube/basic_drawing/data/BMfont3.png b/examples/gamecube/basic_drawing/data/BMfont3.png new file mode 100644 index 0000000..d9c3487 Binary files /dev/null and b/examples/gamecube/basic_drawing/data/BMfont3.png differ diff --git a/examples/gamecube/basic_drawing/data/BMfont4.png b/examples/gamecube/basic_drawing/data/BMfont4.png new file mode 100644 index 0000000..ac5131a Binary files /dev/null and b/examples/gamecube/basic_drawing/data/BMfont4.png differ diff --git a/examples/gamecube/basic_drawing/data/BMfont5.png b/examples/gamecube/basic_drawing/data/BMfont5.png new file mode 100644 index 0000000..38ddeed Binary files /dev/null and b/examples/gamecube/basic_drawing/data/BMfont5.png differ diff --git a/examples/gamecube/basic_drawing/data/frontal.bmf b/examples/gamecube/basic_drawing/data/frontal.bmf new file mode 100644 index 0000000..d6b73fa Binary files /dev/null and b/examples/gamecube/basic_drawing/data/frontal.bmf differ diff --git a/examples/gamecube/basic_drawing/data/ocean.bmf b/examples/gamecube/basic_drawing/data/ocean.bmf new file mode 100644 index 0000000..14e5d94 Binary files /dev/null and b/examples/gamecube/basic_drawing/data/ocean.bmf differ diff --git a/examples/gamecube/basic_drawing/data/sprite.png b/examples/gamecube/basic_drawing/data/sprite.png new file mode 100644 index 0000000..bfc226e Binary files /dev/null and b/examples/gamecube/basic_drawing/data/sprite.png differ diff --git a/examples/gamecube/basic_drawing/data/test_bmp.bmp b/examples/gamecube/basic_drawing/data/test_bmp.bmp new file mode 100644 index 0000000..6622988 Binary files /dev/null and b/examples/gamecube/basic_drawing/data/test_bmp.bmp differ diff --git a/examples/gamecube/basic_drawing/data/test_jpg.jpg b/examples/gamecube/basic_drawing/data/test_jpg.jpg new file mode 100644 index 0000000..968ef5c Binary files /dev/null and b/examples/gamecube/basic_drawing/data/test_jpg.jpg differ diff --git a/examples/gamecube/basic_drawing/source/main.c b/examples/gamecube/basic_drawing/source/main.c new file mode 100644 index 0000000..b86f579 --- /dev/null +++ b/examples/gamecube/basic_drawing/source/main.c @@ -0,0 +1,230 @@ +/*=========================================== + GRRLIB (GX Version) + - Example Code - + + How To use Bitmap Fonts +============================================*/ +#include + +#include // Needed for gettime and ticks_to_millisecs +#include +#include + +#include "BMfont1_png.h" +#include "BMfont2_png.h" +#include "BMfont3_png.h" +#include "BMfont4_png.h" +#include "BMfont5_png.h" +#include "test_jpg_jpg.h" +#include "test_bmp_bmp.h" +#include "sprite_png.h" +#include "ocean_bmf.h" +#include "frontal_bmf.h" + +// Tile stuff +#define TILE_DELAY 10 +#define TILE_UP 12*0 +#define TILE_RIGHT 12*1 +#define TILE_DOWN 12*2 +#define TILE_LEFT 12*3 +#define TILE_UP2 12*4+9 +#define TILE_RIGHT2 12*5+9 +#define TILE_DOWN2 12*6+9 +#define TILE_LEFT2 12*7+9 + +// RGBA Colors +#define GRRLIB_BLACK 0x000000FF +#define GRRLIB_MAROON 0x800000FF +#define GRRLIB_GREEN 0x008000FF +#define GRRLIB_OLIVE 0x808000FF +#define GRRLIB_NAVY 0x000080FF +#define GRRLIB_PURPLE 0x800080FF +#define GRRLIB_TEAL 0x008080FF +#define GRRLIB_GRAY 0x808080FF +#define GRRLIB_SILVER 0xC0C0C0FF +#define GRRLIB_RED 0xFF0000FF +#define GRRLIB_LIME 0x00FF00FF +#define GRRLIB_YELLOW 0xFFFF00FF +#define GRRLIB_BLUE 0x0000FFFF +#define GRRLIB_FUCHSIA 0xFF00FFFF +#define GRRLIB_AQUA 0x00FFFFFF +#define GRRLIB_WHITE 0xFFFFFFFF + +static u8 CalculateFrameRate(); + +int main() { + s32 left = 0, top = 0, page = 0, frame = TILE_DOWN + 1; + u32 wait = TILE_DELAY, direction = TILE_DOWN, direction_new = TILE_DOWN; + u8 FPS = 0; + + u32 paddown, padheld; + guVector triangle[] = {{400,200,0.0f}, {500,400,0.0f}, {300,400,0.0f}}; + u32 trianglecolor[] = {GRRLIB_GREEN, GRRLIB_RED, GRRLIB_BLUE}; + + GRRLIB_Init(); + + PAD_Init(); + + GRRLIB_texImg *tex_test_jpg = GRRLIB_LoadTexture(test_jpg_jpg); + GRRLIB_texImg *tex_test_bmp = GRRLIB_LoadTexture(test_bmp_bmp); + + GRRLIB_bytemapFont *bmf_Font1 = GRRLIB_LoadBMF(ocean_bmf); + GRRLIB_bytemapFont *bmf_Font2 = GRRLIB_LoadBMF(frontal_bmf); + + GRRLIB_texImg *tex_sprite_png = GRRLIB_LoadTexture(sprite_png); + GRRLIB_InitTileSet(tex_sprite_png, 24, 32, 0); + + GRRLIB_texImg *tex_BMfont1 = GRRLIB_LoadTexture(BMfont1_png); + GRRLIB_InitTileSet(tex_BMfont1, 32, 32, 32); + + GRRLIB_texImg *tex_BMfont2 = GRRLIB_LoadTexture(BMfont2_png); + GRRLIB_InitTileSet(tex_BMfont2, 16, 16, 32); + + GRRLIB_texImg *tex_BMfont3 = GRRLIB_LoadTexture(BMfont3_png); + GRRLIB_InitTileSet(tex_BMfont3, 32, 32, 32); + + GRRLIB_texImg *tex_BMfont4 = GRRLIB_LoadTexture(BMfont4_png); + GRRLIB_InitTileSet(tex_BMfont4, 16, 16, 32); + + GRRLIB_texImg *tex_BMfont5 = GRRLIB_LoadTexture(BMfont5_png); + GRRLIB_InitTileSet(tex_BMfont5, 8, 16, 0); + + while(1) { + PAD_ScanPads(); + paddown = PAD_ButtonsDown(0); + padheld = PAD_ButtonsHeld(0); + + GRRLIB_FillScreen(GRRLIB_BLACK); // Clear the screen + switch(page) + { + case 1: // Draw images + GRRLIB_Printf(5, 25, tex_BMfont2, GRRLIB_WHITE, 1, "IMAGES DEMO"); + + GRRLIB_DrawImg(10, 50, tex_test_jpg, 0, 1, 1, GRRLIB_WHITE); // Draw a jpeg + GRRLIB_DrawImg(350, 50, tex_test_bmp, 0, 4, 4, GRRLIB_WHITE); // Draw a bitmap + + // Draw a sprite + GRRLIB_DrawTile(600, 400, tex_sprite_png, 0, 2, 2, GRRLIB_WHITE, 12*4); // Rupee + GRRLIB_DrawTile(320+left, 240+top, tex_sprite_png, 0, 2, 2, GRRLIB_WHITE, frame); + if(direction_new != direction) { + // Direction has changed, modify frame immediately + direction = direction_new; + frame = direction; + wait = 0; + } + wait++; + if(wait > TILE_DELAY) { + // wait is needed for the number of frame per second to be OK + wait = 0; + if(padheld & PAD_BUTTON_LEFT || padheld & PAD_BUTTON_RIGHT || + padheld & PAD_BUTTON_UP || padheld & PAD_BUTTON_DOWN) { + frame++; + } + else { + frame = direction + 1; // Not moving + wait = TILE_DELAY; // Ready to move + } + if(frame > direction+2) frame = direction; + } + break; + case 2: // Draw shapes + GRRLIB_Printf(5, 25, tex_BMfont2, GRRLIB_WHITE, 1, "SHAPES DEMO"); + + GRRLIB_Rectangle(100, 100, 200, 100, GRRLIB_RED, 1); + GRRLIB_Line(100, 100, 350, 200, GRRLIB_SILVER); + GRRLIB_NGoneFilled(triangle, trianglecolor, 3); + GRRLIB_Rectangle(left + 150, top + 150, 200, 200, 0x0000FFC8, 1); // Blue with alpha + GRRLIB_Circle(left + 300, top + 300, 50, GRRLIB_OLIVE, 1); + break; + default: // Print some text + GRRLIB_Printf(5, 25, tex_BMfont2, GRRLIB_WHITE, 1, "GRRLIB %s TEXT DEMO", GRRLIB_VER_STRING); + + GRRLIB_Printf(5, 100, tex_BMfont4, GRRLIB_WHITE, 1, "TO QUIT PRESS THE START/PAUSE BUTTON."); + GRRLIB_Printf(5, 140, tex_BMfont4, GRRLIB_YELLOW, 1, "USE Y OR X TO MOVE ACROSS PAGES."); + GRRLIB_Printf(5, 180, tex_BMfont4, GRRLIB_GREEN, 1, "USE THE D-PAD TO MOVE STUFF."); + GRRLIB_Printf(left, top+350, tex_BMfont3, 0XFFFFFF50, 1, "TEXT WITH ALPHA"); + GRRLIB_Printf(left, top+400, tex_BMfont5, GRRLIB_LIME, 1, "This font has the 128 ASCII characters"); + GRRLIB_PrintBMF(left, top+420, bmf_Font2, "%s", bmf_Font2->name); + } + GRRLIB_Printf(500, 27, tex_BMfont5, GRRLIB_WHITE, 1, "Current FPS: %d", FPS); + + if(paddown & PAD_BUTTON_START) { + break; + } + if(padheld & PAD_BUTTON_LEFT) { + if(padheld & PAD_BUTTON_B || page == 1) + left -= 2; + else + left--; + direction_new = TILE_LEFT; // for tile example + } + if(padheld & PAD_BUTTON_RIGHT) { + if(padheld & PAD_BUTTON_B || page == 1) + left += 2; + else + left++; + direction_new = TILE_RIGHT; // for tile example + } + if(padheld & PAD_BUTTON_UP) { + if(padheld & PAD_BUTTON_B || page == 1) + top -= 2; + else + top--; + direction_new = TILE_UP; // for tile example + } + if(padheld & PAD_BUTTON_DOWN) { + if(padheld & PAD_BUTTON_B || page == 1) + top += 2; + else + top++; + direction_new = TILE_DOWN; // for tile example + } + if(paddown & PAD_BUTTON_Y) { + page--; + left = 0; + top = 0; + if(page < 0) page = 2; + } + if(paddown & PAD_BUTTON_X) { + page++; + left = 0; + top = 0; + if(page > 2) page = 0; + } + + GRRLIB_Render(); + FPS = CalculateFrameRate(); + } + // Free some textures + GRRLIB_FreeTexture(tex_test_jpg); + GRRLIB_FreeTexture(tex_test_bmp); + GRRLIB_FreeTexture(tex_sprite_png); + GRRLIB_FreeTexture(tex_BMfont1); + GRRLIB_FreeTexture(tex_BMfont2); + GRRLIB_FreeTexture(tex_BMfont3); + GRRLIB_FreeTexture(tex_BMfont4); + GRRLIB_FreeTexture(tex_BMfont5); + GRRLIB_FreeBMF(bmf_Font1); + GRRLIB_FreeBMF(bmf_Font2); + GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB + return 0; +} + +/** + * This function calculates the number of frames we render each second. + * @return The number of frames per second. + */ +static u8 CalculateFrameRate() { + static u8 frameCount = 0; + static u32 lastTime; + static u8 FPS = 0; + u32 currentTime = ticks_to_millisecs(gettime()); + + frameCount++; + if(currentTime - lastTime > 1000) { + lastTime = currentTime; + FPS = frameCount; + frameCount = 0; + } + return FPS; +} diff --git a/examples/gamecube/bitmap_fx/Makefile b/examples/gamecube/bitmap_fx/Makefile new file mode 100644 index 0000000..1a18e66 --- /dev/null +++ b/examples/gamecube/bitmap_fx/Makefile @@ -0,0 +1,146 @@ +#--------------------------------------------------------------------------------- +# Clear the implicit built in rules +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- +ifeq ($(strip $(DEVKITPPC)),) +$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") +endif + +include $(DEVKITPPC)/gamecube_rules + +#--------------------------------------------------------------------------------- +# TARGET is the name of the output +# BUILD is the directory where object files & intermediate files will be placed +# SOURCES is a list of directories containing source code +# INCLUDES is a list of directories containing extra header files +#--------------------------------------------------------------------------------- +TARGET := $(notdir $(CURDIR)) +BUILD := build +SOURCES := source +DATA := data +INCLUDES := + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- + +CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) +CXXFLAGS = $(CFLAGS) + +LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -lgrrlib -lfreetype -lbz2 -lpngu -lpng -ljpeg -lz -lfat -logc -lm + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(CURDIR)/$(GRRLIB) $(PORTLIBS) + +#--------------------------------------------------------------------------------- +# no real need to edit anything past this point unless you need to add additional +# rules for different file extensions +#--------------------------------------------------------------------------------- +ifneq ($(BUILD),$(notdir $(CURDIR))) +#--------------------------------------------------------------------------------- + +export OUTPUT := $(CURDIR)/$(TARGET) + +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + +export DEPSDIR := $(CURDIR)/$(BUILD) + +#--------------------------------------------------------------------------------- +# automatically build a list of object files for our project +#--------------------------------------------------------------------------------- +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) +sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) + +#--------------------------------------------------------------------------------- +# use CXX for linking C++ projects, CC for standard C +#--------------------------------------------------------------------------------- +ifeq ($(strip $(CPPFILES)),) + export LD := $(CC) +else + export LD := $(CXX) +endif + +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o) +export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) + +export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) + +#--------------------------------------------------------------------------------- +# build a list of include paths +#--------------------------------------------------------------------------------- +export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) \ + -I$(LIBOGC_INC) + +#--------------------------------------------------------------------------------- +# build a list of library paths +#--------------------------------------------------------------------------------- +export LIBPATHS := -L$(LIBOGC_LIB) $(foreach dir,$(LIBDIRS),-L$(dir)/lib) + +export OUTPUT := $(CURDIR)/$(TARGET) +.PHONY: $(BUILD) clean + +#--------------------------------------------------------------------------------- +$(BUILD): + @[ -d $@ ] || mkdir -p $@ + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol + +#--------------------------------------------------------------------------------- +run: + wiiload $(TARGET).dol + + +#--------------------------------------------------------------------------------- +else + +DEPENDS := $(OFILES:.o=.d) + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- +$(OUTPUT).dol: $(OUTPUT).elf +$(OUTPUT).elf: $(OFILES) + +$(OFILES_SOURCES) : $(HFILES) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .jpg extension +#--------------------------------------------------------------------------------- +%.jpg.o : %.jpg +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .png extension +#--------------------------------------------------------------------------------- +%.png.o : %.png +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +-include $(DEPENDS) + +#--------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------- diff --git a/examples/gamecube/bitmap_fx/data/font1.png b/examples/gamecube/bitmap_fx/data/font1.png new file mode 100644 index 0000000..f3a3cf9 Binary files /dev/null and b/examples/gamecube/bitmap_fx/data/font1.png differ diff --git a/examples/gamecube/bitmap_fx/data/pirate.png b/examples/gamecube/bitmap_fx/data/pirate.png new file mode 100644 index 0000000..6f88a3b Binary files /dev/null and b/examples/gamecube/bitmap_fx/data/pirate.png differ diff --git a/examples/gamecube/bitmap_fx/source/main.c b/examples/gamecube/bitmap_fx/source/main.c new file mode 100644 index 0000000..b0355d5 --- /dev/null +++ b/examples/gamecube/bitmap_fx/source/main.c @@ -0,0 +1,232 @@ +/*=========================================== + GRRLIB (GX Version) + - Example Code - + + How To use Bitmap FX +============================================*/ +#include + +#include +#include + +#include "pirate_png.h" +#include "font1_png.h" + + +int main() { + u32 paddown; + s8 page = 0; + + // Font texture + GRRLIB_texImg *text_font1 = GRRLIB_LoadTexture(font1_png); + GRRLIB_InitTileSet(text_font1, 32, 36, 32); + + // Load the original texture and create empty texture of the same size as the original one + GRRLIB_texImg *tex_pirate = GRRLIB_LoadTexture(pirate_png); + GRRLIB_texImg *tex_gray = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h); + GRRLIB_texImg *tex_sepia = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h); + GRRLIB_texImg *tex_invert = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h); + GRRLIB_texImg *tex_blur1 = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h); + GRRLIB_texImg *tex_blur2 = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h); + GRRLIB_texImg *tex_blur3 = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h); + GRRLIB_texImg *tex_blur4 = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h); + GRRLIB_texImg *tex_blur5 = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h); + GRRLIB_texImg *tex_blur6 = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h); + GRRLIB_texImg *tex_pixel1 = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h); + GRRLIB_texImg *tex_pixel2 = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h); + GRRLIB_texImg *tex_pixel3 = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h); + GRRLIB_texImg *tex_pixel4 = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h); + GRRLIB_texImg *tex_pixel5 = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h); + GRRLIB_texImg *tex_pixel6 = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h); + GRRLIB_texImg *tex_scatter1 = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h); + GRRLIB_texImg *tex_scatter2 = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h); + GRRLIB_texImg *tex_scatter3 = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h); + GRRLIB_texImg *tex_scatter4 = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h); + GRRLIB_texImg *tex_scatter5 = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h); + GRRLIB_texImg *tex_scatter6 = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h); + GRRLIB_texImg *tex_fliph = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h); + GRRLIB_texImg *tex_flipv = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h); + GRRLIB_texImg *tex_fliphv = GRRLIB_CreateEmptyTexture(tex_pirate->w, tex_pirate->h); + + // Let's precalculate the grayscale texture + GRRLIB_BMFX_Grayscale(tex_pirate, tex_gray); + GRRLIB_FlushTex(tex_gray); + + // Let's precalculate the sepia texture + GRRLIB_BMFX_Sepia(tex_pirate, tex_sepia); + GRRLIB_FlushTex(tex_sepia); + + // Let's precalculate the inverted color texture + GRRLIB_BMFX_Invert(tex_pirate, tex_invert); + GRRLIB_FlushTex(tex_invert); + + // Let's precalculate 6 differents blur texture with 6 differents blur factor + GRRLIB_BMFX_Blur(tex_pirate, tex_blur1, 1); + GRRLIB_FlushTex(tex_blur1); + GRRLIB_BMFX_Blur(tex_pirate, tex_blur2, 2); + GRRLIB_FlushTex(tex_blur2); + GRRLIB_BMFX_Blur(tex_pirate, tex_blur3, 3); + GRRLIB_FlushTex(tex_blur3); + GRRLIB_BMFX_Blur(tex_pirate, tex_blur4, 4); + GRRLIB_FlushTex(tex_blur4); + GRRLIB_BMFX_Blur(tex_pirate, tex_blur5, 5); + GRRLIB_FlushTex(tex_blur5); + GRRLIB_BMFX_Blur(tex_pirate, tex_blur6, 6); + GRRLIB_FlushTex(tex_blur6); + + // Let's precalculate 6 differents pixelate texture with 6 differents pixelate factor + GRRLIB_BMFX_Pixelate(tex_pirate, tex_pixel1, 1); + GRRLIB_FlushTex(tex_pixel1); + GRRLIB_BMFX_Pixelate(tex_pirate, tex_pixel2, 2); + GRRLIB_FlushTex(tex_pixel2); + GRRLIB_BMFX_Pixelate(tex_pirate, tex_pixel3, 3); + GRRLIB_FlushTex(tex_pixel3); + GRRLIB_BMFX_Pixelate(tex_pirate, tex_pixel4, 4); + GRRLIB_FlushTex(tex_pixel4); + GRRLIB_BMFX_Pixelate(tex_pirate, tex_pixel5, 5); + GRRLIB_FlushTex(tex_pixel5); + GRRLIB_BMFX_Pixelate(tex_pirate, tex_pixel6, 6); + GRRLIB_FlushTex(tex_pixel6); + + // Let's precalculate 6 differents pixelate texture with 6 differents pixelate factor + GRRLIB_BMFX_Scatter(tex_pirate, tex_scatter1, 2); + GRRLIB_FlushTex(tex_pixel1); + GRRLIB_BMFX_Scatter(tex_pirate, tex_scatter2, 4); + GRRLIB_FlushTex(tex_pixel2); + GRRLIB_BMFX_Scatter(tex_pirate, tex_scatter3, 6); + GRRLIB_FlushTex(tex_pixel3); + GRRLIB_BMFX_Scatter(tex_pirate, tex_scatter4, 8); + GRRLIB_FlushTex(tex_pixel4); + GRRLIB_BMFX_Scatter(tex_pirate, tex_scatter5, 10); + GRRLIB_FlushTex(tex_pixel5); + GRRLIB_BMFX_Scatter(tex_pirate, tex_scatter6, 12); + GRRLIB_FlushTex(tex_pixel6); + + // Let's precalculate for flipping the texture + GRRLIB_BMFX_FlipH(tex_pirate, tex_fliph); + GRRLIB_FlushTex(tex_fliph); + GRRLIB_BMFX_FlipV(tex_pirate, tex_flipv); + GRRLIB_FlushTex(tex_flipv); + GRRLIB_BMFX_FlipV(tex_fliph, tex_fliphv); + GRRLIB_FlushTex(tex_fliphv); + + GRRLIB_Init(); + PAD_Init(); + + while(1) { + PAD_ScanPads(); + paddown = PAD_ButtonsDown(0); + + GRRLIB_FillScreen(0xFFFFFFFF); + + switch(page) + { + case 1: + GRRLIB_Printf(10, 10, text_font1, 0X000000FF, 1, "GRAYSCALE FX"); + + GRRLIB_DrawImg(10, 60, tex_pirate, 0, 1, 1, 0xFFFFFFFF); + GRRLIB_DrawImg(10+tex_pirate->w*1, 60, tex_gray, 0, 1, 1, 0xFFFFFFFF); + break; + case 2: + GRRLIB_Printf(10, 10, text_font1, 0X000000FF, 1, "SEPIA FX"); + + GRRLIB_DrawImg(10, 60, tex_pirate, 0, 1, 1, 0xFFFFFFFF); + GRRLIB_DrawImg(10+tex_pirate->w*1, 60, tex_sepia, 0, 1, 1, 0xFFFFFFFF); + break; + case 3: + GRRLIB_Printf(10, 10, text_font1, 0X000000FF, 1, "INVERT FX"); + + GRRLIB_DrawImg(10, 60, tex_pirate, 0, 1, 1, 0xFFFFFFFF); + GRRLIB_DrawImg(10+tex_pirate->w*1, 60, tex_invert, 0, 1, 1, 0xFFFFFFFF); + break; + case 4: + GRRLIB_Printf(10, 10, text_font1, 0X000000FF, 1, "FLIPH AND FLIPV FX"); + + GRRLIB_DrawImg(10, 60, tex_pirate, 0, 1, 1, 0xFFFFFFFF); + GRRLIB_DrawImg(10+tex_pirate->w*1, 60, tex_fliph, 0, 1, 1, 0xFFFFFFFF); + GRRLIB_DrawImg(10+tex_pirate->w*2, 60, tex_flipv, 0, 1, 1, 0xFFFFFFFF); + GRRLIB_DrawImg(10+tex_pirate->w*3, 60, tex_fliphv, 0, 1, 1, 0xFFFFFFFF); + break; + case 5: + GRRLIB_Printf(10, 10, text_font1, 0X000000FF, 1, "BLUR FX"); + + GRRLIB_DrawImg(10, 60, tex_pirate, 0, 1, 1, 0xFFFFFFFF); + GRRLIB_DrawImg(10+tex_pirate->w*1, 60, tex_blur1, 0, 1, 1, 0xFFFFFFFF); + GRRLIB_DrawImg(10+tex_pirate->w*2, 60, tex_blur2, 0, 1, 1, 0xFFFFFFFF); + GRRLIB_DrawImg(10+tex_pirate->w*3, 60, tex_blur3, 0, 1, 1, 0xFFFFFFFF); + GRRLIB_DrawImg(10, 60+tex_pirate->h*1, tex_blur4, 0, 1, 1, 0xFFFFFFFF); + GRRLIB_DrawImg(10+tex_pirate->w*1, 60+tex_pirate->h*1, tex_blur5, 0, 1, 1, 0xFFFFFFFF); + GRRLIB_DrawImg(10+tex_pirate->w*2, 60+tex_pirate->h*1, tex_blur6, 0, 1, 1, 0xFFFFFFFF); + break; + case 6: + GRRLIB_Printf(10, 10, text_font1, 0X000000FF, 1, "PIXELATE FX"); + + GRRLIB_DrawImg(10, 60, tex_pirate, 0, 1, 1, 0xFFFFFFFF); + GRRLIB_DrawImg(10+tex_pirate->w*1, 60, tex_pixel1, 0, 1, 1, 0xFFFFFFFF); + GRRLIB_DrawImg(10+tex_pirate->w*2, 60, tex_pixel2, 0, 1, 1, 0xFFFFFFFF); + GRRLIB_DrawImg(10+tex_pirate->w*3, 60, tex_pixel3, 0, 1, 1, 0xFFFFFFFF); + GRRLIB_DrawImg(10, 60+tex_pirate->h*1, tex_pixel4, 0, 1, 1, 0xFFFFFFFF); + GRRLIB_DrawImg(10+tex_pirate->w*1, 60+tex_pirate->h*1, tex_pixel5, 0, 1, 1, 0xFFFFFFFF); + GRRLIB_DrawImg(10+tex_pirate->w*2, 60+tex_pirate->h*1, tex_pixel6, 0, 1, 1, 0xFFFFFFFF); + break; + case 7: + GRRLIB_Printf(10, 10, text_font1, 0X000000FF, 1, "SCATTER FX"); + + GRRLIB_DrawImg(10, 60, tex_pirate, 0, 1, 1, 0xFFFFFFFF); + GRRLIB_DrawImg(10+tex_pirate->w*1, 60, tex_scatter1, 0, 1, 1, 0xFFFFFFFF); + GRRLIB_DrawImg(10+tex_pirate->w*2, 60, tex_scatter2, 0, 1, 1, 0xFFFFFFFF); + GRRLIB_DrawImg(10+tex_pirate->w*3, 60, tex_scatter3, 0, 1, 1, 0xFFFFFFFF); + GRRLIB_DrawImg(10, 60+tex_pirate->h*1, tex_scatter4, 0, 1, 1, 0xFFFFFFFF); + GRRLIB_DrawImg(10+tex_pirate->w*1, 60+tex_pirate->h*1, tex_scatter5, 0, 1, 1, 0xFFFFFFFF); + GRRLIB_DrawImg(10+tex_pirate->w*2, 60+tex_pirate->h*1, tex_scatter6, 0, 1, 1, 0xFFFFFFFF); + break; + default: + GRRLIB_Printf(10, 10, text_font1, 0X000000FF, 1, "WELCOME TO THE"); + GRRLIB_Printf(10, 40, text_font1, 0X000000FF, 1, "GRRLIB FX DEMO."); + GRRLIB_Printf(10, 80, text_font1, 0X000000FF, 1, "TO QUIT PRESS THE"); + GRRLIB_Printf(10, 120, text_font1, 0X000000FF, 1, "START/PAUSE."); + GRRLIB_Printf(10, 160, text_font1, 0X000000FF, 1, "USE Y OR X TO MOVE"); + GRRLIB_Printf(10, 200, text_font1, 0X000000FF, 1, "ACROSS PAGES."); + } + + GRRLIB_Render(); + if(paddown & PAD_BUTTON_START) { + break; + } + if(paddown & PAD_BUTTON_Y) { + page--; + if(page < 0) page = 7; + } + if(paddown & PAD_BUTTON_X) { + page++; + if(page > 7) page = 0; + } + } + GRRLIB_FreeTexture(tex_pirate); + GRRLIB_FreeTexture(tex_gray); + GRRLIB_FreeTexture(tex_sepia); + GRRLIB_FreeTexture(tex_invert); + GRRLIB_FreeTexture(tex_fliph); + GRRLIB_FreeTexture(tex_flipv); + GRRLIB_FreeTexture(tex_fliphv); + GRRLIB_FreeTexture(tex_blur1); + GRRLIB_FreeTexture(tex_blur2); + GRRLIB_FreeTexture(tex_blur3); + GRRLIB_FreeTexture(tex_blur4); + GRRLIB_FreeTexture(tex_blur5); + GRRLIB_FreeTexture(tex_blur6); + GRRLIB_FreeTexture(tex_pixel1); + GRRLIB_FreeTexture(tex_pixel2); + GRRLIB_FreeTexture(tex_pixel3); + GRRLIB_FreeTexture(tex_pixel4); + GRRLIB_FreeTexture(tex_pixel5); + GRRLIB_FreeTexture(tex_pixel6); + GRRLIB_FreeTexture(tex_scatter1); + GRRLIB_FreeTexture(tex_scatter2); + GRRLIB_FreeTexture(tex_scatter3); + GRRLIB_FreeTexture(tex_scatter4); + GRRLIB_FreeTexture(tex_scatter5); + GRRLIB_FreeTexture(tex_scatter6); + GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB + return 0; +} diff --git a/examples/gamecube/compositing/Makefile b/examples/gamecube/compositing/Makefile new file mode 100644 index 0000000..1a18e66 --- /dev/null +++ b/examples/gamecube/compositing/Makefile @@ -0,0 +1,146 @@ +#--------------------------------------------------------------------------------- +# Clear the implicit built in rules +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- +ifeq ($(strip $(DEVKITPPC)),) +$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") +endif + +include $(DEVKITPPC)/gamecube_rules + +#--------------------------------------------------------------------------------- +# TARGET is the name of the output +# BUILD is the directory where object files & intermediate files will be placed +# SOURCES is a list of directories containing source code +# INCLUDES is a list of directories containing extra header files +#--------------------------------------------------------------------------------- +TARGET := $(notdir $(CURDIR)) +BUILD := build +SOURCES := source +DATA := data +INCLUDES := + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- + +CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) +CXXFLAGS = $(CFLAGS) + +LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -lgrrlib -lfreetype -lbz2 -lpngu -lpng -ljpeg -lz -lfat -logc -lm + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(CURDIR)/$(GRRLIB) $(PORTLIBS) + +#--------------------------------------------------------------------------------- +# no real need to edit anything past this point unless you need to add additional +# rules for different file extensions +#--------------------------------------------------------------------------------- +ifneq ($(BUILD),$(notdir $(CURDIR))) +#--------------------------------------------------------------------------------- + +export OUTPUT := $(CURDIR)/$(TARGET) + +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + +export DEPSDIR := $(CURDIR)/$(BUILD) + +#--------------------------------------------------------------------------------- +# automatically build a list of object files for our project +#--------------------------------------------------------------------------------- +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) +sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) + +#--------------------------------------------------------------------------------- +# use CXX for linking C++ projects, CC for standard C +#--------------------------------------------------------------------------------- +ifeq ($(strip $(CPPFILES)),) + export LD := $(CC) +else + export LD := $(CXX) +endif + +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o) +export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) + +export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) + +#--------------------------------------------------------------------------------- +# build a list of include paths +#--------------------------------------------------------------------------------- +export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) \ + -I$(LIBOGC_INC) + +#--------------------------------------------------------------------------------- +# build a list of library paths +#--------------------------------------------------------------------------------- +export LIBPATHS := -L$(LIBOGC_LIB) $(foreach dir,$(LIBDIRS),-L$(dir)/lib) + +export OUTPUT := $(CURDIR)/$(TARGET) +.PHONY: $(BUILD) clean + +#--------------------------------------------------------------------------------- +$(BUILD): + @[ -d $@ ] || mkdir -p $@ + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol + +#--------------------------------------------------------------------------------- +run: + wiiload $(TARGET).dol + + +#--------------------------------------------------------------------------------- +else + +DEPENDS := $(OFILES:.o=.d) + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- +$(OUTPUT).dol: $(OUTPUT).elf +$(OUTPUT).elf: $(OFILES) + +$(OFILES_SOURCES) : $(HFILES) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .jpg extension +#--------------------------------------------------------------------------------- +%.jpg.o : %.jpg +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .png extension +#--------------------------------------------------------------------------------- +%.png.o : %.png +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +-include $(DEPENDS) + +#--------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------- diff --git a/examples/gamecube/compositing/data/font3d.png b/examples/gamecube/compositing/data/font3d.png new file mode 100644 index 0000000..cce0a94 Binary files /dev/null and b/examples/gamecube/compositing/data/font3d.png differ diff --git a/examples/gamecube/compositing/source/main.c b/examples/gamecube/compositing/source/main.c new file mode 100644 index 0000000..9e2d8bd --- /dev/null +++ b/examples/gamecube/compositing/source/main.c @@ -0,0 +1,59 @@ +/*=========================================== + NoNameNo Compositing Sample Code +============================================*/ +#include + +#include +#include + +#include "font3d_png.h" + + +int main() { + float rot=0; + float i; + int circsize=150; + const char text[]="GRRLIB ROXX "; + + GRRLIB_Init(); + PAD_Init(); + + + GRRLIB_texImg *tex_font = GRRLIB_LoadTexture(font3d_png); + GRRLIB_InitTileSet(tex_font, 64, 64, 32); + GRRLIB_SetHandle(tex_font, tex_font->tilew/2, tex_font->tileh+circsize); + + GRRLIB_texImg *tex_screen = GRRLIB_CreateEmptyTexture(rmode->fbWidth,rmode->efbHeight); + + GRRLIB_Settings.antialias = true; + + while(1) { + PAD_ScanPads(); + if(PAD_ButtonsDown(0) & PAD_BUTTON_START) exit(0); + +// we say that we will want to capture to a texture all the following + GRRLIB_CompoStart(); + + for(i=0; i<360; i+=30) { +// We draw some letters + GRRLIB_DrawTile((rmode->fbWidth/2)-(tex_font->tilew/2), (rmode->efbHeight/2)-(tex_font->tileh+circsize), tex_font, rot+i, 1, 1, 0xFFFFFFFF, text[(int)(i/30)]-32); + } + +// we say we want to capture now, (the buffer will be cleared after the capture) + GRRLIB_CompoEnd(0, 0, tex_screen); + + rot-=0.6; + +// we now draw 3 times the captured buffer playing with color + GRRLIB_DrawImg(0, 0, tex_screen, 0, 1, 1, 0xFF00FFFF); + GRRLIB_DrawImg(50, 50, tex_screen, 0, 1, 1, 0xFFFF00FF); + GRRLIB_DrawImg(100, 100, tex_screen, 0, 1, 1, 0xFFFFFFFF); + + GRRLIB_Render(); + } + + GRRLIB_FreeTexture(tex_screen); + GRRLIB_FreeTexture(tex_font); + GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB + exit(0); +} diff --git a/examples/gamecube/funsin/Makefile b/examples/gamecube/funsin/Makefile new file mode 100644 index 0000000..096d10c --- /dev/null +++ b/examples/gamecube/funsin/Makefile @@ -0,0 +1,138 @@ +#--------------------------------------------------------------------------------- +# Clear the implicit built in rules +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- +ifeq ($(strip $(DEVKITPPC)),) +$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") +endif + +include $(DEVKITPPC)/gamecube_rules + +#--------------------------------------------------------------------------------- +# TARGET is the name of the output +# BUILD is the directory where object files & intermediate files will be placed +# SOURCES is a list of directories containing source code +# INCLUDES is a list of directories containing extra header files +#--------------------------------------------------------------------------------- +TARGET := $(notdir $(CURDIR)) +BUILD := build +SOURCES := source +DATA := data +INCLUDES := + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- + +CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) +CXXFLAGS = $(CFLAGS) + +LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -lgrrlib -lfreetype -lbz2 -lpngu -lpng -ljpeg -lz -lfat -logc -lm + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(CURDIR)/$(GRRLIB) $(PORTLIBS) + +#--------------------------------------------------------------------------------- +# no real need to edit anything past this point unless you need to add additional +# rules for different file extensions +#--------------------------------------------------------------------------------- +ifneq ($(BUILD),$(notdir $(CURDIR))) +#--------------------------------------------------------------------------------- + +export OUTPUT := $(CURDIR)/$(TARGET) + +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + +export DEPSDIR := $(CURDIR)/$(BUILD) + +#--------------------------------------------------------------------------------- +# automatically build a list of object files for our project +#--------------------------------------------------------------------------------- +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) +sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) + +#--------------------------------------------------------------------------------- +# use CXX for linking C++ projects, CC for standard C +#--------------------------------------------------------------------------------- +ifeq ($(strip $(CPPFILES)),) + export LD := $(CC) +else + export LD := $(CXX) +endif + +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o) +export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) + +export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) + +#--------------------------------------------------------------------------------- +# build a list of include paths +#--------------------------------------------------------------------------------- +export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) \ + -I$(LIBOGC_INC) + +#--------------------------------------------------------------------------------- +# build a list of library paths +#--------------------------------------------------------------------------------- +export LIBPATHS := -L$(LIBOGC_LIB) $(foreach dir,$(LIBDIRS),-L$(dir)/lib) + +export OUTPUT := $(CURDIR)/$(TARGET) +.PHONY: $(BUILD) clean + +#--------------------------------------------------------------------------------- +$(BUILD): + @[ -d $@ ] || mkdir -p $@ + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol + +#--------------------------------------------------------------------------------- +run: + wiiload $(TARGET).dol + + +#--------------------------------------------------------------------------------- +else + +DEPENDS := $(OFILES:.o=.d) + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- +$(OUTPUT).dol: $(OUTPUT).elf +$(OUTPUT).elf: $(OFILES) + +$(OFILES_SOURCES) : $(HFILES) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .jpg extension +#--------------------------------------------------------------------------------- +%.jpg.o : %.jpg +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +-include $(DEPENDS) + +#--------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------- diff --git a/examples/gamecube/funsin/source/main.c b/examples/gamecube/funsin/source/main.c new file mode 100644 index 0000000..65252b0 --- /dev/null +++ b/examples/gamecube/funsin/source/main.c @@ -0,0 +1,108 @@ +/*=========================================== + NoNameNo simple Gradient Sinusoid + A good start to code a nice plasma +============================================*/ +#include + +#include +#include +#include + + +int main() { + int offset1, offset2, offset3, offset4; + int periode1, periode2, periode3, periode4; + int length1, length2, length3, length4; + int amp1, amp2, amp3, amp4; + int origine1, origine2, origine3, origine4; + int adc1, adc2, adc3, adc4; + float siny1, siny2, siny3, siny4; + int x; + float pas1, pas2, pas3, pas4; + + // Initialise the Graphics & Video subsystem + GRRLIB_Init(); + + // Initialise the GameCube controllers + PAD_Init(); + + + adc1=0; + offset1=0; + origine1=0; + length1=1280; + amp1=100; + periode1=1; + pas1=(periode1*360.0F)/length1; + siny1 = offset1*pas1; + + adc2=1; + offset2=0; + origine2=0; + length2=1280; + amp2=40; + periode2=2; + pas2=(periode2*360.0F)/length2; + siny2 = offset2*pas2; + + adc3=-3; + offset3=0; + origine3=0; + length3=1280; + amp3=30; + periode3=1; + pas3=(periode3*360.0F)/length3; + siny3 = offset3*pas3; + + adc4=-7; + offset4=0; + origine4=0; + length4=1280; + amp4=70; + periode4=1; + pas4=(periode4*360.0F)/length4; + siny4 = offset4*pas4; + + + while (1) { + GRRLIB_FillScreen(0x000000FF); + PAD_ScanPads(); // Scan the GameCube controllers + if (PAD_ButtonsDown(0) & PAD_BUTTON_START) break; + float old1=siny1; + float old2=siny2; + float old3=siny3; + float old4=siny4; + + + for (x=0; x<=640; x++) { + siny1+=pas1; + siny2+=pas2; + siny3+=pas3; + siny4+=pas4; + + GX_Begin(GX_LINES, GX_VTXFMT0, 2); + GX_Position3f32(x, 0, 0); + GX_Color1u32(0x000000FF); + GX_Position3f32(x, (sin(DegToRad(siny1))*amp1+origine1)+(sin(DegToRad(siny2))*amp2+origine2)+(sin(DegToRad(siny3))*amp3+origine3)+(sin(DegToRad(siny4))*amp4+origine4)+240, 0); + GX_Color1u32(0xFF00007F); + GX_End(); + GX_Begin(GX_LINES, GX_VTXFMT0, 2); + GX_Position3f32(x, (sin(DegToRad(siny1))*amp1+origine1)+(sin(DegToRad(siny2))*amp2+origine2)+(sin(DegToRad(siny3))*amp3+origine3)+(sin(DegToRad(siny4))*amp4+origine4)+240, 0); + GX_Color1u32(0xFF00007F); + GX_Position3f32(x, 480, 0); + GX_Color1u32(0x000000FF); + GX_End(); + + } + siny1=old1+(adc1*pas1); + siny2=old2+(adc2*pas2); + siny3=old3+(adc3*pas3); + siny4=old4+(adc4*pas4); + + GRRLIB_Render(); // Render the frame buffer to the TV + } + + GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB + + exit(0); // Use exit() to exit a program, do not use 'return' from main() +} diff --git a/examples/gamecube/template/Makefile b/examples/gamecube/template/Makefile new file mode 100644 index 0000000..26d41a9 --- /dev/null +++ b/examples/gamecube/template/Makefile @@ -0,0 +1,149 @@ +#--------------------------------------------------------------------------------- +# Clear the implicit built in rules +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- +ifeq ($(strip $(DEVKITPPC)),) +$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") +endif + +include $(DEVKITPPC)/gamecube_rules + +#--------------------------------------------------------------------------------- +# TARGET is the name of the output +# BUILD is the directory where object files & intermediate files will be placed +# SOURCES is a list of directories containing source code +# INCLUDES is a list of directories containing extra header files +#--------------------------------------------------------------------------------- +TARGET := $(notdir $(CURDIR)) +BUILD := build +SOURCES := source +DATA := data +INCLUDES := + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- + +CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) +CXXFLAGS = $(CFLAGS) + +LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +# the order can-be/is critical +#--------------------------------------------------------------------------------- +LIBS := -lgrrlib -lfreetype -lbz2 -lpngu -lpng -ljpeg -lz -lfat +#LIBS += -lmodplay -laesnd +LIBS += -logc -lm + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(PORTLIBS) + +#--------------------------------------------------------------------------------- +# no real need to edit anything past this point unless you need to add additional +# rules for different file extensions +#--------------------------------------------------------------------------------- +ifneq ($(BUILD),$(notdir $(CURDIR))) +#--------------------------------------------------------------------------------- + +export OUTPUT := $(CURDIR)/$(TARGET) + +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + +export DEPSDIR := $(CURDIR)/$(BUILD) + +#--------------------------------------------------------------------------------- +# automatically build a list of object files for our project +#--------------------------------------------------------------------------------- +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) +sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) + +#--------------------------------------------------------------------------------- +# use CXX for linking C++ projects, CC for standard C +#--------------------------------------------------------------------------------- +ifeq ($(strip $(CPPFILES)),) + export LD := $(CC) +else + export LD := $(CXX) +endif + +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o) +export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) + +export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) + +#--------------------------------------------------------------------------------- +# build a list of include paths +#--------------------------------------------------------------------------------- +export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) \ + -I$(LIBOGC_INC) + +#--------------------------------------------------------------------------------- +# build a list of library paths +#--------------------------------------------------------------------------------- +export LIBPATHS := -L$(LIBOGC_LIB) $(foreach dir,$(LIBDIRS),-L$(dir)/lib) + +export OUTPUT := $(CURDIR)/$(TARGET) +.PHONY: $(BUILD) clean + +#--------------------------------------------------------------------------------- +$(BUILD): + @[ -d $@ ] || mkdir -p $@ + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol + +#--------------------------------------------------------------------------------- +run: + wiiload $(TARGET).dol + + +#--------------------------------------------------------------------------------- +else + +DEPENDS := $(OFILES:.o=.d) + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- +$(OUTPUT).dol: $(OUTPUT).elf +$(OUTPUT).elf: $(OFILES) + +$(OFILES_SOURCES) : $(HFILES) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .jpg extension +#--------------------------------------------------------------------------------- +%.jpg.o : %.jpg +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .png extension +#--------------------------------------------------------------------------------- +%.png.o : %.png +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +-include $(DEPENDS) + +#--------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------- diff --git a/examples/gamecube/template/source/main.c b/examples/gamecube/template/source/main.c new file mode 100644 index 0000000..ee9f33d --- /dev/null +++ b/examples/gamecube/template/source/main.c @@ -0,0 +1,36 @@ +/*=========================================== + GRRLIB (GX Version) + - Template Code - + + Minimum Code To Use GRRLIB +============================================*/ +#include + +#include +#include + +int main(int argc, char **argv) { + // Initialise the Graphics & Video subsystem + GRRLIB_Init(); + + // Initialise the GameCube controllers + PAD_Init(); + + // Loop forever + while(1) { + PAD_ScanPads(); // Scan the GameCube controllers + + // If [START/PAUSE] was pressed on the first GameCube controller, break out of the loop + if (PAD_ButtonsDown(0) & PAD_BUTTON_START) break; + + // --------------------------------------------------------------------- + // Place your drawing code here + // --------------------------------------------------------------------- + + GRRLIB_Render(); // Render the frame buffer to the TV + } + + GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB + + exit(0); // Use exit() to exit a program, do not use 'return' from main() +} diff --git a/examples/gamecube/ttf/Makefile b/examples/gamecube/ttf/Makefile new file mode 100644 index 0000000..d6bbcd5 --- /dev/null +++ b/examples/gamecube/ttf/Makefile @@ -0,0 +1,159 @@ +#--------------------------------------------------------------------------------- +# Clear the implicit built in rules +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- +ifeq ($(strip $(DEVKITPPC)),) +$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") +endif + +include $(DEVKITPPC)/gamecube_rules + +#--------------------------------------------------------------------------------- +# TARGET is the name of the output +# BUILD is the directory where object files & intermediate files will be placed +# SOURCES is a list of directories containing source code +# INCLUDES is a list of directories containing extra header files +#--------------------------------------------------------------------------------- +TARGET := $(notdir $(CURDIR)) +BUILD := build +SOURCES := source +DATA := data +INCLUDES := + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- + +CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) +CXXFLAGS = $(CFLAGS) + +LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +# the order can-be/is critical +#--------------------------------------------------------------------------------- +LIBS := -lgrrlib +LIBS += -lfreetype -lbz2 +LIBS += -lpngu -lpng -ljpeg -lz -lfat +#LIBS += -lmodplay -laesnd +LIBS += -logc -lm + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(PORTLIBS) + +#--------------------------------------------------------------------------------- +# no real need to edit anything past this point unless you need to add additional +# rules for different file extensions +#--------------------------------------------------------------------------------- +ifneq ($(BUILD),$(notdir $(CURDIR))) +#--------------------------------------------------------------------------------- + +export OUTPUT := $(CURDIR)/$(TARGET) + +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + +export DEPSDIR := $(CURDIR)/$(BUILD) + +#--------------------------------------------------------------------------------- +# automatically build a list of object files for our project +#--------------------------------------------------------------------------------- +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) +sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) + +#--------------------------------------------------------------------------------- +# use CXX for linking C++ projects, CC for standard C +#--------------------------------------------------------------------------------- +ifeq ($(strip $(CPPFILES)),) + export LD := $(CC) +else + export LD := $(CXX) +endif + +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o) +export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) + +export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) + +#--------------------------------------------------------------------------------- +# build a list of include paths +#--------------------------------------------------------------------------------- +export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) \ + -I$(LIBOGC_INC) + +#--------------------------------------------------------------------------------- +# build a list of library paths +#--------------------------------------------------------------------------------- +export LIBPATHS := -L$(LIBOGC_LIB) $(foreach dir,$(LIBDIRS),-L$(dir)/lib) + +export OUTPUT := $(CURDIR)/$(TARGET) +.PHONY: $(BUILD) clean + +#--------------------------------------------------------------------------------- +$(BUILD): + @[ -d $@ ] || mkdir -p $@ + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol + +#--------------------------------------------------------------------------------- +run: + wiiload $(TARGET).dol + + +#--------------------------------------------------------------------------------- +else + +DEPENDS := $(OFILES:.o=.d) + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- +$(OUTPUT).dol: $(OUTPUT).elf +$(OUTPUT).elf: $(OFILES) + +$(OFILES_SOURCES) : $(HFILES) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .jpg extension +#--------------------------------------------------------------------------------- +%.jpg.o : %.jpg +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .png extension +#--------------------------------------------------------------------------------- +%.png.o : %.png +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .ttf extension +#--------------------------------------------------------------------------------- +%.ttf.o : %.ttf +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +-include $(DEPENDS) + +#--------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------- diff --git a/examples/gamecube/ttf/data/FreeMonoBold.ttf b/examples/gamecube/ttf/data/FreeMonoBold.ttf new file mode 100644 index 0000000..9332a5a Binary files /dev/null and b/examples/gamecube/ttf/data/FreeMonoBold.ttf differ diff --git a/examples/gamecube/ttf/source/main.c b/examples/gamecube/ttf/source/main.c new file mode 100644 index 0000000..f838320 --- /dev/null +++ b/examples/gamecube/ttf/source/main.c @@ -0,0 +1,114 @@ +/*=========================================== + TrueType Font demo +============================================*/ +#include + +#include +#include +#include +#include // Needed for gettime and ticks_to_millisecs + +// Font +#include "FreeMonoBold_ttf.h" + +// Prototype +static u8 CalculateFrameRate(); + +int main(int argc, char **argv) { + bool ShowFPS = false; + + // Initialise the Graphics & Video subsystem + GRRLIB_Init(); + + // Initialise the controllers + PAD_Init(); + + // Load the font from memory + GRRLIB_ttfFont *myFont = GRRLIB_LoadTTF(FreeMonoBold_ttf, FreeMonoBold_ttf_size); + // Create an empty texture to store a copy of the screen + GRRLIB_texImg *CopiedImg = GRRLIB_CreateEmptyTexture(rmode->fbWidth, rmode->efbHeight); + + // Fill a table with characters + u32 i, n = 0; + wchar_t charTable[460]; + for(i=33; i<=126; i++) { // 0 to 93 + charTable[n++] = i; + } + for(i=161; i<=518; i++) { // 94 to 451 + charTable[n++] = i; + } + for(i=9824; i<=9831; i++) { // 452 to 459 + charTable[n++] = i; + } + + // Seed the random-number generator with current time so that + // the numbers will be different every time we run. + srand(time(NULL)); + + wchar_t Letter[2] = L""; // A character + terminal NULL + + // To have a cool effect anti-aliasing is turned on + GRRLIB_Settings.antialias = true; + + // Black background + GRRLIB_SetBackgroundColour(0x00, 0x00, 0x00, 0xFF); + + // Loop forever + while(1) { + GRRLIB_DrawImg(0, 0, CopiedImg, 0, 1, 1, 0xFFFFFFFF); + Letter[0] = charTable[rand() % 459]; + GRRLIB_PrintfTTFW(rand() % rmode->fbWidth - 50, + rand() % rmode->efbHeight - 50, + myFont, + Letter, + rand() % 180 + 20, + ((rand() % 0xFFFFFF) << 8) | 0xFF); + GRRLIB_Screen2Texture(0, 0, CopiedImg, false); + + if(ShowFPS == true) { + char FPS[255]; + snprintf(FPS, sizeof(FPS), "Current FPS: %d", CalculateFrameRate()); + GRRLIB_PrintfTTF(500+1, 25+1, myFont, FPS, 12, 0x000000FF); + GRRLIB_PrintfTTF(500, 25, myFont, FPS, 12, 0xFFFFFFFF); + } + + PAD_ScanPads(); // Scan the GameCube controllers + + if (PAD_ButtonsDown(0) & PAD_BUTTON_START) { + break; + } + if (PAD_ButtonsDown(0) & PAD_BUTTON_A) { + GRRLIB_Screen2Texture(0, 0, CopiedImg, false); + } + if (PAD_ButtonsDown(0) & PAD_BUTTON_B) { + ShowFPS = !ShowFPS; + } + + GRRLIB_Render(); // Render the frame buffer to the TV + } + + GRRLIB_FreeTexture(CopiedImg); + GRRLIB_FreeTTF(myFont); + GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB + + exit(0); // Use exit() to exit a program, do not use 'return' from main() +} + +/** + * This function calculates the number of frames we render each second. + * @return The number of frames per second. + */ +static u8 CalculateFrameRate() { + static u8 frameCount = 0; + static u32 lastTime; + static u8 FPS = 0; + u32 currentTime = ticks_to_millisecs(gettime()); + + frameCount++; + if(currentTime - lastTime > 1000) { + lastTime = currentTime; + FPS = frameCount; + frameCount = 0; + } + return FPS; +} diff --git a/examples/gamecube/unlimited2d/Makefile b/examples/gamecube/unlimited2d/Makefile new file mode 100644 index 0000000..b860446 --- /dev/null +++ b/examples/gamecube/unlimited2d/Makefile @@ -0,0 +1,147 @@ +#--------------------------------------------------------------------------------- +# Clear the implicit built in rules +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- +ifeq ($(strip $(DEVKITPPC)),) +$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") +endif + +include $(DEVKITPPC)/gamecube_rules + +#--------------------------------------------------------------------------------- +# TARGET is the name of the output +# BUILD is the directory where object files & intermediate files will be placed +# SOURCES is a list of directories containing source code +# INCLUDES is a list of directories containing extra header files +#--------------------------------------------------------------------------------- +TARGET := $(notdir $(CURDIR)) +BUILD := build +SOURCES := source +DATA := data +INCLUDES := + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- + +CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) +CXXFLAGS = $(CFLAGS) + +#LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map +LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map -Wl,--section-start,.init=0x81000000 + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -lgrrlib -lfreetype -lbz2 -lpngu -lpng -ljpeg -lz -lfat -logc -lm + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(CURDIR)/$(GRRLIB) $(PORTLIBS) + +#--------------------------------------------------------------------------------- +# no real need to edit anything past this point unless you need to add additional +# rules for different file extensions +#--------------------------------------------------------------------------------- +ifneq ($(BUILD),$(notdir $(CURDIR))) +#--------------------------------------------------------------------------------- + +export OUTPUT := $(CURDIR)/$(TARGET) + +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + +export DEPSDIR := $(CURDIR)/$(BUILD) + +#--------------------------------------------------------------------------------- +# automatically build a list of object files for our project +#--------------------------------------------------------------------------------- +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) +sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) + +#--------------------------------------------------------------------------------- +# use CXX for linking C++ projects, CC for standard C +#--------------------------------------------------------------------------------- +ifeq ($(strip $(CPPFILES)),) + export LD := $(CC) +else + export LD := $(CXX) +endif + +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o) +export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) + +export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) + +#--------------------------------------------------------------------------------- +# build a list of include paths +#--------------------------------------------------------------------------------- +export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) \ + -I$(LIBOGC_INC) + +#--------------------------------------------------------------------------------- +# build a list of library paths +#--------------------------------------------------------------------------------- +export LIBPATHS := -L$(LIBOGC_LIB) $(foreach dir,$(LIBDIRS),-L$(dir)/lib) + +export OUTPUT := $(CURDIR)/$(TARGET) +.PHONY: $(BUILD) clean + +#--------------------------------------------------------------------------------- +$(BUILD): + @[ -d $@ ] || mkdir -p $@ + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol + +#--------------------------------------------------------------------------------- +run: + wiiload $(TARGET).dol + + +#--------------------------------------------------------------------------------- +else + +DEPENDS := $(OFILES:.o=.d) + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- +$(OUTPUT).dol: $(OUTPUT).elf +$(OUTPUT).elf: $(OFILES) + +$(OFILES_SOURCES) : $(HFILES) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .jpg extension +#--------------------------------------------------------------------------------- +%.jpg.o : %.jpg +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .png extension +#--------------------------------------------------------------------------------- +%.png.o : %.png +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +-include $(DEPENDS) + +#--------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------- diff --git a/examples/gamecube/unlimited2d/data/ball.png b/examples/gamecube/unlimited2d/data/ball.png new file mode 100644 index 0000000..c675b7b Binary files /dev/null and b/examples/gamecube/unlimited2d/data/ball.png differ diff --git a/examples/gamecube/unlimited2d/data/font.png b/examples/gamecube/unlimited2d/data/font.png new file mode 100644 index 0000000..ac5131a Binary files /dev/null and b/examples/gamecube/unlimited2d/data/font.png differ diff --git a/examples/gamecube/unlimited2d/data/logo.png b/examples/gamecube/unlimited2d/data/logo.png new file mode 100644 index 0000000..8954ee6 Binary files /dev/null and b/examples/gamecube/unlimited2d/data/logo.png differ diff --git a/examples/gamecube/unlimited2d/source/main.c b/examples/gamecube/unlimited2d/source/main.c new file mode 100644 index 0000000..8bea3ff --- /dev/null +++ b/examples/gamecube/unlimited2d/source/main.c @@ -0,0 +1,100 @@ +/*=========================================== + NoNameNo FAKE Unlimited 2D Sprites rout ;) + It's a lame but Well Known technic.... +============================================*/ +#include + +#include +#include +#include +#include + + +#include "logo_png.h" +#include "font_png.h" +#include "ball_png.h" + + +int main() { + int i; + int screen_index = 0; + const int tex_screen_count = 3; + float t = 0; + const int R = 81; + const int r = 71; + const int d = 120; + float f = 0; + float ff = 0; + float spr = 0; + int n = 1; + + + GRRLIB_Init(); + PAD_Init(); + + GRRLIB_Settings.antialias = false; + + GRRLIB_texImg *tex_screen[tex_screen_count]; + for(i=0; ifbWidth, rmode->efbHeight); + } + + GRRLIB_texImg *tex_ball = GRRLIB_LoadTexture(ball_png); + GRRLIB_texImg *tex_logo = GRRLIB_LoadTexture(logo_png); + GRRLIB_texImg *tex_font = GRRLIB_LoadTexture(font_png); + GRRLIB_InitTileSet(tex_font, 16, 16, 32); + + + for(i=0; i<=255; i+=1) { + GRRLIB_Printf((640-(16*16))/2, 200, tex_font, 0xFFFFFF00|i, 1, "HOW MANY SPRITES"); + GRRLIB_Printf((640-(16*20))/2, 216, tex_font, 0xFFFFFF00|i, 1, "CAN YOU DISPLAY WITH"); + GRRLIB_DrawImg((640-352)/2, 248, tex_logo, 0, 1, 1, 0xFFFFFF00|i); + GRRLIB_Printf((640-(16*28))/2, 480-16, tex_font, 0xFFFFFF00|i, 1, "BY NONAMENO FROM GRRLIB TEAM"); + GRRLIB_Render(); + } + for(i=255; i>=0; i-=2) { + GRRLIB_Printf((640-(16*16))/2, 200, tex_font, 0xFFFFFF00|i, 1, "HOW MANY SPRITES"); + GRRLIB_Printf((640-(16*20))/2, 216, tex_font, 0xFFFFFF00|i, 1, "CAN YOU DISPLAY WITH"); + GRRLIB_DrawImg((640-352)/2, 248, tex_logo, 0, 1, 1, 0xFFFFFF00|i); + GRRLIB_Printf((640-(16*28))/2, 480-16, tex_font, 0xFFFFFF00|i, 1, "BY NONAMENO FROM GRRLIB TEAM"); + GRRLIB_Render(); + } + + while(1) { + PAD_ScanPads(); + + GRRLIB_DrawImg(0, 0, tex_screen[screen_index], 0, 1, 1, 0xFFFFFFFF); + GRRLIB_DrawImg(((R + r-ff)*cos(t-f) - d*cos(((R + r-f)/r)*t))+rmode->fbWidth/2-32, ((R + r-ff)*sin(t) - d*sin(((R + r)/r)*t)-f)+rmode->efbHeight/2-32, tex_ball, 1, 1, 1, 0xFFFFFFFF); + GRRLIB_Screen2Texture(0, 0, tex_screen[screen_index], GX_FALSE); + GRRLIB_Printf((640-(16*6*5))/2+5, 200+5, tex_font, 0x00000088, 5, "%06d", (int)spr); + GRRLIB_Printf((640-(16*6*5))/2, 200, tex_font, 0xFFEEEE88, 5, "%06d", (int)spr); + + GRRLIB_Render(); + screen_index++; + screen_index %= tex_screen_count; + spr+=0.1f; + t+=0.01f; + + if(t>n*2*M_PI) { + n++; + f+=0.01f; + } + + if(f>2*M_PI) { + f=0; + ff+=0.02f; + } + + + if(PAD_ButtonsDown(0) & PAD_BUTTON_START) exit(0); + + } + GRRLIB_FreeTexture(tex_logo); + GRRLIB_FreeTexture(tex_ball); + GRRLIB_FreeTexture(tex_font); + for(i=0; idevkitPPC") +endif + +include $(DEVKITPPC)/gamecube_rules + +#--------------------------------------------------------------------------------- +# TARGET is the name of the output +# BUILD is the directory where object files & intermediate files will be placed +# SOURCES is a list of directories containing source code +# INCLUDES is a list of directories containing extra header files +#--------------------------------------------------------------------------------- +TARGET := $(notdir $(CURDIR)) +BUILD := build +SOURCES := source +DATA := data +INCLUDES := + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- + +CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) +CXXFLAGS = $(CFLAGS) + +#LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map +LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map -Wl,--section-start,.init=0x81000000 + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -lgrrlib -lfreetype -lbz2 -lpngu -lpng -ljpeg -lz -lfat -logc -lm + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(CURDIR)/$(GRRLIB) $(PORTLIBS) + +#--------------------------------------------------------------------------------- +# no real need to edit anything past this point unless you need to add additional +# rules for different file extensions +#--------------------------------------------------------------------------------- +ifneq ($(BUILD),$(notdir $(CURDIR))) +#--------------------------------------------------------------------------------- + +export OUTPUT := $(CURDIR)/$(TARGET) + +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + +export DEPSDIR := $(CURDIR)/$(BUILD) + +#--------------------------------------------------------------------------------- +# automatically build a list of object files for our project +#--------------------------------------------------------------------------------- +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) +sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) + +#--------------------------------------------------------------------------------- +# use CXX for linking C++ projects, CC for standard C +#--------------------------------------------------------------------------------- +ifeq ($(strip $(CPPFILES)),) + export LD := $(CC) +else + export LD := $(CXX) +endif + +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o) +export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) + +export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) + +#--------------------------------------------------------------------------------- +# build a list of include paths +#--------------------------------------------------------------------------------- +export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) \ + -I$(LIBOGC_INC) + +#--------------------------------------------------------------------------------- +# build a list of library paths +#--------------------------------------------------------------------------------- +export LIBPATHS := -L$(LIBOGC_LIB) $(foreach dir,$(LIBDIRS),-L$(dir)/lib) + +export OUTPUT := $(CURDIR)/$(TARGET) +.PHONY: $(BUILD) clean + +#--------------------------------------------------------------------------------- +$(BUILD): + @[ -d $@ ] || mkdir -p $@ + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol + +#--------------------------------------------------------------------------------- +run: + wiiload $(TARGET).dol + + +#--------------------------------------------------------------------------------- +else + +DEPENDS := $(OFILES:.o=.d) + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- +$(OUTPUT).dol: $(OUTPUT).elf +$(OUTPUT).elf: $(OFILES) + +$(OFILES_SOURCES) : $(HFILES) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .jpg extension +#--------------------------------------------------------------------------------- +%.jpg.o : %.jpg +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .png extension +#--------------------------------------------------------------------------------- +%.png.o : %.png +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +-include $(DEPENDS) + +#--------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------- diff --git a/examples/gamecube/unlimited3d/data/font.png b/examples/gamecube/unlimited3d/data/font.png new file mode 100644 index 0000000..ac5131a Binary files /dev/null and b/examples/gamecube/unlimited3d/data/font.png differ diff --git a/examples/gamecube/unlimited3d/data/girl.png b/examples/gamecube/unlimited3d/data/girl.png new file mode 100644 index 0000000..9758a2b Binary files /dev/null and b/examples/gamecube/unlimited3d/data/girl.png differ diff --git a/examples/gamecube/unlimited3d/data/logo.png b/examples/gamecube/unlimited3d/data/logo.png new file mode 100644 index 0000000..8954ee6 Binary files /dev/null and b/examples/gamecube/unlimited3d/data/logo.png differ diff --git a/examples/gamecube/unlimited3d/source/main.c b/examples/gamecube/unlimited3d/source/main.c new file mode 100644 index 0000000..8ba294b --- /dev/null +++ b/examples/gamecube/unlimited3d/source/main.c @@ -0,0 +1,196 @@ +/*=========================================== + NoNameNo FAKE Unlimited 3D textured Cube rout ;) + Still the same technic used in the 2D version +============================================*/ +#include + +#include +#include +#include +#include + + +#include "girl_png.h" +#include "logo_png.h" +#include "font_png.h" + + +int main() { + int i; + int screen_index = 0; + const int tex_screen_count = 3; + float t=0; + const int R=81; + const int r=71; + const int d=120; + float f=0; + float ff=0; + float spr=0; + int n=1; + float a=0; + float cubeZ=10.0f; + float camZ=30.0f; + + GRRLIB_Init(); + PAD_Init(); + + GRRLIB_Settings.antialias = false; + + GRRLIB_texImg *tex_screen[tex_screen_count]; + for(i=0; ifbWidth, rmode->efbHeight); + } + + GRRLIB_texImg *tex_girl = GRRLIB_LoadTexture(girl_png); + GRRLIB_texImg *tex_logo = GRRLIB_LoadTexture(logo_png); + GRRLIB_texImg *tex_font = GRRLIB_LoadTexture(font_png); + GRRLIB_InitTileSet(tex_font, 16, 16, 32); + + + for(i=0; i<=255; i+=1) { + GRRLIB_Printf((640-(16*16))/2, 200, tex_font, 0xFFFFFF00|i, 1, "HOW MANY 3D CUBE"); + GRRLIB_Printf((640-(16*20))/2, 216, tex_font, 0xFFFFFF00|i, 1, "CAN YOU DISPLAY WITH"); + GRRLIB_DrawImg((640-352)/2, 248, tex_logo, 0, 1, 1, 0xFFFFFF00|i); + GRRLIB_Printf((640-(16*28))/2, 480-16, tex_font, 0xFFFFFF00|i, 1, "BY NONAMENO FROM GRRLIB TEAM"); + GRRLIB_Render(); + } + for(i=255; i>=0; i-=2) { + GRRLIB_Printf((640-(16*16))/2, 200, tex_font, 0xFFFFFF00|i, 1, "HOW MANY 3D CUBE"); + GRRLIB_Printf((640-(16*20))/2, 216, tex_font, 0xFFFFFF00|i, 1, "CAN YOU DISPLAY WITH"); + GRRLIB_DrawImg((640-352)/2, 248, tex_logo, 0, 1, 1, 0xFFFFFF00|i); + GRRLIB_Printf((640-(16*28))/2, 480-16, tex_font, 0xFFFFFF00|i, 1, "BY NONAMENO FROM GRRLIB TEAM"); + GRRLIB_Render(); + } + + GRRLIB_SetBackgroundColour(0x00, 0x00, 0x00, 0xFF); + + while(1) { + PAD_ScanPads(); + GRRLIB_Camera3dSettings(0.0f,0.0f,camZ, 0,1,0, 0,0,0); + + GRRLIB_2dMode(); + GRRLIB_DrawImg(0, 0, tex_screen[screen_index], 0, 1, 1, 0xFFFFFFFF); + + GRRLIB_3dMode(0.1, 1000, 45, 1, 0); + GRRLIB_SetBlend(GRRLIB_BLEND_ALPHA); + + + cubeZ+=0.02f; + GRRLIB_ObjectView((float)(((R + r-ff)*cos(t-f) - d*cos(((R + r-f)/r)*t)))/20.0f,(float)(((R + r-ff)*sin(t) - d*sin(((R + r)/r)*t)-f))/20.0f,sin(cubeZ)*10, a,a*2,a*3,1,1,1); + GRRLIB_SetTexture(tex_girl, 0); + GX_Begin(GX_QUADS, GX_VTXFMT0, 24); + GX_Position3f32(-1.0f,1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,0.0f); + GX_Position3f32(1.0f,1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,0.0f); + GX_Position3f32(1.0f,-1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,1.0f); + GX_Position3f32(-1.0f,-1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,1.0f); + + GX_Position3f32(1.0f,1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,0.0f); + GX_Position3f32(-1.0f,1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,0.0f); + GX_Position3f32(-1.0f,-1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,1.0f); + GX_Position3f32(1.0f,-1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,1.0f); + + GX_Position3f32(1.0f,1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,0.0f); + GX_Position3f32(1.0f,1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,0.0f); + GX_Position3f32(1.0f,-1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,1.0f); + GX_Position3f32(1.0f,-1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,1.0f); + + GX_Position3f32(-1.0f,1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,0.0f); + GX_Position3f32(-1.0f,1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,0.0f); + GX_Position3f32(-1.0f,-1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,1.0f); + GX_Position3f32(-1.0f,-1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,1.0f); + + GX_Position3f32(-1.0f,1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,0.0f); + GX_Position3f32(1.0f,1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,0.0f); + GX_Position3f32(1.0f,1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,1.0f); + GX_Position3f32(-1.0f,1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,1.0f); + + GX_Position3f32(1.0f,-1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,0.0f); + GX_Position3f32(-1.0f,-1.0f,-1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,0.0f); + GX_Position3f32(-1.0f,-1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(1.0f,1.0f); + GX_Position3f32(1.0f,-1.0f,1.0f); + GX_Color1u32(0xFFFFFFFF); + GX_TexCoord2f32(0.0f,1.0f); + GX_End(); + + a+=0.5f; + + GRRLIB_2dMode(); + GRRLIB_Screen2Texture(0, 0, tex_screen[screen_index], GX_FALSE); + GRRLIB_Printf((640-(16*6*5))/2+5, 200+5, tex_font, 0x00000088, 5, "%06d", (int)spr); + GRRLIB_Printf((640-(16*6*5))/2, 200, tex_font, 0xFFEEEE88, 5, "%06d", (int)spr); + + GRRLIB_Render(); + screen_index++; + screen_index %= tex_screen_count; + spr+=0.1f; + t+=0.01f; + + if(t>n*2*M_PI) { + n++; + f+=0.01f; + } + + if(f>2*M_PI) { + f=0; + ff+=0.02f; + } + + + if(PAD_ButtonsDown(0) & PAD_BUTTON_START) exit(0); + } + GRRLIB_FreeTexture(tex_logo); + GRRLIB_FreeTexture(tex_girl); + GRRLIB_FreeTexture(tex_font); + for(i=0; i