/* 게임 중 정보 출력 */ void Gaming_info() { PA_ClearTextBg(UP_SCREEN); PA_OutputText(UP_SCREEN, 10, 2, "Stage : %d", uinfo.userStage); PA_OutputText(UP_SCREEN, 10, 5, "Score : %d", uinfo.userScore); PA_OutputText(UP_SCREEN, 10, 8, "Time : %d", stageTime); PA_OutputText(UP_SCREEN, 10, 12, "GAMING TIME"); }
int main(void) { // Initialise the lib... PA_Init(); PA_InitVBL(); PA_InitText(1, 0); // Load the palettes for the sprites on both screens PA_DualLoadSpritePal(0, (void*)sprite0_Pal); // Create the sprite on both screens... PA_DualCreateSprite(FRISBEE, (void*)frisbee_Sprite, OBJ_SIZE_32X32, 1, 0, 96, 300); // Bottom screen PA_DualSetSpriteRotEnable(FRISBEE, 0); // Enable rotation/zoom, rotset 0 // Sprite initial position... frisbee.x = 96+16; frisbee.y = 300+16; // on the bottom screen // Speed of frisbee in both ways frisbee.vx = 0; frisbee.vy = 0; while(1) { // Move with the stylus, or move on... if (PA_MoveSprite(FRISBEE)){ frisbee.x = PA_MovedSprite.X; frisbee.y = PA_MovedSprite.Y + 192 + SCREENHOLE; frisbee.vx = PA_MovedSprite.Vx; frisbee.vy = PA_MovedSprite.Vy; } else{ // Now, the frisbee's fixed point position will be updated according to the speed... frisbee.x += frisbee.vx; frisbee.y += frisbee.vy; // If the sprite touches the left or right border, flip the horizontal speed if ((frisbee.x -16 <= 0) && (frisbee.vx < 0)) frisbee.vx = -frisbee.vx; else if ((frisbee.x + 16 >= 256)&&(frisbee.vx > 0)) frisbee.vx = - frisbee.vx; // Same thing, for top and bottom limits... if ((frisbee.y -16 <= 0) && (frisbee.vy < 0)) frisbee.vy = -frisbee.vy; else if ((frisbee.y + 16 >= 192 + 192 + SCREENHOLE)&& (frisbee.vy > 0)) frisbee.vy = - frisbee.vy; // The bottom limit is at the bottom of the bottom screen, so that would be 2 screen heights, plus the space in between... PA_DualSetSpriteXY(FRISBEE, frisbee.x-16, frisbee.y-16); } PA_OutputText(1, 2, 10, "SpeedX : %d ", frisbee.vx); PA_OutputText(1, 2, 11, "SpeedY : %d ", frisbee.vy); frisbee.angle+=4; // Make the frisbee turn... PA_DualSetRotsetNoZoom(0, frisbee.angle); PA_WaitForVBL(); // Synch to the framerate... } return 0; }
// Function: main() int main(int argc, char ** argv) { PA_Init(); // Initializes PA_Lib PA_InitVBL(); // Initializes a standard VBL // Initialise the text system on the top screen PA_InitText(0,0); PA_InitText(1, 0); PA_OutputText(0, 1, 1, "PA_InitWifi() ..."); PA_InitWifi(); PA_OutputText(0, 1, 2, "done!\nPA_ConnectWifiWFC() ..."); if (!PA_ConnectWifiWFC()) { PA_OutputText(0, 1, 4, "error!"); return 1; } PA_OutputText(0, 1, 4, "done!\nWIFI is now ready!"); while (1) { PA_WaitForVBL(); } return 0; } // End of main()
void displayOutput() { // Paddles PA_SetSpriteXY(SCREEN_BOTTOM, PADDLE1, myPaddle.x, myPaddle.y); PA_SetSpriteXY(SCREEN_TOP, PADDLE2, theirPaddle.x, theirPaddle.y); // Ball if(ball.y > SCREEN_HEIGHT-BALL_HEIGHT-1) PA_SetSpriteXY(SCREEN_BOTTOM, BALL_BOTTOM, ball.x, ball.y-SCREEN_HEIGHT); else PA_SetSpriteXY(SCREEN_BOTTOM, BALL_BOTTOM, -BALL_WIDTH, -BALL_HEIGHT); if(ball.y < SCREEN_HEIGHT+BALL_HEIGHT-1) PA_SetSpriteXY(SCREEN_TOP, BALL_TOP, ball.x, ball.y); else PA_SetSpriteXY(SCREEN_TOP, BALL_BOTTOM, -BALL_WIDTH, -BALL_HEIGHT); // Text //if(ball.vy>0) PA_OutputSimpleText(SCREEN_TOP, 0, 1, "PING"); //else PA_OutputSimpleText(SCREEN_TOP,0,1,"PONG"); PA_OutputText(SCREEN_TOP, 0, 2, "Score: %d", game.score); PA_OutputText(SCREEN_TOP, 0, 3, "Balls: %d", game.lives); /* PA_OutputText(SCREEN_TOP, 0, 2, "Ball X: %d ,Y: %d ", ball.x, ball.y); PA_OutputText(1,0,3,"Stylus X:%d, Y:%d", Stylus.X, Stylus.Y); PA_OutputText(1,0,4,"Ball V X:%f5, Y:%f5", ball.vx, ball.vy); */ }
void postRound() { if(ball.vy > 0) game.lives--; if(game.lives) { if(ball.vy > 0) // I lose { PA_OutputSimpleText(SCREEN_TOP,0,6,"YOU LOSE THIS ROUND"); if(game.lives>1) PA_OutputText(SCREEN_TOP,0,7,"ONLY %d BALLS LEFT!", game.lives); else PA_OutputSimpleText(SCREEN_TOP,0,7,"LAST BALL"); }else{ // They lose game.score++; if(game.lives<5) game.lives++; PA_OutputSimpleText(SCREEN_TOP,0,6,"YOU WIN THIS ROUND"); if(game.score>1) PA_OutputText(SCREEN_TOP,0,7,"YOU HAVE %d POINTS!", game.score); else PA_OutputSimpleText(SCREEN_TOP,0,7,"YOU EARNED A POINT & A BALL!"); } PA_OutputSimpleText(SCREEN_TOP,0,12,"Press A to Play Again"); while(!Pad.Newpress.A && !Stylus.Newpress) { if(Pad.Newpress.X) PA_SetDSLBrightness(0); if(Pad.Newpress.Y) PA_SetDSLBrightness(1); if(Pad.Newpress.B) PA_SetDSLBrightness(2); if(Pad.Newpress.Start) PA_SetDSLBrightness(3); // Sleep PA_CheckLid(); PA_WaitForVBL(); } } }
int main(void){ PA_Init(); PA_InitVBL(); PA_InitText(1,0); // On the top screen PA_LoadSpritePal(0, 0, (void*)sprite0_Pal); // This'll be the movable sprite... PA_CreateSprite(0, 0,(void*)circle_Sprite, OBJ_SIZE_32X32,1, 0, 16, 16); s32 x = 16; s32 y = 16; // Sprite's center position // This will be the fixed circle PA_CreateSprite(0, 1,(void*)circle_Sprite, OBJ_SIZE_32X32,1, 0, 128-16, 96-16); while(1) { if (PA_MoveSprite(0)){ x = PA_MovedSprite.X; y = PA_MovedSprite.Y; } // Collision ? if (PA_Distance(x, y, 128, 96) < 32*32) PA_OutputText(1, 2, 10, "Collision !!"); else PA_OutputText(1, 2, 10, " "); PA_WaitForVBL(); } return 0; }
void draw() { PA_InitText(1,0); for (u8 i=0; i<numeros.size(); i++) { PA_OutputText(1,i,0,"%d ",numeros[i]); } PA_OutputText(1,0,1,"size: %d , cap: %d ",numeros.size(),numeros.capacity()); }
/* 메모리 시간의 정보 출력 */ void Memory_info() { PA_ClearTextBg(UP_SCREEN); PA_OutputText(UP_SCREEN, 10, 2, "Stage : %d", uinfo.userStage); PA_OutputText(UP_SCREEN, 10, 5, "Score : %d", uinfo.userScore); PA_OutputText(UP_SCREEN, 10, 8, "Time : %d", memoryTime); PA_OutputText(UP_SCREEN, 10, 12, "MEMORY TIME"); PA_OutputText(UP_SCREEN, 2, 14, "PRESS START SKIP MEMORY TIME"); }
// Function: main() int main(int argc, char ** argv) { PA_Init(); // Initializes PA_Lib PA_InitVBL(); // Initializes a standard VBL PA_InitText(1, 0); PA_EasyBgLoad(0, 1, pasplash); // Load your backgrounds... PA_InitBgTrans(0); // Init BgTransition system, uses background 0 but little memory... // If you want it to hide your sprites, set your sprites' priorities to 1 or more... u8 transtype = 0; s8 i; u8 vflip; // Infinite loop to keep the program running while (1) { vflip = PA_Rand()&1; // random transtype = PA_Rand()%5; // random PA_OutputText(1, 8, 8, "Transition : %d ", transtype); PA_OutputText(1, 10, 9, "Vflip : %d ", vflip); // Transition out... for (i = 0; i <= TRANS_LENGTH; i++) { // Fade length... PA_BgTransUpDown(0, // screen transtype, // fade type, from 0 to 4, test them out ! vflip, // vertical flip i); // Time, 0 being the screen completely visible, 32 completely out PA_WaitForVBL(); // To slow down the fades, we wait a frame... } vflip = PA_Rand()&1; // random transtype = PA_Rand()%5; // random PA_OutputText(1, 8, 8, "Transition : %d ", transtype); PA_OutputText(1, 10, 9, "Vflip : %d ", vflip); // Transition back in... for (i = TRANS_LENGTH; i >= 0; i--) { // Fade length... PA_BgTransUpDown(0, // screen transtype, // fade type, from 0 to 4, test them out ! vflip, // vertical flip i); // Time, 0 being the screen completely visible, 32 completely out PA_WaitForVBL(); // To slow down the fades, we wait a frame... } PA_WaitForVBL(); } return 0; } // End of main()
// Function: main() int main(int argc, char ** argv) { PA_Init(); // Initializes PA_Lib PA_InitVBL(); // Initializes a standard VBL PA_InitText(1,1); Drawable cursor(0,0,0); cursor.Load(0, 0, (void*)pal_cursor, (void*)gfx_cursor, OBJ_SIZE_16X16, 1); setupRotations(); u8 c = 0; u8 x = 0; u8 y = 0; for (y = 0; y != 8; ++y) { for (x = 0; x != 8; ++x) { u16 i = y*8+x; if (grid[i] == 1) { Tower tower = Tower(SPRITE_TOWER_BASE+c, x*16, y*16); tower.Load(0, 1, (void*)pal_tower, (void*)gfx_tower, OBJ_SIZE_16X16, 1); tower_list.push_back(tower); PA_SetSpriteRotEnable(0, tower.sprite, c); ++c; } } } s16 angle = 0; // Infinite loop to keep the program running while (1) { u8 i = 0; for (tlist_it it = tower_list.begin(); it != tower_list.end(); ++it) { angle = (*it).GetAngleTo(cursor); PA_SetRotsetNoZoom(0, i, angle); ++i; } PA_OutputText(1, 0, 0, "Angle: %03d", angle); PA_OutputText(1, 0, 1, "Angle2: %03d", angle); PA_OutputText(1, 0, 2, "Cursor: %03d,%03d", cursor.position.x, cursor.position.y); if (Stylus.Held) { cursor.position.x = Stylus.X; cursor.position.y = Stylus.Y; } else { cursor.position.x += (Pad.Held.Right - Pad.Held.Left); cursor.position.y += (Pad.Held.Down - Pad.Held.Up); } cursor.Draw(); PA_WaitForVBL(); } return 0; } // End of main()
void FileSelector::initialize(char* path, int screen) { int file_number = 0; struct stat st; char filename[256]; // to hold a full filename and string terminator string fileext; string s; this->screen = screen; this->selected_file_position = 0; DIR_ITER* dir = diropen(path); if (dir == NULL) { PA_OutputText(screen,2,2,(char*)"Unable to open the directory."); PA_OutputText(screen,2,3,path); } else { dirnext(dir, filename, &st); // eat up . dirnext(dir, filename, &st); // eat up .. while (dirnext(dir, filename, &st) == 0) { // fileext.assign(filename); //fileext = fileext.substr(fileext.length()-4); //if (fileext == ".lua") //{ s.assign(filename); for (int j=0; j < (int)s.length(); ++j) { s[j]=tolower(s[j]); } this->filenames[file_number].assign(s); file_number++; //} } } this->number_of_files = file_number - 1; this->key_hold_time = 0; this->file_offset = -4; }
int get_nb_players() { int i, nb=0, ok=false; PA_CreateSprite(0, // Screen 0, // Sprite number (void*)btn_2_players, // Sprite name OBJ_SIZE_64X32, // Sprite size 1, // 256 color mode 0, // Sprite palette number 16, 80); // X and Y position on the screen PA_CreateSprite(0, 1, (void*)btn_3_players, OBJ_SIZE_64X32, 1, 0, 96, 80); PA_CreateSprite(0, 2, (void*)btn_4_players, OBJ_SIZE_64X32, 1, 0, 176, 80); PA_OutputText(0, 7, 0, "Nombre de joueurs"); while (!ok) { for (i=0; i<3; i++) { if (PA_SpriteTouched(i)) { nb = i+2; ok = true; } } PA_WaitForVBL(); } PA_DeleteSprite(0, 0); PA_DeleteSprite(0, 1); PA_DeleteSprite(0, 2); clear_screen(0); return nb; }
// Function: main() int main(int argc, char ** argv){ PA_Init(); // Initializes PA_Lib PA_InitVBL(); // Initializes a standard VBL PA_InitText(1, 0); // Init text on the top screen, background 0... // Load Backgrounds and their palettes... PA_EasyBgLoad(0, 3, BG3); PA_EasyBgLoad(1, 3, BG3); s32 scrollx = 0; // No X scroll by default... s32 scrolly = 0; // No Y scroll by default... // Infinite loop to keep the program running while (1) { // We'll modify scrollx and scrolly according to the keys pressed scrollx += (Pad.Held.Left - Pad.Held.Right) * 4; // Move 4 pixels per press scrolly += (Pad.Held.Up - Pad.Held.Down) * 4; // Move 4 pixels per press // Scroll the background to scrollx, scrolly... PA_BGScrollXY(0, // Screen 3, // Background number scrollx, // X scroll scrolly); // Y scroll // Display the X and Y scrolls : PA_OutputText(1, 0, 0, "x : %d \ny : %d ", scrollx, scrolly); PA_WaitForVBL(); } return 0; } // End of main()
void get_players_name(int nb_players, char **names) { s32 pos = 0; char letter = 0; int player = 0; PA_InitKeyboard(1); PA_KeyboardIn(25, 100); while (player < nb_players) { clear_screen(1); letter = PA_CheckKeyboard(); if (letter > 31 && pos < 7) { names[player][pos] = letter; pos++; } else if ((letter == PA_BACKSPACE) && pos) { pos--; names[player][pos] = ' '; } else if (letter == '\n') { names[player][8] = '\0'; player++; pos = 0; } PA_OutputSimpleText(1, 8, 11, names[player]); PA_OutputText(1, 0, 0, "Player %d/%d", player+1, nb_players); PA_WaitForVBL(); } clear_screen(1); PA_KeyboardOut(); }
void clear_screen(int no) { int y; for (y=0; y<24; y++) { PA_OutputText(no, 0, y, " "); } }
// Function: main() int main(int argc, char ** argv) { PA_Init(); // Initializes PA_Lib PA_InitVBL(); // Initializes a standard VBL PA_InitText(1, 0); // Load Backgrounds with their palettes ! PA_EasyBgLoad(0, // screen 3, // background number (0-3) bg0); // Background name, used by PAGfx... PA_OutputSimpleText(1, 2, 10, "Touch the screen to display the color on top screen"); // Infinite loop to keep the program running while (1) { PA_OutputText(1, 2, 5, "Palette Color : %d ", PA_EasyBgGetPixel(0, 3, Stylus.X, Stylus.Y)); // Screen, Bg_number, X/Y position // Returns the palette number (0-255) PA_SetBgColor(1, PA_EasyBgGetPixelCol(0, 3, Stylus.X, Stylus.Y)); // Same thing, but returns Color value... PA_WaitForVBL(); } return 0; } // End of main()
void receive(unsigned char *data, int length, LPLOBBY_USER from) { if(playernumber == 1) { PA_OutputText(MAIN_SCREEN, 0, 0, "%d %d %d", data[0], data[1], data[2]); // PA_SetSpriteXY(MAIN_SCREEN, players[0] -> SPRITENUM, data[0], data[1]); // PA_SetSpriteAnimFrame(MAIN_SCREEN, players[0] -> SPRITENUM, data[2]); } }
int PA_WriteTextFile(char* pathname, char* text) { FILE* pFile; u32 bytesTransferred; pFile = fopen ( "/test.txt" , write_binary_mode ); PA_WaitForVBL(); if (pFile==NULL) { } bytesTransferred=fwrite(text,1,strlen(text),pFile); //write the data to file and save the amount of bytes written. if(bytesTransferred<1) { //check for success rewind(pFile); fclose (pFile); return 0; //no bytes written, error } rewind(pFile); fclose (pFile); PA_WaitForVBL(); // terminate PA_OutputText(0,0,0,"%s ", text); return bytesTransferred; }
// Function: main() int main(int argc, char ** argv) { PA_Init(); // Initializes PA_Lib PA_InitVBL(); // Initializes a standard VBL PA_InitText(1, 0); PA_EasyBgLoad(0, 1, pasplash); // Load your backgrounds... u8 fadetype0 = 0; s8 i; // Infinite loop to keep the program running while (1) { // First we fade out... to fade out, move the time from 0 to 32, 32 included ! for (i = 0; i <= 32; i++) { PA_WindowFade(0, // screen fadetype0, // fade type, from 0 to 7, test them out ! i); // Time, 0 being the screen completely visible, 32 completely out PA_WaitForVBL(); // To slow down the fades, we wait a frame... } fadetype0 = PA_Rand()&7; // Random fade type for screen 0... from 0 to 7 PA_OutputText(1, 8, 9, "Window Fade : %d ", fadetype0); // To fade in, same thing, but from 32 to 0 included... for (i = 32; i >= 0; i--) { PA_WindowFade(0, fadetype0, i); PA_WaitForVBL(); // To slow down the fades, we wait a frame... } fadetype0 = PA_Rand()&7; // Random fade type for screen 0... PA_OutputText(1, 8, 9, "Window Fade : %d ", fadetype0); PA_WaitForVBL(); } return 0; } // End of main()
void postGame() { PA_PauseMod(1); bool submitted = false; while(!Pad.Newpress.Start && !Stylus.DblClick && !submitted) { PA_ClearTextBg(SCREEN_TOP); PA_OutputSimpleText(SCREEN_TOP,0,0,"GAME OVER"); PA_OutputText(SCREEN_TOP,0,1,"YOUR SCORE: %d", game.score); if(game.score<highscore.points) { PA_OutputText(SCREEN_TOP,0,2,"%s's High Score: %d", highscore.name, highscore.points); PA_OutputSimpleText(SCREEN_TOP,0,4,"Press Start to Play Again"); }else{ PA_OutputText(SCREEN_TOP,0,2,"NEW HIGH SCORE!!!"); highscore.points=game.score; highscore.name=(char*)PA_UserInfo.Name; PA_OutputSimpleText(SCREEN_TOP,0,3,"Press Y To submit score online."); PA_OutputSimpleText(SCREEN_TOP,0,4,"Press Start to Play Again"); if(Pad.Newpress.Y) { PA_OutputSimpleText(SCREEN_TOP,0,5,"Ranking globally..."); // Init Network PA_InitWifi(); if(PA_ConnectWifiWFC()) { submitScore(); getHighScores(); submitted=true; Wifi_DisconnectAP(); }else{ PA_OutputSimpleText(SCREEN_TOP,0,6,"Wifi Connection Failed."); } Wifi_DisableWifi(); } } // Sleep PA_CheckLid(); PA_WaitForVBL(); } }
// Function: main() int main(int argc, char ** argv) { PA_Init(); // Initializes PA_Lib PA_InitVBL(); // Initializes a standard VBL PA_InitText(1, 0); PA_SetBrightness(0, 31); PA_Init8bitBg(0, 3); PA_LoadGif(0, (void*)test); irqSet(IRQ_HBLANK, HBL_function); irqEnable(IRQ_HBLANK); u8 i; level = 0; while(1){ PA_OutputText(1, 8, 10, "Fading in, white "); for(level = 0; level < 80; level++) PA_WaitForVBL(); for(i = 0; i < 60; i++) PA_WaitForVBL(); // Wait 1 second black = 1; PA_OutputText(1, 8, 10, "Fading out, black "); for(level = 80; level > 0; level--) PA_WaitForVBL(); for(i = 0; i < 60; i++) PA_WaitForVBL(); // Wait 1 second PA_OutputText(1, 8, 10, "Fading in, black "); for(level = 0; level < 80; level++) PA_WaitForVBL(); for(i = 0; i < 60; i++) PA_WaitForVBL(); // Wait 1 second black = 0; PA_OutputText(1, 8, 10, "Fading out, white "); for(level = 80; level > 0; level--) PA_WaitForVBL(); for(i = 0; i < 60; i++) PA_WaitForVBL(); // Wait 1 second } return 0; } // End of main()
void displayLives(int stock) { PA_OutputText(SUB_SCREEN, 0, 1, " "); PA_OutputText(SUB_SCREEN, 0, 22, " "); if(players.size() >= 1) { PA_SetTextTileCol(SUB_SCREEN, TEXT_RED); int lives = stock - score.getDeaths(0) - sdcost*score.getSDs(0); PA_OutputText(SUB_SCREEN, 0, 1, "x%d", lives); } if(players.size() >= 2) { PA_SetTextTileCol(SUB_SCREEN, TEXT_BLUE); int lives = stock-score.getDeaths(1) - sdcost*score.getSDs(1); stringstream ss; ss << lives; int length = ss.str().size(); PA_OutputText(SUB_SCREEN, 31-length, 1, "x%d", lives); } if(players.size() >= 3) { PA_SetTextTileCol(SUB_SCREEN, TEXT_YELLOW); int lives = stock-score.getDeaths(2) - sdcost*score.getSDs(2); PA_OutputText(SUB_SCREEN, 0, 22, "x%d", lives); } if(players.size() >= 4) { PA_SetTextTileCol(SUB_SCREEN, TEXT_GREEN); int lives = stock-score.getDeaths(3) - sdcost*score.getSDs(3); stringstream ss; ss << lives; int length = ss.str().size(); PA_OutputText(SUB_SCREEN, 31-length, 22, "x%d", lives); } }
void displayPercentages() { PA_OutputText(SUB_SCREEN, 0, 0, " "); PA_OutputText(SUB_SCREEN, 0, 23, " "); // clears the text if(players.size() >=1) { PA_SetTextTileCol(SUB_SCREEN, TEXT_RED); int damage = (int)(players[0]->getDamagePercent()); PA_OutputText(SUB_SCREEN, 0, 0, "%d %", damage); } // displays damage percent of player 1 if(players.size() >= 2) { PA_SetTextTileCol(SUB_SCREEN, TEXT_BLUE); int damage = (int)(players[1]->getDamagePercent()); stringstream ss; ss << damage; int length = ss.str().size(); PA_OutputText(SUB_SCREEN, 30-length, 0, "%d %", damage); } // displays damage percent of player 2 if(players.size() >= 3) { PA_SetTextTileCol(SUB_SCREEN, TEXT_YELLOW); int damage = (int)(players[2]->getDamagePercent()); PA_OutputText(SUB_SCREEN, 0, 23, "%d %", damage); } // damage of player 3 if(players.size() >= 4) { PA_SetTextTileCol(SUB_SCREEN, TEXT_GREEN); int damage = (int)(players[3]->getDamagePercent()); stringstream ss; ss << damage; int length = ss.str().size(); PA_OutputText(SUB_SCREEN, 30-length, 23, "%d %", damage); } } // displays damage percents on the sub screen
//Main... int main(void){ PA_Init(); //PAlib Init... PA_InitVBL(); //VBL Init... // No palettes ! PA_Create16bitSprite(0, // Screen 0, // Sprite number (void*)ship_Sprite, // image to load, 128 pixels wide ! OBJ_SIZE_32X32, // sprite size 0, // x 50); //y // Enable the alpha-blending PA_EnableSpecialFx(0, // Screen SFX_ALPHA, // Alpha blending mode 0, // Nothing SFX_BG0 | SFX_BG1 | SFX_BG2 | SFX_BG3 | SFX_BD); // Everything normal PA_InitText(1, 0); PA_OutputText(1, 1, 12, "Press Up/Down to change alpha"); u8 alpha = 15; while(1){ // Infinite loop alpha += Pad.Newpress.Up - Pad.Newpress.Down; alpha &= 15; PA_OutputText(1, 10, 14, "Alpha : %02d", alpha); PA_Set16bitSpriteAlpha(0, 0, alpha); PA_WaitForVBL(); } return 0; }
void MyCustomVBL(void) { // VBL function to play while gif is on... if(Pad.Newpress.Start){ pause = !pause; // if 1 returns 0, if 0 returns 1 if (pause == 1) { PA_GifAnimPause(); // pause animation PA_OutputSimpleText(0, 10, 11, "PAUSE !"); } else { PA_GifAnimPlay(); // unpause... PA_OutputSimpleText(0, 10, 11, " "); } } // Change speed according to keys if (Pad.Held.Up) speed += 0.02; if (Pad.Held.Down && (speed > 0.02)) speed -= 0.02; PA_GifAnimSpeed(speed); // Gif speed command :) PA_OutputText(0, 10, 11, "Speed : %f2 ", speed); // Change starting frame... if (Pad.Newpress.B) StartFrame += 1; if (Pad.Newpress.A && (StartFrame > 0)) StartFrame -= 1; PA_OutputText(0, 2, 13, "Start Frame : %d ", StartFrame); PA_GifSetStartFrame(StartFrame); // Set the starting frame number... // Change ending frame... if (Pad.Newpress.Y) EndFrame += 1; if (Pad.Newpress.X && (EndFrame > 0)) EndFrame -= 1; PA_OutputText(0, 2, 14, "End Frame : %d ", EndFrame); PA_GifSetEndFrame(EndFrame); // Set the ending frame number... PA_OutputText(0, 4, 16, "Current Frame : %d ", PA_GifGetFrame()); }
// Function: main() int main(int argc, char ** argv) { PA_Init(); // Initializes PA_Lib PA_InitVBL(); // Initializes a standard VBL PA_InitText(1, 0); PA_OutputText(1,3,2, "--- BG Alpha Example ---"); PA_OutputText(1,3,4, "D-Pad Left : Alpha1--"); PA_OutputText(1,3,5, "D-Pad Right: Alpha1++"); PA_OutputText(1,3,6, "D-Pad Up : Alpha2--"); PA_OutputText(1,3,7, "D-Pad Down : Alpha2++"); //turn on alpha.... PA_EnableSpecialFx(0, SFX_ALPHA, SFX_BG0 | SFX_BG1 | SFX_BG2 | SFX_BG3 | SFX_OBJ | SFX_BD, SFX_BG0 | SFX_BG1 | SFX_BG2 | SFX_BG3 | SFX_OBJ | SFX_BD); // Load the Backgrounds PA_EasyBgLoad(0, 0, bg0); PA_EasyBgLoad(0, 1, bg1); int alpha1 = 15; int alpha2 = 15; PA_SetSFXAlpha(0, alpha1, alpha2); // Infinite loop to keep the program running while (1) { if (Pad.Newpress.Left && alpha1 > 0) alpha1--; else if (Pad.Newpress.Right && alpha1 < 31) alpha1++; if (Pad.Newpress.Down && alpha2 > 0) alpha2--; else if (Pad.Newpress.Up && alpha2 < 31) alpha2++; //update the alpha values PA_SetSFXAlpha(0, alpha1, alpha2); PA_OutputText(1,2,9, "Alpha 1: %d ", alpha1); PA_OutputText(1,2,10, "Alpha 2: %d ", alpha2); PA_WaitForVBL(); } return 0; } // End of main()
///Main function... int main(void){ //PAlib Init PA_Init(); PA_InitVBL(); PA_InitText(0,0); // On the bottom screen PA_VBLFunctionInit(MyVBLFunction); // Init the function to be executed every frame... You can remove it by using PA_VBLFunctionReset(); while(1){ // No code beside the text output in the main loop, everything will be done in the VBL for once :) PA_OutputText(0, 2, 10, "Counter : %d", MyCounter); // /60 to get seconds PA_WaitForVBL(); //La boucle infinie du programme } return 0; }
// Function: main() int main(int argc, char ** argv) { PA_Init(); // Initializes PA_Lib PA_InitVBL(); // Initializes a standard VBL // Initialise the text system on the top screen PA_InitText(1, 0); // This'll put a green color on the bottom screen... Color component (red, green, blue) range from 0 to 31 PA_SetTextCol(0, 0, 31, 0); // The same old PA_OutputSimpleText, but now with newline support PA_OutputSimpleText(1, 1, 1, " ATTENTION:\n\nPA_OutputSimpleText now has\nsupport for line breaking in\nthe body of the text. So it's\nmuch easier to place a lot of\ntext on the screen.\n\nThis should be really useful\nif you need to parse a text\nfile loaded from FAT!"); // It works with PA_OutputText, as well PA_OutputText(1, 1, 13, "But wait, that's not all! It\nalso works with variables in\nPA_OutputText.\n\nWhat do you think of that,\n%s?\n\nIt's %d:%02d, do you know\nwhere your text is?", PA_UserInfo.Name, PA_RTC.Hour, PA_RTC.Minutes); while (1) {PA_WaitForVBL();} return 0; } // End of main()
int main(int argc, char ** argv) { PA_Init(); // Initializes PA_Lib PA_InitVBL(); // Initializes a standard VBL PA_InitWifi(); PA_ConnectWifiWFC(); // Initialise the text system on the top screen PA_InitText(0,0); PA_InitText(1, 0); char *buffer2 = malloc(256*256); PA_GetHTTP(buffer2, "http://www.google.be/index.html"); PA_OutputText(1,0,0,"r: %s",buffer2); while (1) { PA_WaitForVBL(); } return 0; } // End of main()
/* 게임 오버 */ void scr_Gameover() { int weight = 0; PA_Init(); PA_InitVBL(); UnLoad_Screen(); AS_SoundDefaultPlay((u8*) wrong, (u32) wrong_size, 100, 64, FALSE, 0); AS_SoundDefaultPlay((u8*) gameover, (u32) gameover_size, 80, 64, TRUE, 0); PA_LoadBackground(UP_SCREEN, BG3, &your_brain); // 종료스크린 출력 PA_LoadBackground(DOWN_SCREEN, BG3, &game_over); PA_InitText(UP_SCREEN, BG1); PA_SetTextTileCol(UP_SCREEN, TEXT_BLACK); weight = ((uinfo.userStage * 1000 ) + uinfo.userScore) / 3; PA_OutputText(UP_SCREEN, 10, 12, "%d.%d g", weight / 100, weight % 100); while (1) { if (Stylus.Newpress) { UnLoad_Sound(); newGame = TRUE; // 새로운 게임. return; } PA_WaitForVBL(); // 60프레임 유지 } }