示例#1
0
void AS_ParseSets( void )
{
    AS_Init();

    //Parse all the sets
    if ( AS_ParseFile( AMBIENT_SET_FILENAME, aSets ) == qfalse )
    {
        Com_Error ( ERR_FATAL, S_COLOR_RED"ERROR: Couldn't load ambient sound sets from %s", AMBIENT_SET_FILENAME );
    }

//	Com_Printf( "AS_ParseFile: Loaded %d of %d ambient set(s)\n", pMap.size(), numSets );

    int iErrorsOccured = 0;
    for (namePrecache_m::iterator it = pMap->begin(); it != pMap->end(); ++it)
    {
        const char* str = (*it).first.c_str();
        ambientSet_t *aSet = aSets->GetSet( str );
        if (!aSet)
        {
            // I print these red instead of yellow because they're going to cause an ERR_DROP if they occur
            Com_Printf( S_COLOR_RED"ERROR: AS_ParseSets: Unable to find ambient soundset \"%s\"!\n",str);
            iErrorsOccured++;
        }
    }

    if (iErrorsOccured)
    {
        Com_Error( ERR_DROP, "....%d missing sound sets! (see above)\n", iErrorsOccured);
    }

//	//Done with the precache info, it will be rebuilt on a restart
//	pMap->clear();	// do NOT do this here now
}
示例#2
0
文件: main.c 项目: troy56/palibds
// 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()
示例#3
0
文件: main.c 项目: troy56/palibds
int main(int argc, char ** argv)
{
  PA_Init();
  PA_InitVBL();

  PA_InitText(0, 0);

  PA_OutputSimpleText(0, 5, 1, "FAT loading of sounds");

// Init ASlib before you play sounds
  AS_Init(AS_MODE_SURROUND | AS_MODE_16CH);
  AS_SetDefaultSettings(AS_PCM_8BIT, 11025, AS_NO_DELAY);

  fatInitDefault(); // Init for libfat. Automatically sets up DLDI and everything else you need for basic FAt access.

  PA_FatInitAllBuffers(); // Initialize all the memory buffers used by the FAT loading system

  PA_FatSetBasePath("DemoFiles/data");  // Set a base path from the card root to load your asset files from
                              // Within this base asset folder:
                              //      all background binaries should be in /bg/
                              //      2D and 3D sprite and palette binaries in /sprites/
                              //      and RAW format sound files in /sfx/


// Load a couple RAW format sounds from card FAT into memory for playback later.
  PA_FatLoadSfx("SFX_1", // A reference name for the loaded sound
                "saberoff"); // The name of sound effect in EFS to load (minus the ".RAW" extension)
  PA_FatLoadSfx("SFX_2", "sfxb");


  while(1)
  {
    PA_OutputSimpleText(0, 0, 4, "Press A/B to play loaded sounds.");

    PA_OutputSimpleText(0, 0, 6, "Or press R to load other sounds.");

    if(Pad.Newpress.A) PA_FatPlaySfx("SFX_1"); // Play a sound file loaded with PA_FatLoadSfx using its reference name
    if(Pad.Newpress.B) PA_FatPlaySfx("SFX_2");

    if(Pad.Newpress.R)
    {
// You can unload a previously loaded sound file to free its slot in memory.
      PA_FatUnloadSfx("SFX_1"); // Unload a sound file using the reference name assigned with PA_FatLoadSfx
      PA_FatUnloadSfx("SFX_2");

// Now you can load some more.
      PA_FatLoadSfx("SFX_1", "laserpower");
      PA_FatLoadSfx("SFX_2", "boi-oing");
// Actually, since you have 32 sound slots, we didn't need to unload the previous ones, but this is a demo!

    }

    PA_WaitForVBL();
  }

  return 0;
}
示例#4
0
文件: main.c 项目: troy56/palibds
int main() {
	REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR;
	IPC->mailData=0;
	IPC->mailSize=0; 
	PA_SoundBusyInit = 0;

  
	PA_Init();
	irqInit();
	irqSet(IRQ_VBLANK, PA_VBL);
	irqEnable(IRQ_VBLANK);
	irqSet(IRQ_TIMER2, timer2);
	irqEnable(IRQ_TIMER2);
	
	SetYtrigger(80);
	vcount = 80;
	irqSet(IRQ_VCOUNT, VcountHandler);
	irqEnable(IRQ_VBLANK | IRQ_VCOUNT);
	
	//supprime pour test
    irqSet(IRQ_WIFI, Wifi_Interrupt); // set up wifi interrupt
	irqEnable(IRQ_WIFI);
  
	//supprime pour test
	SndInit7 ();
	
	// Initialize AS_Lib
	AS_Init();
    
	u32 fifo_temp;   
	while(1) { // wait for magic number
		while (REG_IPC_FIFO_CR & IPC_FIFO_RECV_EMPTY)
		{
			AS_MP3Engine();
			swiWaitForVBlank();
		}
		fifo_temp=REG_IPC_FIFO_RX;
		if(fifo_temp==0x12345678)
			break;
	}
	while (REG_IPC_FIFO_CR & IPC_FIFO_RECV_EMPTY) swiWaitForVBlank();
	fifo_temp = REG_IPC_FIFO_RX; // give next value to wifi_init
	Wifi_Init(fifo_temp);

	irqSet(IRQ_FIFO_NOT_EMPTY, arm7_fifo); // set up fifo irq
	irqEnable(IRQ_FIFO_NOT_EMPTY);
	REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_RECV_IRQ;

	Wifi_SetSyncHandler(arm7_synctoarm9); // allow wifi lib to notify arm9

	while (1) {
		AS_MP3Engine();
		swiWaitForVBlank();
	}
	
	return 0;
}
示例#5
0
文件: main.c 项目: hl1itj/Team8
int main(void) {
	AS_Init(AS_MODE_SURROUND | AS_MODE_16CH);
	AS_SetDefaultSettings(AS_PCM_8BIT, 11025, AS_SURROUND); // 사운드 출력 방식 셋팅

	while (1) {
		if (scr_Main()) // 메인 , GAMEEXIT 일 경우 nds 종료
			break;
		user_init(); 	// 유저정보 초기화
		scr_Game(); 	// 게임
		scr_Gameover(); // 종료
	}
	UnLoad_Screen();	// 스크린 지우기
	return 0;

}
示例#6
0
文件: main.c 项目: hl1itj/Team3
int main(){
	PA_Init();    // Initializes PA_Lib

	AS_Init(AS_MODE_SURROUND | AS_MODE_16CH);
	AS_SetDefaultSettings(AS_PCM_8BIT, 11025, AS_SURROUND);

	PA_LoadBackground(UP_SCREEN, BACKGROUND_UP, &main_up);
	PA_LoadBackground(DOWN_SCREEN, BACKGROUND_DOWN, &main_down);

	create_tasks();

	vTaskStartScheduler();		// Never returns
	while (1)
		;
	return 0;
}
示例#7
0
文件: main.c 项目: hl1itj/Team8
int main(void) {
	void CreateTasks();

	AS_Init(AS_MODE_SURROUND | AS_MODE_16CH);
	AS_SetDefaultSettings(AS_PCM_8BIT, 11025, AS_SURROUND);

	while (1) { // Infinite loop
		if (scr_Main()) // 메인
			break; // nds 종료
		user_init(); // 유저정보 초기화
		scr_Game(); // 게임
		scr_Gameover(); // 종료

	}
	UnLoad_Screen();
	return 0;

}
示例#8
0
文件: main.c 项目: hl1itj/Team2
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;
}
示例#9
0
文件: main.c 项目: troy56/palibds
// Function: main()
int main(int argc, char ** argv)
{
	PA_Init();    // Initializes PA_Lib
	PA_InitVBL(); // Initializes a standard VBL
	PA_InitText(0, 0);
	
	
	// Init the sound system
	AS_Init(AS_MODE_SURROUND | AS_MODE_16CH);
	AS_SetDefaultSettings(AS_PCM_8BIT, 11025, AS_SURROUND);
	
	PA_OutputSimpleText(0, 1, 10, "Close the lid and see what     happens...");

	// Infinite loop to keep the program running
	while (1)
	{	
		PA_CloseLidSound2(Babye, HereWeGo); // Sound to play when lid closes and opens

		PA_WaitForVBL();
	}
	
	return 0;
} // End of main()
示例#10
0
int main(void) 
{
	AS_Init();
	
	AS_UserIsrInterrupt1 = isrInterrupt1;
	
	char msg[128];
	char* action = "";
	char statusToggle = 1;
	char frontToggle = 0;
	char lbackToggle = 0;
	char rbackToggle = 0;
	
	unsigned short lastRc5Cmd = 0;
	
	int l;
	
	AS_SerWrite("Asuro here.\r", 12);
	AS_MotorDir(AS_DIR_FWD, AS_DIR_FWD);
	
	for (;;) {
		
		unsigned short rc5_cmd = AS_Irrc5Read();
		// ignore repeated commands (note that the rc5 code is different when a 
		// button is pressed twice due to the rc5 toggle bit!)
		if (rc5_cmd && (rc5_cmd != lastRc5Cmd)) {
			lastRc5Cmd = rc5_cmd;
			
			switch (rc5_cmd & AS_RC5_COMMAND_MASK) {
				case AS_RC5_CC_STOP: {
					AS_MotorDir(AS_DIR_BREAK, AS_DIR_BREAK);
					AS_MotorSpeed(0, 0);
					action = "STOP";
					break;
					
				}
				case AS_RC5_CC_FWD: {
					AS_MotorDir(AS_DIR_FWD, AS_DIR_FWD);
					AS_MotorSpeed(120, 120);
					if (!AS_sensSwitchesOn) AS_SensSwitchesInterruptOn();
					action = "FWD";
					break;
					
				}
				case AS_RC5_CC_RWD: {
					AS_MotorDir(AS_DIR_RWD, AS_DIR_RWD);
					AS_MotorSpeed(120, 120);
					// no need for collision switches if we are going backward...
					action = "RWD";
					break;
					
				}
				case AS_RC5_CC_RIGHT: {
					AS_MotorSpeed(150, 100);
					if (!AS_sensSwitchesOn) AS_SensSwitchesInterruptOn();
					action = "RIGHT";
					break;
					
				}
				case AS_RC5_CC_LEFT: {
					AS_MotorSpeed(100, 150);
					if (!AS_sensSwitchesOn) AS_SensSwitchesInterruptOn();
					action = "LEFT";
					break;
					
				}
				case AS_RC5_CC_STATUS_LED: {
					statusToggle = (statusToggle+1) % 4;
					if (statusToggle & 1) AS_LED_GREEN_ON; else AS_LED_GREEN_OFF;
					if (statusToggle & 2) AS_LED_RED_ON; else AS_LED_RED_OFF;
					action = "STATUS LED";
					break;
					
				}
				case AS_RC5_CC_FRONT_LED: {
					frontToggle = !frontToggle;
					if (frontToggle) AS_LED_FRONT_ON; else AS_LED_FRONT_OFF;
					action = "FRONT LED";
					break;
					
				}
				case AS_RC5_CC_LBACK_LED: {
					lbackToggle = !lbackToggle;
					if (lbackToggle) AS_LED_LBACK_ON; else AS_LED_LBACK_OFF;
					action = "LEFT BACK LED";
					break;
					
				}
				case AS_RC5_CC_RBACK_LED: {
					rbackToggle = !rbackToggle;
					if (rbackToggle) AS_LED_RBACK_ON; else AS_LED_RBACK_OFF;
					action = "RIGHT BACK LED";
					break;
					
				}
				default: {
					action = "none";
					break;
				}
			}
			
			l = sprintf(msg, "RC5: %04x (%04x): %s\r", rc5_cmd, rc5_cmd & AS_RC5_COMMAND_MASK, action);
			AS_SerWrite(msg, l);
			
		}
			
	} // for (;;)
	
	return 0;
}
示例#11
0
int main(){
	// Initialisation de la PAlib de l'affichage et du son
	PA_Init();    // Initialisation de la PALib
	PA_InitVBL(); // Initialisation de l'affichage
	AS_Init(AS_MODE_16CH); //son	
	AS_SetDefaultSettings(AS_PCM_8BIT, 16384, 0); //son (type,rate)
	
	splash(); //Splashscreen
	
	// Initialisation du texte
	PA_LoadDefaultText(0, 0); //bas
	PA_LoadDefaultText(1, 0); //haut
	PA_SetTextTileCol(1, TEXT_BLACK); // texte en noir (haut)
	PA_SetTextTileCol(0, TEXT_BLACK); // texte en noir (bas)
	
	//Palettes des couleurs pour les sprites des boutons (une seule suffit) (numéro 1)
	PA_LoadSpritePal(0, 1, (void*)plus_Pal);
	
	PA_LoadBackground(1, 1, &titre); // background de l'écran du haut
	
	//Accueil
	AS_SoundDefaultPlay(pinball, pinball_size, 127, 64, true, 0); //musique de fond en boucle
	fonduentree(); //fondu d'entrée 
	if(PA_UserInfo.Language == 2) {
		PA_LoadBackground(0, 1, &jouer);
	}
	else {
		PA_LoadBackground(0, 1, &play);
	}
	PA_OutputText(1, 17, 8, "2.1"); //version
	PA_WaitFor(Pad.Newpress.Anykey || Stylus.Newpress);
	AS_SoundQuickPlay(clic);
	fondusortie();
	
	//Nouvelle partie : etiquette et reset
	debut:
	PA_ClearTextBg(0); //efface tout le texte
	PA_ResetSpriteSys(); //efface tout les sprites
	PA_OutputText(1,1,22,"                                  ");
		
	// Les variables
	u32 nmax = 0; //Nombre maximal
	u32 nmin = 0; //Nombre minimal
	u32 coup = 0; //Nombre de coups
	u32 nombre = 0; //Nombre (valeur de départ)
	u32 diff = 0;
	u32 temps = 0;
	
	//Sélection de la difficulté.
	fonduentree();
	PA_LoadBackground(0, 1, &niveau);
	while(1) {
		
		if(PA_UserInfo.Language == 2) {
			PA_OutputText(0,5,4,"Facile             (B)");
			PA_OutputText(0,5,5,"(entre 10 et 25)");
			PA_OutputText(0,5,11,"Normal             (Y)");
			PA_OutputText(0,5,12,"(entre 10 et 60)");
			PA_OutputText(0,5,18,"Difficile          (X)");
			PA_OutputText(0,5,19,"(entre 10 et 95)");
		}
		else {
			PA_OutputText(0,5,4,"Easy               (B)");
			PA_OutputText(0,5,5,"(between 10 and 25)");
			PA_OutputText(0,5,11,"Normal             (Y)");
			PA_OutputText(0,5,12,"(between 10 and 60)");
			PA_OutputText(0,5,18,"Hard               (X)");
			PA_OutputText(0,5,19,"(between 10 and 95)");
		}
		
		if((PA_StylusInZone(29, 21, 227, 57) && Stylus.Newpress) || Pad.Newpress.A) {
		nombre = 12;
		nmax = 25;
		nmin = 10;
		diff = 1;
		break;
		}
		
		if((PA_StylusInZone(29, 79, 227, 115) && Stylus.Newpress) || Pad.Newpress.A) {
		nombre = 35;
		nmax = 60;
		nmin = 10;
		diff = 2;
		break;
		}
		
		if((PA_StylusInZone(29, 135, 227, 170) && Stylus.Newpress) || Pad.Newpress.A) {
		nombre = 52;
		nmax = 95;
		nmin = 10;
		diff = 3;
		break;
		}
		
		PA_WaitForVBL();
	}
	
	u32 dsnum = PA_RandMinMax(nmin, nmax); //La valeur aléatoire entre 40 et 70
	
	PA_LoadBackground(0, 1, &jeu); //chargement du bg de jeu
	
	//Reset pour effacer l'écran de choix de la difficulté
	PA_ClearTextBg(0);
	
	//Bouton + - et +5 -5
	PA_CreateSprite(0, 0, (void*)plus_Sprite, OBJ_SIZE_32X32, 1, 1, 40, 33);
	PA_CreateSprite(0, 1, (void*)moins_Sprite, OBJ_SIZE_32X32, 1, 1, 40, 110);
	PA_CreateSprite(0, 2, (void*)okb_Sprite, OBJ_SIZE_32X32, 1, 1, 218, 157);
	PA_CreateSprite(0, 4, (void*)moins5_Sprite, OBJ_SIZE_32X32, 1, 1, 75, 110);
	PA_CreateSprite(0, 5, (void*)plus5_Sprite, OBJ_SIZE_32X32, 1, 1, 75, 33);	

	// Boucle principale
	PA_VBLCounterStart(0);
	while (1)
	{
	PA_OutputText(0,8,22,"%d", coup);
	//PA_OutputText(1,1,20,"La DS pense à : %d", dsnum);  // Débug
	//PA_OutputText(1,1,19,"Temps : %d", PA_VBLCounter[0]/60); // Débug
	if(PA_UserInfo.Language == 2) {
		if(diff == 1) {
			PA_OutputText(1,1,22,"Facile (entre %d et %d)",nmin, nmax);
		}
		if(diff == 2) {
			PA_OutputText(1,1,22,"Normal (entre %d et %d)",nmin, nmax);
		}
		if(diff == 3) {
			PA_OutputText(1,1,22,"Difficile (entre %d et %d)",nmin, nmax);
		}
	}
	else {
		if(diff == 1) {
			PA_OutputText(1,1,22,"Easy (between %d and %d)",nmin, nmax);
	}
	if(diff == 2) {
			PA_OutputText(1,1,22,"Normal (between %d and %d)",nmin, nmax);
	}
	if(diff == 3) {
			PA_OutputText(1,1,22,"Hard (between %d and %d)",nmin, nmax);
	}	
	}
	
	if(PA_UserInfo.Language == 2) {
		PA_OutputText(0,4,10,"Votre nombre:");
	}
	else {
		PA_OutputText(0,4,10,"Your number:");
	}
	PA_OutputText(0,4,12,"%d", nombre);
	if(PA_UserInfo.Language == 2) {
		PA_OutputText(0,1,22,"Coups:");
	}
	else {
		PA_OutputText(0,1,22,"Tries:");
	}
	
	if(Pad.Newpress.Up || (Stylus.Newpress && PA_SpriteTouched(0))) {
		nombre++;
		AS_SoundQuickPlay(clic);
	}
	if(Pad.Newpress.Down || (Stylus.Newpress && PA_SpriteTouched(1))) {
		nombre--;
		AS_SoundQuickPlay(clic);
	}	
	if(Pad.Newpress.Left || (Stylus.Newpress && PA_SpriteTouched(4))) {
		nombre = nombre - 5;
		AS_SoundQuickPlay(clic);
	}	
	if(Pad.Newpress.Right || (Stylus.Newpress && PA_SpriteTouched(5))) {
		nombre = nombre + 5;
		AS_SoundQuickPlay(clic);
	}
	if(nombre < nmin) {
		nombre = nmin;
	}		
	if(nombre > nmax) {
		nombre = nmax;
	}
	if((PA_SpriteTouched(2) && Stylus.Newpress) || Pad.Newpress.A) {
		coup++;
		AS_SoundQuickPlay(clic);
		if (dsnum > nombre)
		{
			PA_OutputText(0,25,11,"          ");
			PA_OutputText(0,25,11,"Plus !");
		}
		if (dsnum < nombre)
		{
			PA_OutputText(0,25,11,"          ");
			if(PA_UserInfo.Language == 2) {
				PA_OutputText(0,25,11,"Moins !");
			}
			else {
				PA_OutputText(0,25,11,"Minus !");
			}
		}
		if (dsnum == nombre)
		{
			temps = PA_VBLCounter[0]/60;
			PA_WaitFor(Stylus.Released || Pad.Released.A);
			PA_ResetSpriteSys();
			PA_LoadBackground(0, 1, &gagne);
			PA_ClearTextBg(0); //efface tout le texte
			AS_SoundQuickPlay(ok);
			//Smiley qui applaudit	
			PA_LoadSpritePal(0, 0, (void*)applaudissement_Pal); // la palette du smiley (num 0)
			PA_CreateSprite(0, 3,(void*)applaudissement_Sprite, OBJ_SIZE_32X32,1, 0, 180, 45);
			PA_StartSpriteAnimEx(0, 3, 0, 4, 12, ANIM_LOOP, 7);
			
			if(PA_UserInfo.Language == 2) {
				PA_OutputText(0,15,6,"Gagné !");
				PA_OutputText(0,6,8,"Vous avez trouvé %d", dsnum);
				PA_OutputText(0,6,9,"en %d secondes", temps);
				PA_OutputText(0,6,10,"et %d coups.", coup);
				PA_OutputText(0,6,16,"START ou touchez");
				PA_OutputText(0,6,17,"l'écran pour rejouer.");
			}
			else {
				PA_OutputText(0,15,6,"Win !");
				PA_OutputText(0,6,9,"You find %d", dsnum);
				PA_OutputText(0,6,10,"in %d seconds", temps);
				PA_OutputText(0,6,11,"and %d tests. ", coup);
				PA_OutputText(0,6,15,"START or touch");
				PA_OutputText(0,6,16,"the screen to replay.");
			}
			
			//Recommencer le jeu avec l'etiquette debut
			PA_WaitFor(Stylus.Newpress || Pad.Newpress.Start);
			AS_SoundQuickPlay(clic);
			goto debut;
		}
	}
	PA_WaitForVBL(); //Rafraichissement à ne pas bouger/enlever	
	}

return 0;
}
示例#12
0
int main() {

    PA_Init();    // Initialisation de la PALib
    PA_InitVBL(); // Initialisation de l'affichage

    splash();

    // Initialisation du texte, de la palette et du son
    PA_LoadDefaultText(0, 0); //bas
    PA_LoadDefaultText(1, 0); //haut
    PA_SetTextTileCol(1, TEXT_BLACK); // texte en noir (haut)
    PA_SetTextTileCol(0, TEXT_BLACK); // texte en noir (bas)
    PA_LoadSpritePal(0, 1, (void*)feu_Pal); // palette du feu
    PA_LoadSpritePal(0, 2, (void*)mario_Pal); //palette pour mario
    PA_LoadSpritePal(0, 3, (void*)boite_Pal); //palette pour la boite
    PA_LoadSpritePal(0, 4, (void*)piece_Pal); //palette pour la piece

    AS_Init(AS_MODE_16CH); //son
    AS_SetDefaultSettings(AS_PCM_8BIT, 8000, 0); //son (type,rate)
    AS_SoundDefaultPlay(fond_smgboss1, fond_smgboss1_size, 50, 64, true, 0); //musique de fond en boucle

    //Accueil
accueil:
    fonduentree(); //fondu d'entrée
    PA_LoadBackground(0, 1, &jeu);
    PA_LoadBackground(1, 1, &titre);
    if(PA_UserInfo.Language == 2) {
        PA_OutputText(0, 3, 6, "Le but est d'appuyer");
        PA_OutputText(0, 3, 7, "sur les boutons le");
        PA_OutputText(0, 3, 8, "plus vite possible.");
        PA_OutputText(0, 3, 9, "Quand vous appuyez sur");
        PA_OutputText(0, 3, 10, "un bouton, votre score");
        PA_OutputText(0, 3, 11, "augmente de un.");
        PA_OutputText(0, 3, 16, "Appuyez sur un bouton");
        PA_OutputText(0, 3, 17, "pour commencer !");
    }
    else {
        PA_OutputText(0, 3, 6, "The aim is to press the");
        PA_OutputText(0, 3, 7, "buttons as fast as you can.");
        PA_OutputText(0, 3, 8, "When a button is pressed,");
        PA_OutputText(0, 3, 9, "it add 1 point to");
        PA_OutputText(0, 3, 10, "your score.");
        PA_OutputText(0, 3, 16, "Press any button to start !");
    }
    PA_WaitFor(Pad.Newpress.Anykey || Stylus.Newpress);

    //Variables
    u32 coups = 0;

    //A vos marques, pret, partez !
    PA_ClearTextBg(0); //efface tout le texte du bas
    PA_VBLCounterStart(0); // compteur

    //A vos marques
    AS_SoundQuickPlay(un);
    PA_CreateSprite(0, 0, (void*)feu_Sprite, OBJ_SIZE_32X64, 1, 1, 200, 30); //feu, sprite 0
    if(PA_UserInfo.Language == 2) {
        PA_OutputText(0, 3, 6, "A vos marques...");
    }
    else {
        PA_OutputText(0, 3, 6, "Ready ?");
    }
    PA_WaitFor(PA_VBLCounter[0]/60 == 2);

    //Pret
    AS_SoundQuickPlay(deux);
    PA_SetSpriteAnim(0, 0, 2);
    if(PA_UserInfo.Language == 2) {
        PA_OutputText(0, 3, 8, "Prêt ?");
    }
    else {
        PA_OutputText(0, 3, 8, "Steady...");
    }
    PA_WaitFor(PA_VBLCounter[0]/60 == 4);


    //Partez
    AS_SoundQuickPlay(trois);
    PA_SetSpriteAnim(0, 0, 1);
    if(PA_UserInfo.Language == 2) {
        PA_OutputText(0, 3, 10, "Partez !");
    }
    else {
        PA_OutputText(0, 3, 10, "Go !");
    }
    PA_WaitFor(PA_VBLCounter[0]/60 == 6);

    PA_ClearTextBg(0); //efface tout le texte du bas
    PA_DeleteSprite(0, 0);
    PA_CreateSprite(0, 1, (void*)mario_Sprite, OBJ_SIZE_32X32, 1, 2, 100, 100); //mario, sprite 1 avec palette 2
    PA_CreateSprite(0, 2, (void*)boite_Sprite, OBJ_SIZE_16X16, 1, 3, 110, 84); //boite, sprite 2 avec palette 3
    PA_CreateSprite(0, 3, (void*)piece_Sprite, OBJ_SIZE_8X16, 1, 4, 114, 68); //boite, sprite 2 avec palette 3
    PA_VBLCounterStart(1); //compteur pour la partie à venir

    while(1) {
        PA_OutputText(0, 3, 7, "Score : %d", coups);
        if(PA_UserInfo.Language == 2) {
            PA_OutputText(0, 3, 6, "Partie en cours...");
            PA_OutputText(0, 3, 8, "Temps : %d ", 20-(PA_VBLCounter[1]/60));
        }
        else {
            PA_OutputText(0, 3, 6, "Game in progress...");
            PA_OutputText(0, 3, 8, "Time : %d ", 20-(PA_VBLCounter[1]/60));
        }
        //Incrémentation du score si la partie n'est pas fini
        if((Pad.Newpress.A || Pad.Newpress.B || Pad.Newpress.X || Pad.Newpress.Y || Pad.Newpress.L || Pad.Newpress.R || Stylus.Newpress || Pad.Newpress.Left || Pad.Newpress.Right || Pad.Newpress.Up || Pad.Newpress.Down) && PA_VBLCounter[1]/60 < 20) {
            PA_SetSpriteAnim(0, 1, 1); //fait sauter mario
            PA_SetSpriteAnim(0, 3, 1); //fait apparaitre une piece
            coups++;
        }

        //Lors du relachement des touches/stylet, les sprites reviennent a la normale
        if(Pad.Released.Anykey || Stylus.Released) {
            PA_SetSpriteAnim(0, 1, 0);//mario revient au sol
            PA_SetSpriteAnim(0, 3, 0); //et la piece disparait
        }

        //Fin de la partie
        if(PA_VBLCounter[1]/60 == 20) {
            //On efface le txt et les sprites
            PA_ClearTextBg(0);
            PA_DeleteSprite(0, 1);
            PA_DeleteSprite(0, 2);
            PA_DeleteSprite(0, 3);
            if(PA_UserInfo.Language == 2) {
                PA_OutputText(0, 3, 6, "Partie terminée !");
                PA_OutputText(0, 3, 7, "Votre score : %d", coups);
                PA_OutputText(0, 3, 9, "Appuyez sur une touche");
                PA_OutputText(0, 3, 10, "pour rejouer...");
            }
            else {
                PA_OutputText(0, 3, 6, "End of the game !");
                PA_OutputText(0, 3, 7, "Your score : %d", coups);
                PA_OutputText(0, 3, 9, "Press a button to");
                PA_OutputText(0, 3, 10, "replay...");
            }
            PA_WaitFor(PA_VBLCounter[1]/60 == 22);
            PA_WaitFor(Pad.Newpress.Anykey || Stylus.Newpress);
            goto accueil;
        }
        PA_CheckLid();
        PA_WaitForVBL();
    }

    return 0;
}