[CHG] Cleanup examples

This commit is contained in:
Crayon2000 2009-12-15 22:32:21 +00:00
parent d2355216d2
commit bd928df11b
7 changed files with 203 additions and 217 deletions

View file

@ -17,7 +17,7 @@ include $(DEVKITPPC)/wii_rules
#---------------------------------------------------------------------------------
TARGET := $(notdir $(CURDIR))
BUILD := build
SOURCES := source source/gfx GRRLIB_addon
SOURCES := source source/gfx
DATA := data
INCLUDES :=

View file

@ -129,22 +129,17 @@ signed int Map1Info[53][87] =
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
int main() {
int startx=0,starty=0;
int x=0,y=0;
int dirx=0,diry=0;
int cptx=0,cpty=0;
int bgx=-32,bgy=-32;
float idperso=0;
int i=0;
float sinnonameno=0, oldsinnonameno=0;
float camZ=1400.0f;
float a=0;
u32 col[3];
col[0]=0xFFFFFFFF;
col[1]=0xFFFFFFFF;
col[2]=0xFFFFFFFF;
int startx=0, starty=0;
int x=0, y=0;
int dirx=0, diry=0;
int cptx=0, cpty=0;
int bgx=-32, bgy=-32;
float idperso=0;
int i=0;
float sinnonameno=0, oldsinnonameno=0;
float camZ=1400.0f;
float a=0;
u32 col[3] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};
GRRLIB_Init();
GRRLIB_Settings.antialias = false;
@ -160,109 +155,111 @@ u32 col[3];
GRRLIB_texImg *tex_screen = GRRLIB_CreateEmptyTexture(rmode->fbWidth, rmode->efbHeight);
GRRLIB_setBackgroundColour(0x00, 0x00, 0x00, 0xFF);
while(1){
while(1) {
GRRLIB_2dMode();
WPAD_ScanPads();
if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) break ;
if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_PLUS) camZ+=20.0f ;
if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_MINUS) camZ-=20.0f ;
if((dirx==0) && (diry==0)){
if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_LEFT){ diry=-4; idperso=15;}
else if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_RIGHT){ diry=4; idperso=15;}
else if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_DOWN){ dirx=-4 ; idperso=1;}
else if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_UP){ dirx=4 ; idperso=8;}
if((dirx==0) && (diry==0)) {
if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_LEFT) { diry=-4; idperso=15;}
else if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_RIGHT) { diry=4; idperso=15;}
else if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_DOWN) { dirx=-4 ; idperso=1;}
else if (WPAD_ButtonsHeld(0) & WPAD_BUTTON_UP) { dirx=4 ; idperso=8;}
}
if((dirx==0) && (diry==0)){
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))){
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)){
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{
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)){
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{
else {
idperso++;
if(idperso>14)
idperso=8;
}
}
if(diry<0){
if((Map1Info[9+starty][10+startx]==1) || (Map1Info[9+starty][11+startx]==1)){
if(diry<0) {
if((Map1Info[9+starty][10+startx]==1) || (Map1Info[9+starty][11+startx]==1)) {
diry=0;
}
}
if(diry!=0){
if(diry!=0) {
idperso++;
if(idperso>22)
idperso=16;
}
cptx+=dirx;
if(dirx>0) bgx++;
if(dirx<0) bgx--;
if((bgx>-1) ||(bgx<-63))
if(dirx>0)
bgx++;
else if(dirx<0)
bgx--;
if((bgx>-1) || (bgx<-63))
bgx=-32;
if(cptx==32){
if(cptx==32) {
cptx=0;
dirx=0;
startx--;
}
if(cptx==-32){
else if(cptx==-32) {
cptx=0;
dirx=0;
startx++;
}
cpty+=diry;
if(diry>0) bgy++;
if(diry<0) bgy--;
if(diry>0)
bgy++;
else if(diry<0)
bgy--;
if((bgy>-1) ||(bgy<-63))
bgy=-32;
if(cpty==32){
if(cpty==32) {
cpty=0;
diry=0;
starty--;
}
if(cpty==-32){
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))){
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);
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){
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);
}
}
@ -270,7 +267,7 @@ u32 col[3];
GRRLIB_DrawTile(TileMap1Width*9,TileMap1Height*6,tex_perso,0,1,1,0xFFFFFFFF,(int)idperso);
oldsinnonameno=sinnonameno;
for(i=0;i<8;i++){
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;
}
@ -335,10 +332,10 @@ u32 col[3];
GX_Position3f32(-rmode->fbWidth/2,-rmode->efbHeight/2,-rmode->fbWidth/2);
GX_Color1u32(col[1]);
GX_TexCoord2f32(0.0f,1.0f);
GX_End();
a+=0.2f;
GRRLIB_Render();
}
@ -351,4 +348,3 @@ u32 col[3];
exit(0);
}

View file

@ -13,10 +13,7 @@
int main() {
float a=0;
u32 col[3];
col[0]=0xFFFFFFFF;
col[1]=0xAAAAAAFF;
col[2]=0x666666FF;
u32 col[3] = {0xFFFFFFFF, 0xAAAAAAFF, 0x666666FF};
int cubeZ=0;
GRRLIB_Init();

View file

@ -15,10 +15,7 @@
int main() {
float a=0;
u32 col[3];
col[0]=0xFFFFFFFF;
col[1]=0xFFFFFFFF;
col[2]=0xFFFFFFFF;
u32 col[3] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};
int cubeZ=0;
GRRLIB_Init();
@ -138,4 +135,3 @@ int main() {
exit(0);
}

View file

@ -17,14 +17,11 @@
extern GXRModeObj *rmode;
int main() {
float a=0;
u32 col[3];
col[0]=0xFFFFFFFF;
col[1]=0xFFFFFFFF;
col[2]=0xFFFFFFFF;
int cubeZ=5;
int i=0;
float sinx=0,oldsinx=0;
float a=0;
u32 col[3] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};
int cubeZ=5;
int i=0;
float sinx=0, oldsinx=0;
GRRLIB_Init();
WPAD_Init();
@ -138,7 +135,7 @@ float sinx=0,oldsinx=0;
// Switch To 2D Mode to display text
GRRLIB_2dMode();
oldsinx=sinx;
for(i=0;i<rmode->efbHeight;i++){
for(i=0; i<rmode->efbHeight; i++) {
GRRLIB_DrawTile(0+sin(sinx)*60,i,tex_screen,0,1,1,0xFFFFFFFF,i);
sinx+=0.02f;
}

View file

@ -11,15 +11,11 @@
#include <wiiuse/wpad.h>
#include "gfx/logo.h"
extern GXRModeObj *rmode;
extern Mtx _GRR_view;
int main() {
int i=0;
float a=0;
u32 col;
int i=0;
float a=0;
u32 col;
GRRLIB_Init();
WPAD_Init();
@ -39,9 +35,11 @@ u32 col;
GRRLIB_3dMode(0.1,1000,45,0);
GRRLIB_objectView(0,0,-30, a,a*2,a*3);
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;
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);

View file

@ -139,7 +139,7 @@ int main() {
GRRLIB_Init();
GRRLIB_Settings.antialias = false;
WPAD_Init();
GRRLIB_ClipDrawing(0,0,640,480);
GRRLIB_ClipDrawing(0,0,rmode->fbWidth,rmode->efbHeight);
GRRLIB_texImg *tex_tile1 = GRRLIB_LoadTexture(tile1);
GRRLIB_InitTileSet(tex_tile1, TileMap1Width, TileMap1Height, 0);
GRRLIB_texImg *tex_perso = GRRLIB_LoadTexture(perso);
@ -203,8 +203,10 @@ int main() {
}
cptx+=dirx;
if(dirx>0) bgx++;
if(dirx<0) bgx--;
if(dirx>0)
bgx++;
else if(dirx<0)
bgx--;
if((bgx>-1) ||(bgx<-63))
bgx=-32;