mirror of
https://github.com/GRRLIB/GRRLIB.git
synced 2024-11-25 16:22:20 +00:00
Correct some cppcheck warnings in examples
This commit is contained in:
parent
d48d7b8819
commit
f8669ff668
3 changed files with 18 additions and 13 deletions
|
@ -35,13 +35,12 @@ int main() {
|
|||
// Init Variables
|
||||
u32 WPADKeyDown;
|
||||
short WinW, WinH;
|
||||
int P1MX, P1MY;
|
||||
|
||||
u8 Stage = 0, Blending = 0;
|
||||
u8 Stage = 0;
|
||||
u8 Blending = 0;
|
||||
u8 BlobType = 0;
|
||||
u8 Color = 255;
|
||||
u16 Step = 0;
|
||||
float SX, SY;
|
||||
|
||||
|
||||
// Init GRRLIB & WiiUse
|
||||
|
@ -73,14 +72,14 @@ int main() {
|
|||
WPAD_IR(WPAD_CHAN_0, &P1Mote);
|
||||
|
||||
// WiiMote IR Viewport Correction
|
||||
P1MX = P1Mote.sx - 150;
|
||||
P1MY = P1Mote.sy - 150;
|
||||
int P1MX = P1Mote.sx - 150;
|
||||
int P1MY = P1Mote.sy - 150;
|
||||
|
||||
// Update Stage
|
||||
Step = Step + 1;
|
||||
if (Step == 720) { Step = 0; }
|
||||
SX = 320 + (sin(DegToRad(Step )) * 250);
|
||||
SY = 240 + (cos(DegToRad(Step*3)) * 100);
|
||||
float SX = 320 + (sin(DegToRad(Step )) * 250);
|
||||
float SY = 240 + (cos(DegToRad(Step*3)) * 100);
|
||||
|
||||
// Draw Stage
|
||||
GRRLIB_DrawImg( 0, 0, GFX_Background, 0, 1, 1, RGBA(255, 255, 255, 255) );
|
||||
|
|
|
@ -16,7 +16,6 @@ int main() {
|
|||
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;
|
||||
|
@ -65,14 +64,17 @@ int main() {
|
|||
siny4 = offset4*pas4;
|
||||
|
||||
|
||||
while(1) {
|
||||
while (1) {
|
||||
GRRLIB_FillScreen(0x000000FF);
|
||||
WPAD_ScanPads(); // Scan the Wiimotes
|
||||
if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) break;
|
||||
old1=siny1; old2=siny2; old3=siny3; old4=siny4;
|
||||
float old1=siny1;
|
||||
float old2=siny2;
|
||||
float old3=siny3;
|
||||
float old4=siny4;
|
||||
|
||||
|
||||
for(x=0;x<=640;x++) {
|
||||
for (x=0; x<=640; x++) {
|
||||
siny1+=pas1;
|
||||
siny2+=pas2;
|
||||
siny3+=pas3;
|
||||
|
|
|
@ -277,8 +277,12 @@ static u8 CalculateFrameRate() {
|
|||
*/
|
||||
static u8 ClampVar8 (f32 Value) {
|
||||
Value = roundf(Value);
|
||||
if (Value < 0) Value = 0;
|
||||
else if (Value > 255) Value = 255;
|
||||
if (Value < 0) {
|
||||
Value = 0;
|
||||
}
|
||||
else if (Value > 255) {
|
||||
Value = 255;
|
||||
}
|
||||
|
||||
return (u8)Value;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue