// 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()
// 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, // Bootom screen 0); // Background number, from 0-3, on which to load the text system PA_InitText(1, 0); // Initialise the text system on the top screen PA_SetTextCol(0, // Bottom screen 0, // No red 31, // Maximum green 0); // No blue // This'll put a green color on the bottom screen... Color component (red, green, blue) range from 0 to 31 u32 nletters = 0; // Number of letter to output... u32 letter = 0; // Current letter written... while (letter == nletters){ // Do this until the function outputs all the text ++nletters; // Next frame, one more letter... // This text function outputs a given number of letters... This way, it can do as if you were typing ! letter = PA_BoxText(1, 2, 2, 29, 15, "Hi there :p Cool, the function works perfectly ! So you see the text being typed...", nletters); PA_WaitForVBL(); // You can set more WaitForVBL if you want to slow down the text output... } PA_OutputSimpleText(0, 10, 10, "Finished !"); // Finished... // Infinite loop to keep the program running while (1){ PA_WaitForVBL(); } return 0; } // End of main()
void LAN() { PA_ResetBgSys(); PA_ResetSpriteSys(); PA_InitText(MAIN_SCREEN, 0); PA_SetTextCol(MAIN_SCREEN, 31, 31, 31); if(!IPC_Init()) { PA_OutputText(MAIN_SCREEN, 0, 0, "IPC INIT FAILED"); while(true) {} } IPC_SetChannelCallback(0, &LWIFI_IPC_Callback); PA_VBLFunctionInit(customVBL); // inits/preps DS <-> DS PA_OutputText(MAIN_SCREEN, 1, 3, "Start Game = Start/nJoin Game = Select"); fadeIn(); while(playernumber == -1) { if(!lobbyinited) { LOBBY_Init(); LOBBY_SetStreamHandler(0x0001, &receive); lobbyinited = true; } // inits liblobby else if(Pad.Newpress.Start) { playernumber = 0; LOBBY_SetOwnName("Host"); LOBBY_CreateRoom(ROOM_NAME, MAX_PLAYERS, GAME_CODE, GAME_VER); } // creates a new game else if(Pad.Newpress.Select) { playernumber = 1; LOBBY_SetOwnName("Client"); LOBBY_JoinRoom(LOBBY_GetRoomByGame(0, GAME_CODE)); } // joins a created game PA_WaitForVBL(); } int max = LOBBY_GetUsercountInRoom(LOBBY_GetRoomByUser(LOBBY_GetUserByID(USERID_MYSELF))); PA_OutputText(MAIN_SCREEN, 1, 3, " "); PA_OutputText(MAIN_SCREEN, 1, 4, " "); PA_OutputText(MAIN_SCREEN, 1, 3, "Waiting for connection"); while(max < 2) { max = LOBBY_GetUsercountInRoom(LOBBY_GetRoomByUser(LOBBY_GetUserByID(USERID_MYSELF))); PA_OutputText(MAIN_SCREEN, 1, 4, "%d", max); PA_WaitForVBL(); } players.push_back(new Kirby(512/2 -96 -32, 256/3 -32, 1, players, &display)); Stage stage = setStage(FINALDESTINATION); PA_InitText(MAIN_SCREEN, 1); // inits text on the main screen (displays time) PA_SetTextCol(MAIN_SCREEN, 31, 31, 31); // text color = white PA_OutputText(MAIN_SCREEN, 1, 3, " "); PA_OutputText(MAIN_SCREEN, 1, 4, " "); while(true) { if(playernumber == 0) { players[0] -> act(); dat[0] = (int)(players[0] -> x); dat[1] = (int)(players[0] -> y); dat[2] = PA_GetSpriteAnimFrame(MAIN_SCREEN, players[0] -> SPRITENUM); LOBBY_SendToUser(LOBBY_GetUserByID(0), 0x0001, (unsigned char *)dat, 10); } scrollScreen(); PA_WaitForVBL(); } }
/** * Inits things for the game */ void init() { // Init PA PA_Init(); PA_InitVBL(); // Init Sound PA_InitSound(); // Init Text PA_InitText(SCREEN_TOP, 0); // debug(); // Roll pre-game credits if(false) { // Code I wish I could put into rollPreCredits(); u8 counter=0; // used to count till timeout // Text clear_text(); print(5,3,PRECREDITS); // logo on bottom screen PA_EasyBgLoad(SCREEN_BOTTOM,3, splash_pong); // Wait & fade out counter = 0; PA_WaitFor(Pad.Newpress.A || Pad.Newpress.Start || Stylus.Newpress || counter++>IDLETIME); fadeOut(); // run DSX/Comp screen PA_EasyBgLoad(SCREEN_TOP, 3, splash_comp); PA_EasyBgLoad(SCREEN_BOTTOM,3, splash_comp2); // Wait & fade out counter = 0; PA_WaitFor(Pad.Newpress.A || Pad.Newpress.Start || Stylus.Newpress || counter++>IDLETIME); fadeOut(); // run PA_Lib & Eclipse screens PA_EasyBgLoad(SCREEN_TOP, 3, splash_palib); PA_EasyBgLoad(SCREEN_BOTTOM,3, splash_eclipse); // Wait & fade out counter = 0; PA_WaitFor(Pad.Newpress.A || Pad.Newpress.Start || Stylus.Newpress || counter++>IDLETIME); fadeOut(); //rollPreCredits(); } PA_InitText(SCREEN_TOP, 0); PA_SetTextCol(SCREEN_TOP, 0, 0, 0); // Some variables game.smartAI = 0; game.score = 0; game.lives = 3; game.rank = ""; game.gameover = false; // Load Palletes PA_LoadSpritePal(SCREEN_TOP, 1, (void*)ball_Pal); PA_LoadSpritePal(SCREEN_BOTTOM, 2, (void*)ball_Pal); PA_LoadSpritePal(SCREEN_TOP, 3, (void*)paddle_a_Pal); PA_LoadSpritePal(SCREEN_BOTTOM, 4, (void*)paddle_b_Pal); // create sprites PA_CreateSprite(SCREEN_BOTTOM, BALL_BOTTOM, (void*)ball_Sprite, OBJ_SIZE_16X16, 1, 1, -BALL_WIDTH, -BALL_HEIGHT); PA_CreateSprite(SCREEN_TOP, BALL_TOP, (void*)ball_Sprite, OBJ_SIZE_16X16, 1, 2, -BALL_WIDTH, -BALL_HEIGHT); PA_CreateSprite(SCREEN_BOTTOM, PADDLE1, (void*)paddle_a_Sprite, OBJ_SIZE_32X16, 1, 3, -PADDLE_WIDTH, -PADDLE_HEIGHT); PA_CreateSprite(SCREEN_TOP, PADDLE2, (void*)paddle_b_Sprite, OBJ_SIZE_32X16, 1, 4, -PADDLE_WIDTH, -PADDLE_HEIGHT); // create backgrounds PA_EasyBgLoad(SCREEN_TOP, 2, background_top); PA_EasyBgLoad(SCREEN_BOTTOM, 2, background_bottom); // Init high score to 0. (Should probably read from a save) highscore.points = 0; highscore.name = "No one"; highscore.submitted = false; }