本文整理汇总了C++中PA_WaitForVBL函数的典型用法代码示例。如果您正苦于以下问题:C++ PA_WaitForVBL函数的具体用法?C++ PA_WaitForVBL怎么用?C++ PA_WaitForVBL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PA_WaitForVBL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PA_WriteTextFile
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;
}
示例2: PA_SetBrightness
/**
**Splash run function
**/
void Splash::run(){
s16 i;
// Transition to normal visible background
for(i = 160; i >= 0; i--){
PA_SetBrightness(0, i/5);
PA_SetBrightness(1, i/5);
PA_WaitForVBL();
}
s16 time = 180; // 180 frames = 3 seconds
while(time && (!Pad.Newpress.Anykey) && (!Stylus.Newpress)){ // Display until time over or keys pressed
time--; // time goes by
PA_WaitForVBL();
}
// Transition to white
for(i = 0; i < 160; i++){
PA_SetBrightness(0, i/5);
PA_SetBrightness(1, i/5);
PA_WaitForVBL();
}
// Now that it's all white, clean all that and you're ready to go !
PA_ResetBgSys();
PA_SetBrightness(0, 0); // normal
PA_SetBrightness(1, 0); // normal
//Switch to main game state
delete mainState;
mainState = new Menu();
}
示例3: PA_BgTransCenter
/**
**Splash run function
**/
void Menu::run(){
s8 i;
for (i = TRANS_LENGTH; i >= 0; i--) { // Fade length...
PA_BgTransCenter(0, // screen
2, // fade type, from 0 to 4, test them out !
0, // invert
i); // Time, 0 being the screen completely visible, 32 completely out
PA_WaitForVBL(); // To slow down the fades, we wait a frame...
}
PA_PlaySoundRepeat(0, main_music);
while(!Stylus.Newpress){ // Display until keys pressed
PA_WaitForVBL();
}
for (i = 0; i <= TRANS_LENGTH; i++) {
PA_BgTransCenter(0, 2, 0, i);// same thing...
PA_WaitForVBL(); // To slow down the fades, we wait a frame...
}
PA_ResetBgSys();
PA_WaitForVBL();
//Switch to level splash
delete mainState;
mainState = currentLevelSplash;
}
示例4: main
// Function: main()
int main(int argc, char ** argv){
PA_Init(); // PA Init...
PA_InitVBL(); // VBL Init...
// Init the sound system
AS_Init(AS_MODE_SURROUND | AS_MODE_16CH);
AS_SetDefaultSettings(AS_PCM_8BIT, 11025, AS_SURROUND);
PA_SetBgColor(0, PA_RGB(31, 31, 31)); // White background color
// First, convert the gif to a sprite format...
u8 *spritegfx = PA_GifToTiles((void*)Mollusk, // Gif file
spritepal); // our palette
// Next, load the sprite...
PA_CreateSprite(0, 0, spritegfx, OBJ_SIZE_64X64, 1, 0, 64, 64); // Just like plain sprites !
PA_LoadSpritePal(0, 0, spritepal); // Just like plain palettes !
// spritegfx can be used over and over again to load other sprites...
// If you do not need it anymore, use free(spritegfx); to free the memory it uses !
s32 spritex = -64; // Sprite position
s32 pan = 0; // Audio panning
PA_SetSpriteHflip(0, 0, 1); // Turn sprite around... again...
while(1) {
int channel0 = PA_PlaySimpleSound(Zoom); // Play sound...
for (spritex = -64; spritex < 256; spritex +=2){
pan = spritex/2;
if (pan < 0) pan = 0; if (pan > 127) pan = 127; // Limit range...
PA_SetSpriteX(0, 0, spritex);
PA_SetSoundChannelPan(channel0, pan);
PA_WaitForVBL();
}
PA_SetSpriteHflip(0, 0, 0); // Turn sprite around...
int channel1 = PA_PlaySimpleSound(Zoom);
for (spritex = 256; spritex > -65; spritex -=2){
pan = spritex/2;
if (pan < 0) pan = 0; if (pan > 127) pan = 127; // Limit range...
PA_SetSpriteX(0, 0, spritex);
PA_SetSoundChannelPan(channel1, pan);
PA_WaitForVBL();
}
PA_SetSpriteHflip(0, 0, 1); // Turn sprite around... again...
}
return 0;
} // End of main()
示例5: ds_global_breakpoint
void ds_global_breakpoint(char *where, int X) {
char error[255];
char memused[100];
sprintf(memused,"U: %d / F: %d ", getMemUsed(), getMemFree());
sprintf(error,"<Breakpoint> \n %s \n %s",where,memused);
// Prepare JSOB
//PA_Reset3DSprites2Banks();
//PA_3DProcess();
ds_global_fillScreen(0,ds_global_getScreen1(),PA_RGB(0,0,16));
ds_global_fillScreen(1,ds_global_getScreen0(),PA_RGB(0,0,16));
// Fill JSOB
PA_SmartText16bBuf_DS(ds_global_getScreen(0),
80, 48, // base
255 - 32, 191, // max
" -- Breakpoint!!!\n /\n MMMM\n MMMMMM\n MMMMMMM\n MDMM===M\n MDM=X=X\n MDM====M\n MDMM===M\n MNNM-MM\n MNM-M\n MM--M",
PA_RGB(31,31,31), 1, 1, 255); // Features
PA_CenterSmartText16bBuf_DS(ds_global_getScreen(1),
0, 0, // base
255, 64, // max
"KSDS Breakpoint",PA_RGB(31,31,31), 3, 1); // Features
PA_CenterSmartText16bBuf_DS(ds_global_getScreen(1),
0, 0, // base
255, 191, // max
error,PA_RGB(31,31,31), 2, 1); // Features
if (X) {
PA_CenterSmartText16bBuf_DS(ds_global_getScreen(1),
0, 191 - 32, // base
255, 191, // max
"Please press X...",PA_RGB(31,31,31), 1, 1); // Features
} else {
PA_CenterSmartText16bBuf_DS(ds_global_getScreen(1),
0, 191 - 32, // base
255, 191, // max
"Please press Y...",PA_RGB(31,31,31), 1, 1); // Features
}
// Show JSOB
ds_global_paintScreen(1,ds_global_getScreen1(),0,0);
ds_global_paintScreen(0,ds_global_getScreen0(),0,0);
// Wait...
PA_DisableSpecialFx(0);
PA_DisableSpecialFx(1);
if (X) {
while (!Pad.Newpress.X) {
PA_WaitForVBL();
}
} else {
while (!Pad.Newpress.Y) {
PA_WaitForVBL();
}
}
}
示例6: main
// 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()
示例7: 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,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()
示例8: get_players_name
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();
}
示例9: initScreen
void initScreen() {
PA_Init();
PA_LoadBackground(DOWN_SCREEN, BACKGROUND_DOWN, &start);
PA_WaitForVBL();
}
示例10: main
// Function: main()
int main(int argc, char ** argv)
{
PA_Init(); // Initializes PA_Lib
PA_InitVBL(); // Initializes a standard VBL
PA_Init16cBg(0, 3); PA_Init16cBg(1, 3); // 16 color background init with default colors for text
// Infinite loop to keep the program running
while (1)
{
sprintf(text, // string to use
"%02d/%02d/%02d", PA_RTC.Day, PA_RTC.Month, PA_RTC.Year); // String to transform
PA_16cText(0, 10, 20, 255, 40, text, 1, 3, 100); // Display the text transformed :)
// And the time...
sprintf(text, "%02d:%02d %02d seconds", PA_RTC.Hour, PA_RTC.Minutes, PA_RTC.Seconds);
PA_16cText(0, 10, 40, 255, 60, text, 1, 3, 100); // Display the text transformed :)
PA_WaitForVBL();
PA_16cErase(0);
}
return 0;
} // End of main()
示例11: main
// Function: main()
int main(int argc, char ** argv)
{
PA_Init(); // Initializes PA_Lib
PA_InitVBL(); // Initializes a standard VBL
// Let's not load any backgrounds :p
PA_SetBgPalCol(0, 0, PA_RGB(31, 31, 31)); // Set the bottom screen color to white
PA_SetBgPalCol(1, 0, PA_RGB(0, 0, 0)); // set the top screen color to black
// This will initialise a 16 bit background on each screen. This must be loaded before any other background.
// If you need to load this after a backgrounds, you'll have to use PA_ResetBgSys, PA_Init8bit, then reload
// your backgrounds...
PA_Init16bitBg(0, 3);
PA_Init16bitBg(1, 3);
// Infinite loop to keep the program running
while (1)
{
// Simple draw function, draws on the screen...
PA_16bitDraw(0, // Screen
PA_RGB(31, 0, 0)); // Color : full red...
// (The first shooting line on emu is a bug from the emu, I don't have it on DS)
PA_Put16bitPixel(1, Stylus.X, Stylus.Y, PA_RGB(0, 31, 0)); // Draws a pixel on the top screen, corresponding to the stylus's position
PA_WaitForVBL();
}
return 0;
} // End of main()
示例12: main
/**
* Entry point of program.
*/
int main(int argc, char ** argv)
{
init();
while(true) // Keep app running
{
setupGame();
while(game.lives) // New Round
{
setupRound();
while(!game.gameover) // Neither player missed the ball
{
getInput();
processAI();
moveBall();
displayOutput();
// Sleep
PA_CheckLid();
PA_WaitForVBL();
}
postRound();
}
postGame();
}
return 0;
}
示例13: main
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;
}
示例14: main
int main(int argc, char** argv) {
PA_Init();
PA_InitVBL();
defaultExceptionHandler();
PA_SetScreenSpace(0);
player = new ship();
PA_DualLoadSpritePal(ENEMIES, (void*)ikaruga_Pal);
for(int n = ENEMIES; n < BULLETS; n++) {
PA_DualCreateSprite(n, (void*)ikaruga_Sprite, OBJ_SIZE_32X32, COLOR256, ENEMIES, -32, -32);
PA_DualSetSpriteVflip(n, true);
}
PA_DualLoadSpritePal(BULLETS, (void*)bullets_Pal);
for(int n = BULLETS; n < 128; n++) PA_DualCreateSprite(n, (void*)bullets_Sprite, OBJ_SIZE_8X8, COLOR256, BULLETS, -8, -8);
for(int x = 32; x < 224; x+=32)
for(int y = 0; y < 32; y+=32)
enemies.push_back(new enemy(x, y));
while(true) {
player->update();
std::vector<enemy*> temp;
for(int n = 0; n < (int)enemies.size(); n++) if(enemies[n]->update()) temp.push_back(enemies[n]);
enemies = temp;
PA_WaitForVBL();
}
return 0;
}
示例15: main
//Fonction principale du code
int main(void){
PA_Init(); //Initialision of PAlib
PA_InitVBL();
PA_InitText(0,0);
PA_LoadSpritePal(0, // Screen
0, // Palette number
(void*)sprite0_Pal); // Palette name
//Create the sprite
PA_CreateSprite(0, 0,(void*)vaisseau_Sprite, OBJ_SIZE_32X32,1, 0, 0, 0);
while(1){ // Main loop
// Update the position according to the keypad...
x += Pad.Held.Right - Pad.Held.Left;
y += Pad.Held.Down - Pad.Held.Up;
// Set the sprite's position
PA_SetSpriteXY(0, // screen
0, // sprite
x, // x position
y); // y...
PA_WaitForVBL();
}
return 0;
}