From 90f29de2ebd7f36ffc0597d3b378c55be15a4310 Mon Sep 17 00:00:00 2001 From: csBlueChip Date: Sun, 23 Aug 2009 14:46:40 +0000 Subject: [PATCH] Moved GRRLIB_addon to nonameno03 example directory and tweaked the c and makefile to use it accordingly --- .../nonameno03/GRRLIB_addon/GRRLIB_addon.c | 132 +++++++++ .../nonameno03/GRRLIB_addon/GRRLIB_addon.h | 33 +++ .../nonameno03/GRRLIB_addon/GRRLIBbutton.c | 32 ++ .../nonameno03/GRRLIB_addon/GRRLIBbutton.h | 14 + .../nonameno03/GRRLIB_addon/GRRLIBbutton.png | Bin 0 -> 377 bytes examples/nonameno03/GRRLIB_addon/GRRLIBfont.c | 231 +++++++++++++++ examples/nonameno03/GRRLIB_addon/GRRLIBfont.h | 14 + .../nonameno03/GRRLIB_addon/GRRLIBfont.png | Bin 0 -> 3559 bytes examples/nonameno03/Makefile | 279 +++++++++--------- examples/nonameno03/source/main.c | 6 +- 10 files changed, 598 insertions(+), 143 deletions(-) create mode 100644 examples/nonameno03/GRRLIB_addon/GRRLIB_addon.c create mode 100644 examples/nonameno03/GRRLIB_addon/GRRLIB_addon.h create mode 100644 examples/nonameno03/GRRLIB_addon/GRRLIBbutton.c create mode 100644 examples/nonameno03/GRRLIB_addon/GRRLIBbutton.h create mode 100644 examples/nonameno03/GRRLIB_addon/GRRLIBbutton.png create mode 100644 examples/nonameno03/GRRLIB_addon/GRRLIBfont.c create mode 100644 examples/nonameno03/GRRLIB_addon/GRRLIBfont.h create mode 100644 examples/nonameno03/GRRLIB_addon/GRRLIBfont.png diff --git a/examples/nonameno03/GRRLIB_addon/GRRLIB_addon.c b/examples/nonameno03/GRRLIB_addon/GRRLIB_addon.c new file mode 100644 index 0000000..f0ed574 --- /dev/null +++ b/examples/nonameno03/GRRLIB_addon/GRRLIB_addon.c @@ -0,0 +1,132 @@ +/*=========================================== + GRRLIB (GX version) 4.0.0 addon + Code : NoNameNo + Additional Code : Crayon & Xane + GX hints : RedShade +===========================================*/ + +#include +#include +#include +#include +#include +#include +#include + +#include "GRRLIBfont.h" +#include "GRRLIBbutton.h" + +extern u32 fb; +extern void *xfb[2]; +extern GXRModeObj *rmode; + +GRRLIB_texImg *tex_GRRLIBfont; +GRRLIB_texImg *tex_GRRLIBbutton; + +/** + * Initalize all addon requirement + */ +void GRRLIB_addon_Init(){ + tex_GRRLIBfont = GRRLIB_LoadTexture(GRRLIBfont); + GRRLIB_InitTileSet(tex_GRRLIBfont, 16, 19, 32); + + tex_GRRLIBbutton = GRRLIB_LoadTexture(GRRLIBbutton); + GRRLIB_InitTileSet(tex_GRRLIBbutton, 4, 24, 0); +} + +/** + * Free all addon requirement + */ +void GRRLIB_addon_Exit(){ + GRRLIB_FreeTexture(tex_GRRLIBfont); + GRRLIB_FreeTexture(tex_GRRLIBbutton); +} + +/** + * Load a texture from a file. + * @param filename The JPEG or PNG filename to load. + * @return A GRRLIB_texImg structure filled with image informations. + */ +GRRLIB_texImg *GRRLIB_LoadTextureFromFile(const char *filename) { + fatInitDefault(); + FILE *fd = fopen(filename, "rb"); + + fseek(fd, 0, SEEK_END); + long lsize = ftell(fd); + rewind(fd); + + unsigned char *buffer = (unsigned char*) malloc (sizeof(unsigned char)*lsize); + fread (buffer, 1, lsize, fd); + GRRLIB_texImg *tex = GRRLIB_LoadTexture(buffer); + free(buffer); + + fclose(fd); + return tex; +} + +/** + * Make a PNG screenshot on the SD card. + * libfat is required to use the function. + * @param File name of the file to write. + * @return true if every thing worked, false otherwise. + */ +bool GRRLIB_ScrShot(const char* File) { + int ErrorCode = -1; + IMGCTX pngContext; + + if(fatInitDefault() && (pngContext = PNGU_SelectImageFromDevice(File))) { + ErrorCode = PNGU_EncodeFromYCbYCr(pngContext, rmode->fbWidth, rmode->efbHeight, xfb[fb], 0); + PNGU_ReleaseImageContext(pngContext); + } + return !ErrorCode; +} + +/** + * Easy Button Maker. + * @param indice Index number of your button. + * @param x top-left corner X position of the button. + * @param y top-left corner Y position of the button. + * @param col color of your button. + * @param wpadx your X wpad posistion. + * @param wpady your Y wpad posistion. + * @param WPADDown your wpad button Down Status. + * @param WPADHeld your wpad button Held Status. + * @param but The wpad button you want to check. + * @param resdown You will find here the downed button index number. + * @param resheld You will find here the helded button index number. + * @param toto Text on the button. + */ +void GRRLIB_addon_Button(int indice, int x,int y,u32 col, int wpadx, int wpady, u32 WPADDown, u32 WPADHeld, int but, int *resdown, int *resheld, char toto[]){ + int butwidth=strlen(toto)*16+8; + Vector bg[]={{x+4,y,0},{x+4+strlen(toto)*16,y,0},{x+4+strlen(toto)*16,y+24,0},{x+4,y+24,0}}; + if((toto[0]=='^') && ((toto[1]=='U') || (toto[1]=='D') || (toto[1]=='L') || (toto[1]=='R'))){ + butwidth=1*16+8; + bg[1].x=x+4+1*16; + bg[2].x=x+4+1*16; + } + + GRRLIB_DrawTile(x,y, tex_GRRLIBbutton , 0, 1, 1, col,0 ); + GRRLIB_DrawTileQuad(bg, tex_GRRLIBbutton, col,1 ); + GRRLIB_DrawTile(bg[1].x,y, tex_GRRLIBbutton , 0, 1, 1, col,2); + + if(GRRLIB_PtInRect(x, y, butwidth, 24, wpadx, wpady)) { + if((toto[0]=='^') && (toto[1]=='U')) GRRLIB_Printf(x+4, y+2, tex_GRRLIBfont, 0xFFFFFFFF, 1, "%c", 0xa1); + else if((toto[0]=='^') && (toto[1]=='D')) GRRLIB_Printf(x+4, y+2, tex_GRRLIBfont, 0xFFFFFFFF, 1, "%c", 0xa2); + else if((toto[0]=='^') && (toto[1]=='L')) GRRLIB_Printf(x+4, y+2, tex_GRRLIBfont, 0xFFFFFFFF, 1, "%c", 0xa3); + else if((toto[0]=='^') && (toto[1]=='R')) GRRLIB_Printf(x+4, y+2, tex_GRRLIBfont, 0xFFFFFFFF, 1, "%c", 0xa4); + else GRRLIB_Printf(x+4, y+2, tex_GRRLIBfont, 0xFFFFFFFF, 1, toto); + if(WPADDown & but) { + *resdown=indice; + } + if(WPADHeld & but) { + *resheld=indice; + } + } + else{ + if((toto[0]=='^') && (toto[1]=='U')) GRRLIB_Printf(x+4, y+2, tex_GRRLIBfont, 0xFFFFFF77, 1, "%c", 0xa1); + else if((toto[0]=='^') && (toto[1]=='D')) GRRLIB_Printf(x+4, y+2, tex_GRRLIBfont, 0xFFFFFF77, 1, "%c", 0xa2); + else if((toto[0]=='^') && (toto[1]=='L')) GRRLIB_Printf(x+4, y+2, tex_GRRLIBfont, 0xFFFFFF77, 1, "%c", 0xa3); + else if((toto[0]=='^') && (toto[1]=='R')) GRRLIB_Printf(x+4, y+2, tex_GRRLIBfont, 0xFFFFFF77, 1, "%c", 0xa4); + else GRRLIB_Printf(x+4, y+2, tex_GRRLIBfont, 0xFFFFFF77, 1, toto); + } +} diff --git a/examples/nonameno03/GRRLIB_addon/GRRLIB_addon.h b/examples/nonameno03/GRRLIB_addon/GRRLIB_addon.h new file mode 100644 index 0000000..a832d09 --- /dev/null +++ b/examples/nonameno03/GRRLIB_addon/GRRLIB_addon.h @@ -0,0 +1,33 @@ +/*=========================================== + GRRLIB (GX version) 4.0.0 addon + Code : NoNameNo + Additional Code : Crayon & Xane + GX hints : RedShade +===========================================*/ + +#ifndef __GRRLIB_ADDON__ +#define __GRRLIB_ADDON__ + +/** + * @file GRRLIBaddon.h + * GRRLIB library. + */ + + +#ifdef __cplusplus + extern "C" { +#endif /* __cplusplus */ + +void GRRLIB_addon_Init(); +void GRRLIB_addon_Exit(); +GRRLIB_texImg *GRRLIB_LoadTextureFromFile(const char *filename); +bool GRRLIB_ScrShot(const char*); +void GRRLIB_addon_Button(int indice, int x,int y,u32 col, int wpadx, int wpady, u32 WPADDown, u32 WPADHeld, int but, int *resdown, int *resheld, char toto[]); + + +#ifdef __cplusplus + } +#endif /* __cplusplus */ + +#endif + diff --git a/examples/nonameno03/GRRLIB_addon/GRRLIBbutton.c b/examples/nonameno03/GRRLIB_addon/GRRLIBbutton.c new file mode 100644 index 0000000..2593403 --- /dev/null +++ b/examples/nonameno03/GRRLIB_addon/GRRLIBbutton.c @@ -0,0 +1,32 @@ +/* + This file was autogenerated by raw2c. +Visit http://www.devkitpro.org +*/ + +const unsigned char GRRLIBbutton[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x18, 0x08, 0x06, 0x00, 0x00, 0x00, 0xce, 0x32, 0x1c, + 0x6a, 0x00, 0x00, 0x00, 0x01, 0x73, 0x52, 0x47, 0x42, 0x00, 0xae, 0xce, 0x1c, 0xe9, 0x00, 0x00, + 0x00, 0x06, 0x62, 0x4b, 0x47, 0x44, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0xa0, 0xbd, 0xa7, 0x93, + 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x0b, 0x13, 0x00, 0x00, 0x0b, 0x13, + 0x01, 0x00, 0x9a, 0x9c, 0x18, 0x00, 0x00, 0x00, 0x07, 0x74, 0x49, 0x4d, 0x45, 0x07, 0xd9, 0x03, + 0x13, 0x02, 0x17, 0x23, 0x58, 0x89, 0x44, 0x6c, 0x00, 0x00, 0x00, 0xf9, 0x49, 0x44, 0x41, 0x54, + 0x38, 0xcb, 0xed, 0x93, 0xcd, 0x8d, 0xc5, 0x20, 0x0c, 0x84, 0x07, 0x30, 0x01, 0x29, 0x8d, 0xa4, + 0xac, 0x94, 0x96, 0x0a, 0x52, 0x4f, 0x0a, 0x48, 0x0b, 0xf9, 0x01, 0x0c, 0xde, 0x43, 0x44, 0xf4, + 0x0e, 0x79, 0x64, 0xf7, 0xbe, 0x96, 0x10, 0x17, 0x7f, 0xf2, 0x8c, 0x19, 0x14, 0x00, 0x2c, 0xcb, + 0x22, 0x22, 0x02, 0x11, 0xc1, 0x53, 0x29, 0xa5, 0xa0, 0x94, 0xc2, 0x30, 0x0c, 0x4a, 0xcd, 0xf3, + 0x2c,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x86, 0xb8, 0x36, 0x6a, 0xe5, 0x00, 0x00, 0x00, + 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 +}; +const int GRRLIBbutton_size = sizeof(GRRLIBbutton); diff --git a/examples/nonameno03/GRRLIB_addon/GRRLIBbutton.h b/examples/nonameno03/GRRLIB_addon/GRRLIBbutton.h new file mode 100644 index 0000000..099faa3 --- /dev/null +++ b/examples/nonameno03/GRRLIB_addon/GRRLIBbutton.h @@ -0,0 +1,14 @@ +/* + This file was autogenerated by raw2c. +Visit http://www.devkitpro.org +*/ + +//--------------------------------------------------------------------------------- +#ifndef _GRRLIBbutton_h_ +#define _GRRLIBbutton_h_ +//--------------------------------------------------------------------------------- +extern const unsigned char GRRLIBbutton[]; +extern const int GRRLIBbutton_size; +//--------------------------------------------------------------------------------- +#endif //_GRRLIBbutton_h_ +//--------------------------------------------------------------------------------- diff --git a/examples/nonameno03/GRRLIB_addon/GRRLIBbutton.png b/examples/nonameno03/GRRLIB_addon/GRRLIBbutton.png new file mode 100644 index 0000000000000000000000000000000000000000..2a5f48ce62264a4643d33fb3fe3e525fffc594a1 GIT binary patch literal 377 zcmeAS@N?(olHy`uVBq!ia0vp^JU}eL!3HGH8OdY;DaPU;cPEB*=VV?2Ic!PZ?k)`f zL2$v|<&%LToCO|{#S9GG!XV7ZFl&wkP>{XE)7O>#CbKY;xN=0NOAb)zr>Bc!h{fr* zlh5`ZRp4o1H(=E4U9x7%G_D|jE)VXXj6C<8UB2*DrhMNwO+dW%XF47)d|>0hWXi0D ztzt_>0(t}$Tf!GiVOsl@^@v0~qu|aZOQ!_z8{0Fvl-w6_a+v#x_k^Xhi=OA1o>z;f zd=lNEUUMq5@G zkPy*lVyIbD;|l13v+w)8 zRt~yf_^e!Iy3Rn+x$(fZ+4Ze6lSX89{-S<@9V|1wzIs{trH9Q*BLQ6A+=_V=*+iJ% zjw6Dp(@-?1w6d|G_Nb|l|ND&fOku%MW^9XB%{c=nDtmWTW+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YRMe+}j?P8<`WX2ym>;?duv+8~qT5|@#J44VHMpIz<| l0tT;NWc>~B|I(#)5co8kyRzxA@OD?$`Xbz%aNhIwe*ojQ;h+Ej literal 0 HcmV?d00001 diff --git a/examples/nonameno03/Makefile b/examples/nonameno03/Makefile index 391765f..4570bbe 100644 --- a/examples/nonameno03/Makefile +++ b/examples/nonameno03/Makefile @@ -1,140 +1,139 @@ -#--------------------------------------------------------------------------------- -# Clear the implicit built in rules -#--------------------------------------------------------------------------------- -.SUFFIXES: -#--------------------------------------------------------------------------------- -ifeq ($(strip $(DEVKITPPC)),) -$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC) -endif - -include $(DEVKITPPC)/wii_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 -#--------------------------------------------------------------------------------- -GRRLIB := ../../GRRLIB -TARGET := $(notdir $(CURDIR)) -BUILD := build -SOURCES := source source/gfx $(GRRLIB)/GRRLIB $(GRRLIB)/GRRLIB/GRRLIB_addon $(GRRLIB)/lib/libpng/pngu -DATA := data -INCLUDES := - -#--------------------------------------------------------------------------------- -# options for code generation -#--------------------------------------------------------------------------------- - -CFLAGS = -g -O2 -mrvl -Wall $(MACHDEP) $(INCLUDE) -CXXFLAGS = $(CFLAGS) - -LDFLAGS = -g $(MACHDEP) -mrvl -Wl,-Map,$(notdir $@).map - -#--------------------------------------------------------------------------------- -# any extra libraries we wish to link with the project -#--------------------------------------------------------------------------------- -LIBS := -lpng -ljpeg -lz -lfat -lwiiuse -lbte -logc -lm - -#--------------------------------------------------------------------------------- -# list of directories containing libraries, this must be the top level containing -# include and lib -#--------------------------------------------------------------------------------- -LIBDIRS := $(CURDIR)/$(GRRLIB) - -#--------------------------------------------------------------------------------- -# 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 := $(addsuffix .o,$(BINFILES)) \ - $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ - $(sFILES:.s=.o) $(SFILES:.S=.o) - -#--------------------------------------------------------------------------------- -# 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 := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ - -L$(LIBOGC_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: - psoload $(TARGET).dol - -#--------------------------------------------------------------------------------- -reload: - psoload -r $(TARGET).dol - - -#--------------------------------------------------------------------------------- -else - -DEPENDS := $(OFILES:.o=.d) - -#--------------------------------------------------------------------------------- -# main targets -#--------------------------------------------------------------------------------- -$(OUTPUT).dol: $(OUTPUT).elf -$(OUTPUT).elf: $(OFILES) - -#--------------------------------------------------------------------------------- -# This rule links in binary data with the .jpg extension -#--------------------------------------------------------------------------------- -%.jpg.o : %.jpg -#--------------------------------------------------------------------------------- - @echo $(notdir $<) - $(bin2o) - --include $(DEPENDS) - -#--------------------------------------------------------------------------------- -endif -#--------------------------------------------------------------------------------- +#--------------------------------------------------------------------------------- +# Clear the implicit built in rules +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- +ifeq ($(strip $(DEVKITPPC)),) +$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC) +endif + +include $(DEVKITPPC)/wii_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 GRRLIB_addon +DATA := data +INCLUDES := + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- + +CFLAGS = -g -O2 -mrvl -Wall $(MACHDEP) $(INCLUDE) +CXXFLAGS = $(CFLAGS) + +LDFLAGS = -g $(MACHDEP) -mrvl -Wl,-Map,$(notdir $@).map + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -lgrrlib -lpngu -lpng -ljpeg -lz -lfat -lwiiuse -lbte -logc -lm + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(CURDIR)/$(GRRLIB) + +#--------------------------------------------------------------------------------- +# 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 := $(addsuffix .o,$(BINFILES)) \ + $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ + $(sFILES:.s=.o) $(SFILES:.S=.o) + +#--------------------------------------------------------------------------------- +# 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 := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ + -L$(LIBOGC_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: + psoload $(TARGET).dol + +#--------------------------------------------------------------------------------- +reload: + psoload -r $(TARGET).dol + + +#--------------------------------------------------------------------------------- +else + +DEPENDS := $(OFILES:.o=.d) + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- +$(OUTPUT).dol: $(OUTPUT).elf +$(OUTPUT).elf: $(OFILES) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .jpg extension +#--------------------------------------------------------------------------------- +%.jpg.o : %.jpg +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + $(bin2o) + +-include $(DEPENDS) + +#--------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------- diff --git a/examples/nonameno03/source/main.c b/examples/nonameno03/source/main.c index 7d892e4..1becae5 100644 --- a/examples/nonameno03/source/main.c +++ b/examples/nonameno03/source/main.c @@ -3,8 +3,8 @@ Perhaps needs some improvement... ============================================*/ -#include "../../../GRRLIB/GRRLIB/GRRLIB.h" -#include "../../../GRRLIB/GRRLIB/GRRLIB_addon.h" +#include +#include "../GRRLIB_addon/GRRLIB_addon.h" #include "gfx/pointer.h" @@ -35,7 +35,7 @@ int main() { WPAD_ScanPads(); WPADDown = WPAD_ButtonsDown(0); WPADHeld = WPAD_ButtonsHeld(0); - WPAD_IR(WPAD_CHAN_0, &ir1); + WPAD_IR(WPAD_CHAN_0, &ir1); wpadx=ir1.sx-200; wpady=ir1.sy-250;