Exemplo n.º 1
0
int main(int argc, char ** argv) {  
  // General initializations
  PA_Init();
  PA_InitVBL();
  PA_InitRand();
#ifndef DEBUG
  // Sound init to play mp3 and/or sfx
  PA_InitASLibForMP3(AS_MODE_MP3 | AS_MODE_SURROUND | AS_MODE_16CH);
#endif
  // Initialize the Wifi handler
  l_wifi.initialize();
#ifndef DEBUG
  // Set the sound settings
  AS_SetDefaultSettings(AS_PCM_8BIT, 44100, AS_SURROUND);
#endif
  // Initialize the background transitions
  PA_InitBgTrans(0);
  PA_BgTransDiag(0, TRANSITION_TYPE, 0, 1, 0);
  // Load sprite palettes
  PA_LoadSpritePal(1, PALETTE_NB_CASTLE, (void*)castle_Pal);
  PA_LoadSpritePal(1, PALETTE_NB_ITEM, (void*)item_Pal);
  // Enable alpha blending at the bottom and top screens
  PA_EnableSpecialFx(0, SFX_ALPHA, 0, SFX_BG0 | SFX_BG1 | SFX_BG2 | SFX_BG3 | SFX_BD);
  PA_SetSFXAlpha(0,	7, 15);
  PA_EnableSpecialFx(1, SFX_ALPHA, 0, SFX_BG0 | SFX_BG1 | SFX_BG2 | SFX_BG3 | SFX_BD);
  PA_SetSFXAlpha(1,	7, 15);
  // Main menu object
  CMenu l_menu;
  while(1) {
    // Display the menu
    l_menu.displayMenu();
  }
  return 0;
}
Exemplo n.º 2
0
// 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()
Exemplo n.º 3
0
int main(void){

	PA_Init(); //PAlib inits
	PA_InitVBL();
	
	PA_LoadSpritePal(0, // Screen
					0, // Palette number
					(void*)sprite0_Pal);	// Palette name
					
	// We'll create 2 sprites
	PA_CreateSprite(0, 0, (void*)mollusk_Sprite, OBJ_SIZE_32X32, 1, 0, 0, 50); 
	PA_CreateSprite(0, 1, (void*)mollusk_Sprite, OBJ_SIZE_32X32, 1, 0, 64, 50); 

	PA_SetSpriteMode(0, // Screen
					0, // Sprite
					1); // Alphablending
	
	s16 alpha = 7; // Transparency level

	// 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


	while(1) // Infinite loops
	{
		alpha += Pad.Newpress.Up - Pad.Newpress.Down;
		PA_SetSFXAlpha(0, // Screen
						alpha, // Alpha level, 0-15
						15); // Leave this to 15
		
		PA_WaitForVBL();
	}
	
return 0;
}