mirror of
https://github.com/GRRLIB/GRRLIB.git
synced 2024-12-22 18:39:18 +00:00
[CHG] Cleanup
This commit is contained in:
parent
4ea093ca25
commit
fca67fc044
3 changed files with 158 additions and 159 deletions
|
@ -17,7 +17,7 @@ include $(DEVKITPPC)/wii_rules
|
|||
#---------------------------------------------------------------------------------
|
||||
TARGET := $(notdir $(CURDIR))
|
||||
BUILD := build
|
||||
SOURCES := source source/gfx GRRLIB_addon
|
||||
SOURCES := source
|
||||
DATA := data
|
||||
INCLUDES :=
|
||||
|
||||
|
@ -33,7 +33,7 @@ LDFLAGS = -g $(MACHDEP) -mrvl -Wl,-Map,$(notdir $@).map
|
|||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lmodplay -lasnd -lgrrlib -lpngu -lpng -ljpeg -lz -lfat -lwiiuse -lbte -logc -lm
|
||||
LIBS := -lgrrlib -lpngu -lpng -ljpeg -lz -lfat -lwiiuse -lbte -logc -lm
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*===========================================
|
||||
NoNameNo simple Gradient Sinusoid
|
||||
NoNameNo simple Gradient Sinusoid
|
||||
A good start to code a nice plasma
|
||||
============================================*/
|
||||
#include <grrlib.h>
|
||||
|
@ -8,18 +8,17 @@
|
|||
#include <wiiuse/wpad.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 old1, old2, old3, old4;
|
||||
float siny1, siny2, siny3, siny4;
|
||||
int x;
|
||||
float pas1, pas2, pas3, pas4;
|
||||
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 old1, old2, old3, old4;
|
||||
float siny1, siny2, siny3, siny4;
|
||||
int x;
|
||||
float pas1, pas2, pas3, pas4;
|
||||
|
||||
// Initialise the Graphics & Video subsystem
|
||||
GRRLIB_Init();
|
||||
|
@ -28,69 +27,74 @@ float pas1, pas2, pas3, pas4;
|
|||
WPAD_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;
|
||||
adc1=0;
|
||||
offset1=0;
|
||||
origine1=0;
|
||||
length1=1280;
|
||||
amp1=100;
|
||||
periode1=1;
|
||||
pas1=(periode1*360.0F)/length1;
|
||||
siny1 = offset1*pas1;
|
||||
|
||||
adc3=-3;
|
||||
offset3=0;
|
||||
origine3=0;
|
||||
length3=1280;
|
||||
amp3=30;
|
||||
periode3=1;
|
||||
pas3=(periode3*360.0F)/length3;
|
||||
siny3 = offset3*pas3;
|
||||
adc2=1;
|
||||
offset2=0;
|
||||
origine2=0;
|
||||
length2=1280;
|
||||
amp2=40;
|
||||
periode2=2;
|
||||
pas2=(periode2*360.0F)/length2;
|
||||
siny2 = offset2*pas2;
|
||||
|
||||
adc4=-7;
|
||||
offset4=0;
|
||||
origine4=0;
|
||||
length4=1280;
|
||||
amp4=70;
|
||||
periode4=1;
|
||||
pas4=(periode4*360.0F)/length4;
|
||||
siny4 = offset4*pas4;
|
||||
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);
|
||||
GRRLIB_FillScreen(0x000000FF);
|
||||
WPAD_ScanPads(); // Scan the wiimotes
|
||||
if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) break ;
|
||||
old1=siny1;old2=siny2;old3=siny3;old4=siny4;
|
||||
old1=siny1;old2=siny2;old3=siny3;old4=siny4;
|
||||
|
||||
|
||||
for(x=0;x<=640;x++) {
|
||||
siny1+=pas1;
|
||||
siny2+=pas2;
|
||||
siny3+=pas3;
|
||||
siny4+=pas4;
|
||||
|
||||
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();
|
||||
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);
|
||||
}
|
||||
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
|
||||
}
|
||||
|
|
|
@ -24,18 +24,15 @@ int main() {
|
|||
int i;
|
||||
int screen_index = 0;
|
||||
float t=0;
|
||||
int R=81;
|
||||
int r=71;
|
||||
int d=120;
|
||||
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;
|
||||
u32 col[3];
|
||||
col[0]=0xFFFFFFFF;
|
||||
col[1]=0xFFFFFFFF;
|
||||
col[2]=0xAAAAAAFF;
|
||||
u32 col[3] = {0xFFFFFFFF, 0xFFFFFFFF, 0xAAAAAAFF};
|
||||
float cubeZ=10.0f;
|
||||
float camZ=30.0f;;
|
||||
|
||||
|
@ -55,16 +52,14 @@ int main() {
|
|||
GRRLIB_InitTileSet(tex_font, 16, 16, 32);
|
||||
|
||||
|
||||
|
||||
|
||||
for(i=0;i<=255;i+=1){
|
||||
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){
|
||||
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);
|
||||
|
@ -81,105 +76,105 @@ int main() {
|
|||
GRRLIB_2dMode();
|
||||
GRRLIB_DrawImg(0, 0, tex_screen[screen_index], 0, 1, 1, 0xFFFFFFFF);
|
||||
|
||||
GRRLIB_3dMode(0.1,1000,45,1);
|
||||
GRRLIB_SetBlend(GRRLIB_BLEND_ALPHA);
|
||||
GRRLIB_3dMode(0.1, 1000, 45, 1);
|
||||
GRRLIB_SetBlend(GRRLIB_BLEND_ALPHA);
|
||||
|
||||
|
||||
cubeZ+=0.02f;
|
||||
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);
|
||||
GRRLIB_setTexture(tex_girl,0);
|
||||
GRRLIB_setTexture(tex_girl, 0);
|
||||
GX_Begin(GX_QUADS, GX_VTXFMT0, 24);
|
||||
GX_Position3f32(-1.0f,1.0f,1.0f);
|
||||
GX_Color1u32(col[0]);
|
||||
GX_TexCoord2f32(0.0f,0.0f);
|
||||
GX_Position3f32(1.0f,1.0f,1.0f);
|
||||
GX_Color1u32(col[0]);
|
||||
GX_TexCoord2f32(1.0f,0.0f);
|
||||
GX_Position3f32(1.0f,-1.0f,1.0f);
|
||||
GX_Color1u32(col[0]);
|
||||
GX_TexCoord2f32(1.0f,1.0f);
|
||||
GX_Position3f32(-1.0f,-1.0f,1.0f);
|
||||
GX_Color1u32(col[0]);
|
||||
GX_TexCoord2f32(0.0f,1.0f);
|
||||
GX_Position3f32(-1.0f,1.0f,1.0f);
|
||||
GX_Color1u32(col[0]);
|
||||
GX_TexCoord2f32(0.0f,0.0f);
|
||||
GX_Position3f32(1.0f,1.0f,1.0f);
|
||||
GX_Color1u32(col[0]);
|
||||
GX_TexCoord2f32(1.0f,0.0f);
|
||||
GX_Position3f32(1.0f,-1.0f,1.0f);
|
||||
GX_Color1u32(col[0]);
|
||||
GX_TexCoord2f32(1.0f,1.0f);
|
||||
GX_Position3f32(-1.0f,-1.0f,1.0f);
|
||||
GX_Color1u32(col[0]);
|
||||
GX_TexCoord2f32(0.0f,1.0f);
|
||||
|
||||
GX_Position3f32(1.0f,1.0f,-1.0f);
|
||||
GX_Color1u32(col[0]);
|
||||
GX_TexCoord2f32(0.0f,0.0f);
|
||||
GX_Position3f32(-1.0f,1.0f,-1.0f);
|
||||
GX_Color1u32(col[0]);
|
||||
GX_TexCoord2f32(1.0f,0.0f);
|
||||
GX_Position3f32(-1.0f,-1.0f,-1.0f);
|
||||
GX_Color1u32(col[0]);
|
||||
GX_TexCoord2f32(1.0f,1.0f);
|
||||
GX_Position3f32(1.0f,-1.0f,-1.0f);
|
||||
GX_Color1u32(col[0]);
|
||||
GX_TexCoord2f32(0.0f,1.0f);
|
||||
GX_Position3f32(1.0f,1.0f,-1.0f);
|
||||
GX_Color1u32(col[0]);
|
||||
GX_TexCoord2f32(0.0f,0.0f);
|
||||
GX_Position3f32(-1.0f,1.0f,-1.0f);
|
||||
GX_Color1u32(col[0]);
|
||||
GX_TexCoord2f32(1.0f,0.0f);
|
||||
GX_Position3f32(-1.0f,-1.0f,-1.0f);
|
||||
GX_Color1u32(col[0]);
|
||||
GX_TexCoord2f32(1.0f,1.0f);
|
||||
GX_Position3f32(1.0f,-1.0f,-1.0f);
|
||||
GX_Color1u32(col[0]);
|
||||
GX_TexCoord2f32(0.0f,1.0f);
|
||||
|
||||
GX_Position3f32(1.0f,1.0f,1.0f);
|
||||
GX_Color1u32(col[1]);
|
||||
GX_TexCoord2f32(0.0f,0.0f);
|
||||
GX_Position3f32(1.0f,1.0f,-1.0f);
|
||||
GX_Color1u32(col[1]);
|
||||
GX_TexCoord2f32(1.0f,0.0f);
|
||||
GX_Position3f32(1.0f,-1.0f,-1.0f);
|
||||
GX_Color1u32(col[1]);
|
||||
GX_TexCoord2f32(1.0f,1.0f);
|
||||
GX_Position3f32(1.0f,-1.0f,1.0f);
|
||||
GX_Color1u32(col[1]);
|
||||
GX_TexCoord2f32(0.0f,1.0f);
|
||||
GX_Position3f32(1.0f,1.0f,1.0f);
|
||||
GX_Color1u32(col[1]);
|
||||
GX_TexCoord2f32(0.0f,0.0f);
|
||||
GX_Position3f32(1.0f,1.0f,-1.0f);
|
||||
GX_Color1u32(col[1]);
|
||||
GX_TexCoord2f32(1.0f,0.0f);
|
||||
GX_Position3f32(1.0f,-1.0f,-1.0f);
|
||||
GX_Color1u32(col[1]);
|
||||
GX_TexCoord2f32(1.0f,1.0f);
|
||||
GX_Position3f32(1.0f,-1.0f,1.0f);
|
||||
GX_Color1u32(col[1]);
|
||||
GX_TexCoord2f32(0.0f,1.0f);
|
||||
|
||||
GX_Position3f32(-1.0f,1.0f,-1.0f);
|
||||
GX_Color1u32(col[1]);
|
||||
GX_TexCoord2f32(0.0f,0.0f);
|
||||
GX_Position3f32(-1.0f,1.0f,1.0f);
|
||||
GX_Color1u32(col[1]);
|
||||
GX_TexCoord2f32(1.0f,0.0f);
|
||||
GX_Position3f32(-1.0f,-1.0f,1.0f);
|
||||
GX_Color1u32(col[1]);
|
||||
GX_TexCoord2f32(1.0f,1.0f);
|
||||
GX_Position3f32(-1.0f,-1.0f,-1.0f);
|
||||
GX_Color1u32(col[1]);
|
||||
GX_TexCoord2f32(0.0f,1.0f);
|
||||
GX_Position3f32(-1.0f,1.0f,-1.0f);
|
||||
GX_Color1u32(col[1]);
|
||||
GX_TexCoord2f32(0.0f,0.0f);
|
||||
GX_Position3f32(-1.0f,1.0f,1.0f);
|
||||
GX_Color1u32(col[1]);
|
||||
GX_TexCoord2f32(1.0f,0.0f);
|
||||
GX_Position3f32(-1.0f,-1.0f,1.0f);
|
||||
GX_Color1u32(col[1]);
|
||||
GX_TexCoord2f32(1.0f,1.0f);
|
||||
GX_Position3f32(-1.0f,-1.0f,-1.0f);
|
||||
GX_Color1u32(col[1]);
|
||||
GX_TexCoord2f32(0.0f,1.0f);
|
||||
|
||||
GX_Position3f32(-1.0f,1.0f,-1.0f);
|
||||
GX_Color1u32(col[2]);
|
||||
GX_TexCoord2f32(0.0f,0.0f);
|
||||
GX_Position3f32(1.0f,1.0f,-1.0f);
|
||||
GX_Color1u32(col[2]);
|
||||
GX_TexCoord2f32(1.0f,0.0f);
|
||||
GX_Position3f32(1.0f,1.0f,1.0f);
|
||||
GX_Color1u32(col[2]);
|
||||
GX_TexCoord2f32(1.0f,1.0f);
|
||||
GX_Position3f32(-1.0f,1.0f,1.0f);
|
||||
GX_Color1u32(col[2]);
|
||||
GX_TexCoord2f32(0.0f,1.0f);
|
||||
GX_Position3f32(-1.0f,1.0f,-1.0f);
|
||||
GX_Color1u32(col[2]);
|
||||
GX_TexCoord2f32(0.0f,0.0f);
|
||||
GX_Position3f32(1.0f,1.0f,-1.0f);
|
||||
GX_Color1u32(col[2]);
|
||||
GX_TexCoord2f32(1.0f,0.0f);
|
||||
GX_Position3f32(1.0f,1.0f,1.0f);
|
||||
GX_Color1u32(col[2]);
|
||||
GX_TexCoord2f32(1.0f,1.0f);
|
||||
GX_Position3f32(-1.0f,1.0f,1.0f);
|
||||
GX_Color1u32(col[2]);
|
||||
GX_TexCoord2f32(0.0f,1.0f);
|
||||
|
||||
GX_Position3f32(1.0f,-1.0f,-1.0f);
|
||||
GX_Color1u32(col[2]);
|
||||
GX_TexCoord2f32(0.0f,0.0f);
|
||||
GX_Position3f32(-1.0f,-1.0f,-1.0f);
|
||||
GX_Color1u32(col[2]);
|
||||
GX_TexCoord2f32(1.0f,0.0f);
|
||||
GX_Position3f32(-1.0f,-1.0f,1.0f);
|
||||
GX_Color1u32(col[2]);
|
||||
GX_TexCoord2f32(1.0f,1.0f);
|
||||
GX_Position3f32(1.0f,-1.0f,1.0f);
|
||||
GX_Color1u32(col[2]);
|
||||
GX_TexCoord2f32(0.0f,1.0f);
|
||||
GX_Position3f32(1.0f,-1.0f,-1.0f);
|
||||
GX_Color1u32(col[2]);
|
||||
GX_TexCoord2f32(0.0f,0.0f);
|
||||
GX_Position3f32(-1.0f,-1.0f,-1.0f);
|
||||
GX_Color1u32(col[2]);
|
||||
GX_TexCoord2f32(1.0f,0.0f);
|
||||
GX_Position3f32(-1.0f,-1.0f,1.0f);
|
||||
GX_Color1u32(col[2]);
|
||||
GX_TexCoord2f32(1.0f,1.0f);
|
||||
GX_Position3f32(1.0f,-1.0f,1.0f);
|
||||
GX_Color1u32(col[2]);
|
||||
GX_TexCoord2f32(0.0f,1.0f);
|
||||
GX_End();
|
||||
|
||||
a+=0.5f;
|
||||
|
||||
GRRLIB_2dMode();
|
||||
GRRLIB_Screen2Texture(0, 0, tex_screen[screen_index], GX_FALSE);
|
||||
|
||||
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 %= 9;
|
||||
spr+=0.1f;
|
||||
t+=0.01f;
|
||||
screen_index %= 9;
|
||||
spr+=0.1f;
|
||||
t+=0.01f;
|
||||
|
||||
if(t>n*2*PI){
|
||||
n++;
|
||||
|
|
Loading…
Reference in a new issue