void movePaddle(Paddle* paddle) { if(paddleIsInserted()) { paddle->rect.x += paddleAccel; if(paddle->rect.x < 0) paddle->rect.x = 0; if(paddle->rect.x > SCREEN_WIDTH - paddle->rect.w) paddle->rect.x = SCREEN_WIDTH - paddle->rect.w; //paddle->rect.x = touchpos; } else { if(pressedKeys & KEY_TOUCH) { s16 tp = touchPos.px - (paddle->rect.w/2); if(tp < 0) tp = 0; else if(tp > SCREEN_WIDTH - paddle->rect.w) tp = SCREEN_WIDTH - paddle->rect.w; if(paddle->rect.x < tp) { paddle->rect.x += PADDLE_SPEED; if(paddle->rect.x > tp) paddle->rect.x = tp; } else if(paddle->rect.x > tp) { paddle->rect.x -= PADDLE_SPEED; if(paddle->rect.x < tp) paddle->rect.x = tp; } } else { if(pressedKeys & KEY_LEFT) { //clear(); paddle->rect.x -= PADDLE_SPEED; if(paddle->rect.x < 0) paddle->rect.x = 0; } else if(pressedKeys & KEY_RIGHT) { //clear(); paddle->rect.x += PADDLE_SPEED; if(paddle->rect.x > SCREEN_WIDTH - paddle->rect.w) paddle->rect.x = SCREEN_WIDTH - paddle->rect.w; } } } }
int main(void) { consoleDemoInit(); while(1) { swiWaitForVBlank(); consoleClear(); iprintf(" Hello DS dev'rs\n"); iprintf(" \x1b[32mwww.devkitpro.org\n"); iprintf(" \x1b[32;1mwww.drunkencoders.com\x1b[39m"); iprintf("\x1b[4;0Hgba header 96h: %02X\n",GBA_HEADER.is96h); iprintf("0x08000000: %04X\n",*(vu16*)0x08000000); if(guitarGripIsInserted()) { guitarGripScanKeys(); u8 keys = guitarGripKeysHeld(); iprintf("\x1b[7;0HguitarGrip: %02X\n",keys); iprintf(" [%s] [%s] [%s] [%s]",(keys&GUITARGRIP_BLUE)?"BLU":" ",(keys&GUITARGRIP_YELLOW)?"YEL":" ",(keys&GUITARGRIP_RED)?"RED":" ",(keys&GUITARGRIP_GREEN)?"GRN":" "); } if(pianoIsInserted()) { pianoScanKeys(); PianoKeys keys; keys.VAL = pianoKeysHeld(); iprintf("\x1b[7;0Hpiano: %04X\n",pianoKeysHeld()); iprintf(" %s %s %s %s %s \n",keys.c_sharp?"C#":" ",keys.d_sharp?"D#":" ",keys.f_sharp?"F#":" ",keys.g_sharp?"G#":" ",keys.a_sharp?"A#":" "); iprintf("%s %s %s %s %s %s %s %s\n",keys.c?"C ":" ",keys.d?"D ":" ",keys.e?"E ":" ",keys.f?"F ":" ",keys.g?"G ":" ",keys.a?"A ":" ",keys.b?"B ":" ",keys.high_c?"C ":" "); } if(paddleIsInserted()) { iprintf("\x1b[7;0Hpaddle: %04X\n",paddleRead()); } } return 0; }