mirror of
https://github.com/GRRLIB/GRRLIB.git
synced 2024-12-22 18:39:18 +00:00
Fixes documentation, typos and coding standard
This commit is contained in:
parent
b63e7bae56
commit
531de92021
12 changed files with 31 additions and 42 deletions
|
@ -46,16 +46,16 @@ void GRRLIB_SetBackgroundColour(u8 r, u8 g, u8 b, u8 a) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the camera parameter (contributed my chris_c aka DaShAmAn).
|
||||
* Set the camera parameter (contributed by chris_c aka DaShAmAn).
|
||||
* @param posx x position of the camera.
|
||||
* @param posy y position of the camera.
|
||||
* @param posz z position of the camera.
|
||||
* @param upx Alpha component.
|
||||
* @param upy Alpha component.
|
||||
* @param upz Alpha component.
|
||||
* @param lookx x up position of the camera.
|
||||
* @param looky y up position of the camera.
|
||||
* @param lookz z up position of the camera.
|
||||
* @param upx x up position of the camera.
|
||||
* @param upy y up position of the camera.
|
||||
* @param upz z up position of the camera.
|
||||
* @param lookx x position of the target.
|
||||
* @param looky y position of the target.
|
||||
* @param lookz z position of the target.
|
||||
*/
|
||||
void GRRLIB_Camera3dSettings(f32 posx, f32 posy, f32 posz,
|
||||
f32 upx, f32 upy, f32 upz,
|
||||
|
@ -486,7 +486,6 @@ void GRRLIB_DrawCube(f32 size, bool filled, u32 col) {
|
|||
{7, 4, 0, 3}
|
||||
};
|
||||
f32 v[8][3];
|
||||
int i;
|
||||
|
||||
v[0][0] = v[1][0] = v[2][0] = v[3][0] = -size / 2;
|
||||
v[4][0] = v[5][0] = v[6][0] = v[7][0] = size / 2;
|
||||
|
@ -495,7 +494,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 (i = 5; i >= 0; i--) {
|
||||
for (int i = 5; i >= 0; i--) {
|
||||
if(filled == true) {
|
||||
GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
|
||||
}
|
||||
|
@ -643,12 +642,11 @@ void GRRLIB_DrawCone(f32 r, f32 h, int d, bool filled, u32 col) {
|
|||
* @param col Color in RGBA format.
|
||||
*/
|
||||
void GRRLIB_DrawTessPanel(f32 w, f32 wstep, f32 h, f32 hstep, bool filled, u32 col) {
|
||||
f32 x, y, tmpx, tmpy;
|
||||
int tmp;
|
||||
f32 x, y;
|
||||
|
||||
tmpy = h/2.0f;
|
||||
tmpx = w/2.0f;
|
||||
tmp = ((w/wstep)*2)+2;
|
||||
f32 tmpy = h/2.0f;
|
||||
f32 tmpx = w/2.0f;
|
||||
int tmp = ((w/wstep)*2)+2;
|
||||
for ( y = -tmpy; y <= tmpy; y += hstep )
|
||||
{
|
||||
if(filled == true) {
|
||||
|
@ -709,11 +707,11 @@ void GRRLIB_SetLightDiff(u8 num, guVector pos, f32 distattn, f32 brightness, u32
|
|||
* Set specular light parameters.
|
||||
* @param num Number of the light. It's a number from 0 to 7.
|
||||
* @param dir Direction of the specular ray (x/y/z).
|
||||
* @param shy Shyniness of the specular. ( between 4 and 254)
|
||||
* @param shininess Shininess of the specular. ( between 4 and 254)
|
||||
* @param lightcolor Color of the light in RGBA format.
|
||||
* @param speccolor Specular color in RGBA format..
|
||||
*/
|
||||
void GRRLIB_SetLightSpec(u8 num, guVector dir, f32 shy, u32 lightcolor, u32 speccolor) {
|
||||
void GRRLIB_SetLightSpec(u8 num, guVector dir, f32 shininess, u32 lightcolor, u32 speccolor) {
|
||||
Mtx mr,mv;
|
||||
GXLightObj MyLight;
|
||||
guVector ldir = {dir.x, dir.y, dir.z};
|
||||
|
@ -725,7 +723,7 @@ void GRRLIB_SetLightSpec(u8 num, guVector dir, f32 shy, u32 lightcolor, u32 spec
|
|||
guVecMultiplySR(mv, &ldir,&ldir);
|
||||
GX_InitSpecularDirv(&MyLight, &ldir);
|
||||
|
||||
GX_InitLightShininess(&MyLight, shy); // between 4 and 255 !!!
|
||||
GX_InitLightShininess(&MyLight, shininess); // between 4 and 255 !!!
|
||||
GX_InitLightColor(&MyLight, (GXColor) { R(lightcolor), G(lightcolor), B(lightcolor), 0xFF });
|
||||
GX_LoadLightObj(&MyLight, (1<<num));
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
Copyright (c) 2009-2019 The GRRLIB Team
|
||||
Copyright (c) 2009-2021 The GRRLIB Team
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -166,7 +166,7 @@ void GRRLIB_DrawCone(f32 r, f32 h, int 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);
|
||||
void GRRLIB_SetLightSpec(u8 num, guVector dir, f32 shy, u32 lightcolor, u32 speccolor);
|
||||
void GRRLIB_SetLightSpec(u8 num, guVector dir, f32 shininess, u32 lightcolor, u32 speccolor);
|
||||
void GRRLIB_SetLightSpot(u8 num, guVector pos, guVector lookat, f32 angAttn0, f32 angAttn1, f32 angAttn2, f32 distAttn0, f32 distAttn1, f32 distAttn2, u32 lightcolor);
|
||||
void GRRLIB_SetLightOff(void);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
Copyright (c) 2009-2017 The GRRLIB Team
|
||||
Copyright (c) 2009-2021 The GRRLIB Team
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -35,10 +35,8 @@ THE SOFTWARE.
|
|||
INLINE
|
||||
void GRRLIB_GXEngine (const guVector v[], const u32 color[], const long n,
|
||||
const u8 fmt) {
|
||||
int i;
|
||||
|
||||
GX_Begin(fmt, GX_VTXFMT0, n);
|
||||
for (i = 0; i < n; i++) {
|
||||
for (int i = 0; i < n; i++) {
|
||||
GX_Position3f32(v[i].x, v[i].y, v[i].z);
|
||||
GX_Color1u32(color[i]);
|
||||
}
|
||||
|
|
|
@ -1023,7 +1023,7 @@ int pngu_info (IMGCTX ctx)
|
|||
}
|
||||
|
||||
else
|
||||
return PNGU_NO_FILE_SELECTED;;
|
||||
return PNGU_NO_FILE_SELECTED;
|
||||
|
||||
if (png_sig_cmp(magic, 0, 8) != 0)
|
||||
{
|
||||
|
|
|
@ -79,4 +79,3 @@ int main() {
|
|||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
int main() {
|
||||
f32 rot = 0.0f;
|
||||
float shy = 10.0f;
|
||||
float shininess = 10.0f;
|
||||
|
||||
GRRLIB_Init();
|
||||
WPAD_Init();
|
||||
|
@ -31,8 +31,8 @@ int main() {
|
|||
WPAD_ScanPads();
|
||||
|
||||
if(WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) break;
|
||||
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_A) shy+=1;
|
||||
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_B) shy-=1;
|
||||
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_A) shininess+=1;
|
||||
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_B) shininess-=1;
|
||||
|
||||
GRRLIB_3dMode(0.1,1000,45,0,1);
|
||||
|
||||
|
@ -41,7 +41,7 @@ int main() {
|
|||
// 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}, shy, 0xFFFFFFFF, 0xFFFFFFFF);
|
||||
GRRLIB_SetLightSpec(0, (guVector){0.0f,0.0f,0.0f}, shininess, 0xFFFFFFFF, 0xFFFFFFFF);
|
||||
|
||||
GRRLIB_ObjectViewBegin();
|
||||
GRRLIB_ObjectViewTrans(0.0f,1.3f,0.0f);
|
||||
|
@ -93,7 +93,7 @@ int main() {
|
|||
rot+=0.8f;
|
||||
|
||||
GRRLIB_2dMode();
|
||||
GRRLIB_Printf(50, 60, tex_font, 0xFFFFFFFF, 1, "Use ( A / B ) to change the shyniness value : %d ",(int)shy);
|
||||
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);
|
||||
|
@ -101,4 +101,3 @@ int main() {
|
|||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -104,4 +104,3 @@ int main() {
|
|||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -149,4 +149,3 @@ int main() {
|
|||
GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -59,4 +59,3 @@ int main() {
|
|||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,6 @@ int main(void){
|
|||
GRRLIB_ObjectViewEnd();
|
||||
GRRLIB_DrawCube(0.8f,1,0xFFFFFFFF);
|
||||
|
||||
|
||||
GRRLIB_ObjectViewBegin();
|
||||
GRRLIB_ObjectViewRotate(0,a*3,0);
|
||||
GRRLIB_ObjectViewTrans(0,offset,0);
|
||||
|
@ -102,4 +101,3 @@ int main(void){
|
|||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ static void createEffect( u8 id, int _x, int _y );
|
|||
static void createParticle( u8 _id, int _x, int _y, float _scale, float _alpha, u8 _red, u8 _green, u8 _blue );
|
||||
static bool updateParticle( Particle *part );
|
||||
static u8 CalculateFrameRate();
|
||||
static u8 ClampVar8 (f32 Value);
|
||||
static constexpr u8 ClampVar8 (f32 Value);
|
||||
|
||||
// Prepare Graphics
|
||||
GRRLIB_texImg *GFX_Background;
|
||||
|
@ -97,8 +97,8 @@ int main() {
|
|||
GRRLIB_SetBlend( GRRLIB_BLEND_ALPHA );
|
||||
|
||||
// WiiMote IR Viewport correction
|
||||
int P1MX = P1Mote.sx - 150;
|
||||
int P1MY = P1Mote.sy - 150;
|
||||
const int P1MX = P1Mote.sx - 150;
|
||||
const int P1MY = P1Mote.sy - 150;
|
||||
|
||||
// Drawing Background
|
||||
GRRLIB_DrawImg( 0, 0, GFX_Background, 0, 1, 1, RGBA(255, 255, 255, 255) );
|
||||
|
@ -274,7 +274,7 @@ static u8 CalculateFrameRate() {
|
|||
* @param Value The value to clamp. Using float to increase the precision. This makes a full spectrum (0 - 255) possible.
|
||||
* @return Returns a clean, clamped unsigned char.
|
||||
*/
|
||||
static u8 ClampVar8 (f32 Value) {
|
||||
static constexpr u8 ClampVar8 (f32 Value) {
|
||||
Value = std::roundf(Value);
|
||||
if (Value < 0) {
|
||||
Value = 0;
|
||||
|
@ -283,5 +283,5 @@ static u8 ClampVar8 (f32 Value) {
|
|||
Value = 255;
|
||||
}
|
||||
|
||||
return (u8)Value;
|
||||
return static_cast<u8>(Value);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ int main() {
|
|||
int n=1;
|
||||
float a=0;
|
||||
float cubeZ=10.0f;
|
||||
float camZ=30.0f;;
|
||||
float camZ=30.0f;
|
||||
|
||||
GRRLIB_Init();
|
||||
WPAD_Init();
|
||||
|
|
Loading…
Reference in a new issue