Add GameCube examples (#28)
1
.github/workflows/ci.yml
vendored
|
@ -26,4 +26,5 @@ jobs:
|
|||
name: examples
|
||||
path: |
|
||||
examples/**/*.elf
|
||||
examples/gamecube/**/*.dol
|
||||
!examples/template/*
|
||||
|
|
146
examples/gamecube/3D_CubedTileDemo/Makefile
Normal file
|
@ -0,0 +1,146 @@
|
|||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>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
|
||||
#---------------------------------------------------------------------------------
|
BIN
examples/gamecube/3D_CubedTileDemo/data/bg.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
examples/gamecube/3D_CubedTileDemo/data/logo.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
examples/gamecube/3D_CubedTileDemo/data/nonameno.png
Normal file
After Width: | Height: | Size: 532 B |
BIN
examples/gamecube/3D_CubedTileDemo/data/perso.png
Normal file
After Width: | Height: | Size: 7.6 KiB |
BIN
examples/gamecube/3D_CubedTileDemo/data/tile1.png
Normal file
After Width: | Height: | Size: 13 KiB |
349
examples/gamecube/3D_CubedTileDemo/source/main.c
Normal file
|
@ -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 <grrlib.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <ogc/pad.h>
|
||||
|
||||
#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},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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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3,11,12, 3,11,12, 3, 4,13,14, 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},
|
||||
{74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74},
|
||||
{74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,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, 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 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,43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 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, 0, 0, 0,43521,43521, 0, 0, 0, 0,61952,61952, 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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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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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;
|
||||
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);
|
||||
}
|
146
examples/gamecube/3D_Light1/Makefile
Normal file
|
@ -0,0 +1,146 @@
|
|||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>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
|
||||
#---------------------------------------------------------------------------------
|
BIN
examples/gamecube/3D_Light1/data/Letter_Gothic_Std_14_Bold.png
Normal file
After Width: | Height: | Size: 6.2 KiB |
86
examples/gamecube/3D_Light1/source/main.c
Normal file
|
@ -0,0 +1,86 @@
|
|||
/*===========================================
|
||||
NoNameNo
|
||||
Simple Diffuse light sample code
|
||||
============================================*/
|
||||
#include <grrlib.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <ogc/pad.h>
|
||||
|
||||
|
||||
#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);
|
||||
}
|
146
examples/gamecube/3D_Light2/Makefile
Normal file
|
@ -0,0 +1,146 @@
|
|||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>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
|
||||
#---------------------------------------------------------------------------------
|
BIN
examples/gamecube/3D_Light2/data/Rockwell_Condensed_12_Bold.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
81
examples/gamecube/3D_Light2/source/main.c
Normal file
|
@ -0,0 +1,81 @@
|
|||
/*===========================================
|
||||
NoNameNo
|
||||
Simple Lights and GRRLIB_ObjectViewInv sample
|
||||
============================================*/
|
||||
#include <grrlib.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <malloc.h>
|
||||
#include <ogc/pad.h>
|
||||
|
||||
#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);
|
||||
}
|
146
examples/gamecube/3D_Light3/Makefile
Normal file
|
@ -0,0 +1,146 @@
|
|||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>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
|
||||
#---------------------------------------------------------------------------------
|
BIN
examples/gamecube/3D_Light3/data/font9x12.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
103
examples/gamecube/3D_Light3/source/main.c
Normal file
|
@ -0,0 +1,103 @@
|
|||
/*===========================================
|
||||
NoNameNo
|
||||
|
||||
A little Specular light sample code
|
||||
============================================*/
|
||||
#include <grrlib.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <ogc/pad.h>
|
||||
|
||||
#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);
|
||||
}
|
149
examples/gamecube/3D_Light4/Makefile
Normal file
|
@ -0,0 +1,149 @@
|
|||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>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
|
||||
#---------------------------------------------------------------------------------
|
BIN
examples/gamecube/3D_Light4/data/Snap_ITC_12.png
Normal file
After Width: | Height: | Size: 6.2 KiB |
54
examples/gamecube/3D_Light4/source/main.c
Normal file
|
@ -0,0 +1,54 @@
|
|||
/*===========================================
|
||||
GRRLIB
|
||||
Spot Light Sample Code
|
||||
============================================*/
|
||||
#include <grrlib.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <ogc/pad.h>
|
||||
|
||||
#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);
|
||||
}
|
146
examples/gamecube/3D_sample1/Makefile
Normal file
|
@ -0,0 +1,146 @@
|
|||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>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
|
||||
#---------------------------------------------------------------------------------
|
BIN
examples/gamecube/3D_sample1/data/font.png
Normal file
After Width: | Height: | Size: 932 B |
106
examples/gamecube/3D_sample1/source/main.c
Normal file
|
@ -0,0 +1,106 @@
|
|||
/*===========================================
|
||||
NoNameNo
|
||||
Simple Flat 3D cube
|
||||
============================================*/
|
||||
#include <grrlib.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <malloc.h>
|
||||
#include <ogc/pad.h>
|
||||
|
||||
#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);
|
||||
}
|
146
examples/gamecube/3D_sample2/Makefile
Normal file
|
@ -0,0 +1,146 @@
|
|||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>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
|
||||
#---------------------------------------------------------------------------------
|
BIN
examples/gamecube/3D_sample2/data/font.png
Normal file
After Width: | Height: | Size: 932 B |
BIN
examples/gamecube/3D_sample2/data/girl.png
Normal file
After Width: | Height: | Size: 154 KiB |
136
examples/gamecube/3D_sample2/source/main.c
Normal file
|
@ -0,0 +1,136 @@
|
|||
/*===========================================
|
||||
NoNameNo
|
||||
Simple Textured 3D cube
|
||||
============================================*/
|
||||
#include <grrlib.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <malloc.h>
|
||||
#include <ogc/pad.h>
|
||||
|
||||
|
||||
#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);
|
||||
}
|
146
examples/gamecube/3D_sample3/Makefile
Normal file
|
@ -0,0 +1,146 @@
|
|||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>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
|
||||
#---------------------------------------------------------------------------------
|
BIN
examples/gamecube/3D_sample3/data/font.png
Normal file
After Width: | Height: | Size: 932 B |
BIN
examples/gamecube/3D_sample3/data/girl.png
Normal file
After Width: | Height: | Size: 154 KiB |
151
examples/gamecube/3D_sample3/source/main.c
Normal file
|
@ -0,0 +1,151 @@
|
|||
/*===========================================
|
||||
NoNameNo
|
||||
Simple Textured 3D cube and Compositing
|
||||
to make a nice sin wave on it ;)
|
||||
============================================*/
|
||||
#include <grrlib.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <malloc.h>
|
||||
#include <ogc/pad.h>
|
||||
|
||||
|
||||
#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; i<rmode->efbHeight; 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);
|
||||
}
|
146
examples/gamecube/3D_sample4/Makefile
Normal file
|
@ -0,0 +1,146 @@
|
|||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>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
|
||||
#---------------------------------------------------------------------------------
|
1997
examples/gamecube/3D_sample4/source/gfx/logo.h
Normal file
61
examples/gamecube/3D_sample4/source/main.c
Normal file
|
@ -0,0 +1,61 @@
|
|||
/*===========================================
|
||||
NoNameNo Simple 3D object rotating ;)
|
||||
object have to be triangulated to be used
|
||||
with this source.
|
||||
============================================*/
|
||||
#include <grrlib.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <malloc.h>
|
||||
#include <ogc/pad.h>
|
||||
|
||||
#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; i<logoNbFace*3; i+=3) {
|
||||
if(i<=(246*3*2))
|
||||
col=0xFFFFFFFF;
|
||||
else
|
||||
col=0xAAAAAAFF;
|
||||
|
||||
GX_Position3f32(logoPos[logoFac[i][0]-1].x,logoPos[logoFac[i][0]-1].y,logoPos[logoFac[i][0]-1].z);
|
||||
GX_Color1u32(col);
|
||||
|
||||
GX_Position3f32(logoPos[logoFac[i+1][0]-1].x,logoPos[logoFac[i+1][0]-1].y,logoPos[logoFac[i+1][0]-1].z);
|
||||
GX_Color1u32(col);
|
||||
|
||||
GX_Position3f32(logoPos[logoFac[i+2][0]-1].x,logoPos[logoFac[i+2][0]-1].y,logoPos[logoFac[i+2][0]-1].z);
|
||||
GX_Color1u32(col);
|
||||
}
|
||||
GX_End();
|
||||
|
||||
a+=0.5f;
|
||||
GRRLIB_Render();
|
||||
}
|
||||
GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB
|
||||
|
||||
exit(0);
|
||||
}
|
146
examples/gamecube/3D_sample5/Makefile
Normal file
|
@ -0,0 +1,146 @@
|
|||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>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
|
||||
#---------------------------------------------------------------------------------
|
BIN
examples/gamecube/3D_sample5/data/font.png
Normal file
After Width: | Height: | Size: 932 B |
103
examples/gamecube/3D_sample5/source/main.c
Normal file
|
@ -0,0 +1,103 @@
|
|||
/*===========================================
|
||||
NoNameNo
|
||||
Simple Flat 3D cube
|
||||
============================================*/
|
||||
#include <grrlib.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <malloc.h>
|
||||
#include <ogc/pad.h>
|
||||
|
||||
#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);
|
||||
}
|
12
examples/gamecube/Makefile
Normal file
|
@ -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;
|
146
examples/gamecube/TileDemo/Makefile
Normal file
|
@ -0,0 +1,146 @@
|
|||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>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
|
||||
#---------------------------------------------------------------------------------
|
BIN
examples/gamecube/TileDemo/data/bg.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
examples/gamecube/TileDemo/data/logo.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
examples/gamecube/TileDemo/data/nonameno.png
Normal file
After Width: | Height: | Size: 532 B |
BIN
examples/gamecube/TileDemo/data/perso.png
Normal file
After Width: | Height: | Size: 7.6 KiB |
BIN
examples/gamecube/TileDemo/data/tile1.png
Normal file
After Width: | Height: | Size: 13 KiB |
274
examples/gamecube/TileDemo/source/main.c
Normal file
|
@ -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 <grrlib.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <ogc/pad.h>
|
||||
|
||||
#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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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, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 6, 7, 3, 8, 9, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10, 1,10, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3,11,12, 3,11,12, 3, 4,13,14, 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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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 0, 0,43521,43521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 8, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43521,43521, 0, 0,43521,43521, 0, 0, 0,63744,63744, 0,64000,64000, 0,64256,64256, 0, 0, 0, 0, 0, 0, 2, 8, 0, 0, 0, 0, 0, 0, 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, 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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,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, 0, 0, 0,43521,43521, 0, 0, 0, 0,61952,61952, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 8, 2, 8, 2, 8, 2, 8, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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);
|
||||
}
|
162
examples/gamecube/basic_drawing/Makefile
Normal file
|
@ -0,0 +1,162 @@
|
|||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>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
|
||||
#---------------------------------------------------------------------------------
|
BIN
examples/gamecube/basic_drawing/data/BMfont1.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
examples/gamecube/basic_drawing/data/BMfont2.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
examples/gamecube/basic_drawing/data/BMfont3.png
Normal file
After Width: | Height: | Size: 6.4 KiB |
BIN
examples/gamecube/basic_drawing/data/BMfont4.png
Normal file
After Width: | Height: | Size: 932 B |
BIN
examples/gamecube/basic_drawing/data/BMfont5.png
Normal file
After Width: | Height: | Size: 6.2 KiB |
BIN
examples/gamecube/basic_drawing/data/frontal.bmf
Normal file
BIN
examples/gamecube/basic_drawing/data/ocean.bmf
Normal file
BIN
examples/gamecube/basic_drawing/data/sprite.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
examples/gamecube/basic_drawing/data/test_bmp.bmp
Normal file
After Width: | Height: | Size: 8 KiB |
BIN
examples/gamecube/basic_drawing/data/test_jpg.jpg
Normal file
After Width: | Height: | Size: 13 KiB |
230
examples/gamecube/basic_drawing/source/main.c
Normal file
|
@ -0,0 +1,230 @@
|
|||
/*===========================================
|
||||
GRRLIB (GX Version)
|
||||
- Example Code -
|
||||
|
||||
How To use Bitmap Fonts
|
||||
============================================*/
|
||||
#include <grrlib.h>
|
||||
|
||||
#include <ogc/lwp_watchdog.h> // Needed for gettime and ticks_to_millisecs
|
||||
#include <stdlib.h>
|
||||
#include <fat.h>
|
||||
|
||||
#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;
|
||||
}
|
146
examples/gamecube/bitmap_fx/Makefile
Normal file
|
@ -0,0 +1,146 @@
|
|||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>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
|
||||
#---------------------------------------------------------------------------------
|
BIN
examples/gamecube/bitmap_fx/data/font1.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
examples/gamecube/bitmap_fx/data/pirate.png
Normal file
After Width: | Height: | Size: 44 KiB |
232
examples/gamecube/bitmap_fx/source/main.c
Normal file
|
@ -0,0 +1,232 @@
|
|||
/*===========================================
|
||||
GRRLIB (GX Version)
|
||||
- Example Code -
|
||||
|
||||
How To use Bitmap FX
|
||||
============================================*/
|
||||
#include <grrlib.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <ogc/pad.h>
|
||||
|
||||
#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;
|
||||
}
|
146
examples/gamecube/compositing/Makefile
Normal file
|
@ -0,0 +1,146 @@
|
|||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>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
|
||||
#---------------------------------------------------------------------------------
|
BIN
examples/gamecube/compositing/data/font3d.png
Normal file
After Width: | Height: | Size: 17 KiB |
59
examples/gamecube/compositing/source/main.c
Normal file
|
@ -0,0 +1,59 @@
|
|||
/*===========================================
|
||||
NoNameNo Compositing Sample Code
|
||||
============================================*/
|
||||
#include <grrlib.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <ogc/pad.h>
|
||||
|
||||
#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);
|
||||
}
|
138
examples/gamecube/funsin/Makefile
Normal file
|
@ -0,0 +1,138 @@
|
|||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>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
|
||||
#---------------------------------------------------------------------------------
|
108
examples/gamecube/funsin/source/main.c
Normal file
|
@ -0,0 +1,108 @@
|
|||
/*===========================================
|
||||
NoNameNo simple Gradient Sinusoid
|
||||
A good start to code a nice plasma
|
||||
============================================*/
|
||||
#include <grrlib.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <ogc/pad.h>
|
||||
|
||||
|
||||
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()
|
||||
}
|
149
examples/gamecube/template/Makefile
Normal file
|
@ -0,0 +1,149 @@
|
|||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>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
|
||||
#---------------------------------------------------------------------------------
|
36
examples/gamecube/template/source/main.c
Normal file
|
@ -0,0 +1,36 @@
|
|||
/*===========================================
|
||||
GRRLIB (GX Version)
|
||||
- Template Code -
|
||||
|
||||
Minimum Code To Use GRRLIB
|
||||
============================================*/
|
||||
#include <grrlib.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <ogc/pad.h>
|
||||
|
||||
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()
|
||||
}
|
159
examples/gamecube/ttf/Makefile
Normal file
|
@ -0,0 +1,159 @@
|
|||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>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
|
||||
#---------------------------------------------------------------------------------
|
BIN
examples/gamecube/ttf/data/FreeMonoBold.ttf
Normal file
114
examples/gamecube/ttf/source/main.c
Normal file
|
@ -0,0 +1,114 @@
|
|||
/*===========================================
|
||||
TrueType Font demo
|
||||
============================================*/
|
||||
#include <grrlib.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <ogc/pad.h>
|
||||
#include <ogc/lwp_watchdog.h> // 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;
|
||||
}
|
147
examples/gamecube/unlimited2d/Makefile
Normal file
|
@ -0,0 +1,147 @@
|
|||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>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
|
||||
#---------------------------------------------------------------------------------
|
BIN
examples/gamecube/unlimited2d/data/ball.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
BIN
examples/gamecube/unlimited2d/data/font.png
Normal file
After Width: | Height: | Size: 932 B |
BIN
examples/gamecube/unlimited2d/data/logo.png
Normal file
After Width: | Height: | Size: 622 B |
100
examples/gamecube/unlimited2d/source/main.c
Normal file
|
@ -0,0 +1,100 @@
|
|||
/*===========================================
|
||||
NoNameNo FAKE Unlimited 2D Sprites rout ;)
|
||||
It's a lame but Well Known technic....
|
||||
============================================*/
|
||||
#include <grrlib.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <malloc.h>
|
||||
#include <ogc/pad.h>
|
||||
|
||||
|
||||
#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; i<tex_screen_count; i++) {
|
||||
tex_screen[i] = GRRLIB_CreateEmptyTexture(rmode->fbWidth, 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; i<tex_screen_count; i++) {
|
||||
GRRLIB_FreeTexture(tex_screen[i]);
|
||||
}
|
||||
GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB
|
||||
return 0;
|
||||
}
|
147
examples/gamecube/unlimited3d/Makefile
Normal file
|
@ -0,0 +1,147 @@
|
|||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>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
|
||||
#---------------------------------------------------------------------------------
|
BIN
examples/gamecube/unlimited3d/data/font.png
Normal file
After Width: | Height: | Size: 932 B |
BIN
examples/gamecube/unlimited3d/data/girl.png
Normal file
After Width: | Height: | Size: 154 KiB |
BIN
examples/gamecube/unlimited3d/data/logo.png
Normal file
After Width: | Height: | Size: 622 B |
196
examples/gamecube/unlimited3d/source/main.c
Normal file
|
@ -0,0 +1,196 @@
|
|||
/*===========================================
|
||||
NoNameNo FAKE Unlimited 3D textured Cube rout ;)
|
||||
Still the same technic used in the 2D version
|
||||
============================================*/
|
||||
#include <grrlib.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <malloc.h>
|
||||
#include <ogc/pad.h>
|
||||
|
||||
|
||||
#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; i<tex_screen_count; i++) {
|
||||
tex_screen[i] = GRRLIB_CreateEmptyTexture(rmode->fbWidth, 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<tex_screen_count; i++) {
|
||||
GRRLIB_FreeTexture(tex_screen[i]);
|
||||
}
|
||||
GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB
|
||||
|
||||
return 0;
|
||||
}
|