int main() { PA_Init(); // Initializes PA_Lib // PA_InitVBL(); // Initializes a standard VBL PA_VBLFunctionInit(AS_SoundVBL); AS_Init(AS_MODE_MP3 | AS_MODE_SURROUND | AS_MODE_16CH); AS_SetDefaultSettings(AS_PCM_8BIT, 11025, AS_SURROUND); PA_LoadDefaultText(1, 0); StartScreen(); CreateTasks(); initMap(map); vTaskStartScheduler(); // Never returns while (1) ; return 0; }
///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(); // PA Init... PA_InitVBL(); // VBL Init... PA_Init8bitBg(1, 3); // Init a 8 bit Bg on screen 1 PA_InitText(0, 0); // Text on bottom screen PA_OutputSimpleText(0, 1, 6, "Press Start to pause/unpause"); PA_OutputSimpleText(0, 1, 7, "Press Up/Down to change speed"); PA_OutputSimpleText(0, 1, 8, "Press A/B to change StartFrame"); PA_OutputSimpleText(0, 1, 9, "Press X/Y to change EndFrame"); PA_VBLFunctionInit(MyCustomVBL); // start the function to play during gif file ! while(1) { PA_LoadGif( 1, (void*)bartman); // Gif File to play over and over again PA_Clear8bitBg(1); // Clear the screen after use 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(); } }