diff --git a/CHANGELOG.md b/CHANGELOG.md index f74353c..0213e6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. - Fixed compatibility issues with devkitPPC release 39. - Added `GRRLIB_LoadTTFFromFile()` to load a TTF from a file. - Added `GRRLIB_Ellipse()` to draw an ellipse. +- Changed function arguments types in a few functions. - Fixed documentation for `GRRLIB_Camera3dSettings()`, `GRRLIB_Screen2Texture()` and `GRRLIB_CompoEnd()`. ## [4.4.1][] - 2021-03-05 diff --git a/GRRLIB/GRRLIB/GRRLIB_3D.c b/GRRLIB/GRRLIB/GRRLIB_3D.c index 331438d..67eea8e 100644 --- a/GRRLIB/GRRLIB/GRRLIB_3D.c +++ b/GRRLIB/GRRLIB/GRRLIB_3D.c @@ -422,11 +422,11 @@ void GRRLIB_DrawTorus(f32 r, f32 R, int nsides, int rings, bool filled, u32 col) */ void GRRLIB_DrawSphere(f32 r, int lats, int longs, bool filled, u32 col) { for(int i = 0; i <= lats; i++) { - const f32 lat0 = M_PI * (-0.5F + (f32) (i - 1) / lats); + const f32 lat0 = M_PI * (-0.5f + (f32) (i - 1) / lats); const f32 z0 = sinf(lat0); const f32 zr0 = cosf(lat0); - const f32 lat1 = M_PI * (-0.5F + (f32) i / lats); + const f32 lat1 = M_PI * (-0.5f + (f32) i / lats); const f32 z1 = sinf(lat1); const f32 zr1 = cosf(lat1); @@ -486,7 +486,7 @@ void GRRLIB_DrawCube(f32 size, bool filled, u32 col) { v[0][2] = v[3][2] = v[4][2] = v[7][2] = -size / 2; v[1][2] = v[2][2] = v[5][2] = v[6][2] = size / 2; - for (int i = 5; i >= 0; i--) { + for (s8 i = 5; i >= 0; i--) { if(filled == true) { GX_Begin(GX_QUADS, GX_VTXFMT0, 4); } @@ -522,14 +522,14 @@ void GRRLIB_DrawCube(f32 size, bool filled, u32 col) { * @param filled Wired or not. * @param col Color of the cylinder. */ -void GRRLIB_DrawCylinder(f32 r, f32 h, int d, bool filled, u32 col) { +void GRRLIB_DrawCylinder(f32 r, f32 h, u16 d, bool filled, u32 col) { if(filled == true) { - GX_Begin(GX_TRIANGLESTRIP, GX_VTXFMT0, 2 * (d+1)); + GX_Begin(GX_TRIANGLESTRIP, GX_VTXFMT0, 2 * (d + 1)); } else { - GX_Begin(GX_LINESTRIP, GX_VTXFMT0, 2 * (d+1)); + GX_Begin(GX_LINESTRIP, GX_VTXFMT0, 2 * (d + 1)); } - for(int i = 0; i <= d; i++) { + for(u16 i = 0; i <= d; i++) { const f32 dx = cosf( M_PI * 2.0f * i / d ); const f32 dy = sinf( M_PI * 2.0f * i / d ); GX_Position3f32( r * dx, -0.5f * h, r * dy ); @@ -550,7 +550,7 @@ void GRRLIB_DrawCylinder(f32 r, f32 h, int d, bool filled, u32 col) { GX_Position3f32(0.0f, -0.5f * h, 0.0f); GX_Normal3f32(0.0f, -1.0f, 0.0f); GX_Color1u32(col); - for(int i = 0; i <= d; i++) { + for(u16 i = 0; i <= d; i++) { GX_Position3f32( r * cosf( M_PI * 2.0f * i / d ), -0.5f * h, r * sinf( M_PI * 2.0f * i / d ) ); GX_Normal3f32(0.0f, -1.0f, 0.0f); GX_Color1u32(col); @@ -566,7 +566,7 @@ void GRRLIB_DrawCylinder(f32 r, f32 h, int d, bool filled, u32 col) { GX_Position3f32(0.0f, 0.5f * h, 0.0f); GX_Normal3f32(0.0f, 1.0f, 0.0f); GX_Color1u32(col); - for(int i = 0; i <= d; i++) { + for(u16 i = 0; i <= d; i++) { GX_Position3f32( r * cosf( M_PI * 2.0f * i / d ), 0.5f * h, r * sinf( M_PI * 2.0f * i / d ) ); GX_Normal3f32(0.0f, 1.0f, 0.0f); GX_Color1u32(col); @@ -582,14 +582,14 @@ void GRRLIB_DrawCylinder(f32 r, f32 h, int d, bool filled, u32 col) { * @param filled Wired or not. * @param col Color of the cone. */ -void GRRLIB_DrawCone(f32 r, f32 h, int d, bool filled, u32 col) { +void GRRLIB_DrawCone(f32 r, f32 h, u16 d, bool filled, u32 col) { if(filled == true) { - GX_Begin(GX_TRIANGLESTRIP, GX_VTXFMT0, 2 * (d+1)); + GX_Begin(GX_TRIANGLESTRIP, GX_VTXFMT0, 2 * (d + 1)); } else { - GX_Begin(GX_LINESTRIP, GX_VTXFMT0, 2 * (d+1)); + GX_Begin(GX_LINESTRIP, GX_VTXFMT0, 2 * (d + 1)); } - for(int i = 0; i <= d; i++) { + for(u16 i = 0; i <= d; i++) { const f32 dx = cosf( M_PI * 2.0f * i / d ); const f32 dy = sinf( M_PI * 2.0f * i / d ); GX_Position3f32( 0, -0.5f * h,0); @@ -610,7 +610,7 @@ void GRRLIB_DrawCone(f32 r, f32 h, int d, bool filled, u32 col) { GX_Position3f32(0.0f, 0.5f * h, 0.0f); GX_Normal3f32(0.0f, 1.0f, 0.0f); GX_Color1u32(col); - for(int i = 0; i <= d; i++) { + for(u16 i = 0; i <= d; i++) { GX_Position3f32( r * cosf( M_PI * 2.0f * i / d ), 0.5f * h, r * sinf( M_PI * 2.0f * i / d ) ); GX_Normal3f32(0.0f, 1.0f, 0.0f); GX_Color1u32(col); diff --git a/GRRLIB/GRRLIB/grrlib/GRRLIB__lib.h b/GRRLIB/GRRLIB/grrlib/GRRLIB__lib.h index f832a71..f02a996 100644 --- a/GRRLIB/GRRLIB/grrlib/GRRLIB__lib.h +++ b/GRRLIB/GRRLIB/grrlib/GRRLIB__lib.h @@ -164,8 +164,8 @@ void GRRLIB_SetTexture(GRRLIB_texImg *tex, bool rep); void GRRLIB_DrawTorus(f32 r, f32 R, int nsides, int rings, bool filled, u32 col); void GRRLIB_DrawSphere(f32 r, int lats, int longs, bool filled, u32 col); void GRRLIB_DrawCube(f32 size, bool filled, u32 col); -void GRRLIB_DrawCylinder(f32 r, f32 h, int d, bool filled, u32 col); -void GRRLIB_DrawCone(f32 r, f32 h, int d, bool filled, u32 col); +void GRRLIB_DrawCylinder(f32 r, f32 h, u16 d, bool filled, u32 col); +void GRRLIB_DrawCone(f32 r, f32 h, u16 d, bool filled, u32 col); void GRRLIB_DrawTessPanel(f32 w, f32 wstep, f32 h, f32 hstep, bool filled, u32 col); void GRRLIB_SetLightAmbient(u32 ambientcolor); void GRRLIB_SetLightDiff(u8 num, guVector pos, f32 distattn, f32 brightness, u32 lightcolor); diff --git a/examples/3D_Light3/source/main.c b/examples/3D_Light3/source/main.c index 6273fb8..940e1b0 100644 --- a/examples/3D_Light3/source/main.c +++ b/examples/3D_Light3/source/main.c @@ -47,42 +47,42 @@ int main() { 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_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_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_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_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_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_DrawCone(0.6f, 2.6f, 60, true, 0x502010FF); GRRLIB_ObjectViewBegin(); GRRLIB_ObjectViewRotate(rot,rot*2,rot*3); diff --git a/examples/3D_Light4/source/main.c b/examples/3D_Light4/source/main.c index 8eed7fa..0e7fdbb 100644 --- a/examples/3D_Light4/source/main.c +++ b/examples/3D_Light4/source/main.c @@ -36,7 +36,7 @@ int main(int argc, char **argv) { 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); + GRRLIB_DrawTessPanel(6.2f, 0.17f, 3.7f, 0.1f, 0, 0xFFFFFFFF); lightx+=0.05f; diff --git a/examples/gamecube/3D_Light3/source/main.c b/examples/gamecube/3D_Light3/source/main.c index 102f703..426ce9c 100644 --- a/examples/gamecube/3D_Light3/source/main.c +++ b/examples/gamecube/3D_Light3/source/main.c @@ -47,42 +47,42 @@ int main() { 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_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_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_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_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_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_DrawCone(0.6f, 2.6f, 60, true, 0x502010FF); GRRLIB_ObjectViewBegin(); GRRLIB_ObjectViewRotate(rot,rot*2,rot*3); diff --git a/examples/gamecube/3D_Light4/source/main.c b/examples/gamecube/3D_Light4/source/main.c index b3cc5de..e55f24f 100644 --- a/examples/gamecube/3D_Light4/source/main.c +++ b/examples/gamecube/3D_Light4/source/main.c @@ -36,7 +36,7 @@ int main(int argc, char **argv) { 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); + GRRLIB_DrawTessPanel(6.2f, 0.17f, 3.7f, 0.1f, 0, 0xFFFFFFFF); lightx+=0.05f;