コード例 #1
0
ファイル: main.c プロジェクト: antoniojesusnc/touhouDS
int main(int argc, char **argv) {

	consoleDemoInit();		// Inicializa la consola de texto
	consoleClear();			// Borra la pantalla
	setBrightness(3, 0);	// Restaura el brillo

	NF_InitTiledBgBuffers();	// Inicializa los buffers para almacenar fondos
	NF_InitTiledBgSys(1);		// Iniciliaza los fondos Tileados para la pantalla inferior
	
	NF_SetRootFolder("NITROFS");	// Define la carpeta ROOT para usar NITROFS
	
	NF_InitTextSys(1);
	
	NF_LoadTextFont("fnt/default", "normal", 256, 256, 0);	// Carga la seccion "normal" de la fuente, tamaño del mapa 256x256
	
	
	NF_CreateTextLayer(1, 0, 0, "normal"); 	// crea una capa que contendra el texto
									// 0,1 pantalla | id de la capa | 
									// rotacion (0 ninguna, 1 derecha, 2 izquierda) | nombre de la fuente
	

	NF_WriteText(1, 0, 1, 1, "Hola Mundo!\n Hello World!"); 
	
	NF_UpdateTextLayers();
	
	// Bucle (repite para siempre)
	while(1) {
		
		
		
		swiWaitForVBlank();		// Espera al sincronismo vertical

	}

	return 0;

}
コード例 #2
0
ファイル: main.cpp プロジェクト: corenting/old-homebrews
int main(int argc, char **argv) {

	// Chargement de NitroFS / NitroFS loading
	NF_Set2D(0, 0);
	NF_Set2D(1, 0);	
	consoleDemoInit();
	iprintf("\n NitroFS init. Please wait.\n\n");
	iprintf(" Chargement de NitroFS. Veuillez patienter.\n\n");
	swiWaitForVBlank();
	iprintf("OK !\n\n");
	NF_SetRootFolder("NITROFS");	// Défini le dossier root comme celui de NitroFS

	// Moteur 2D / 2D Engine
	NF_Set2D(0, 0);	
	NF_Set2D(1, 0);

	soundEnable();
	
	// Les fonds / Backgrounds
	NF_InitTiledBgBuffers();	// buffer
	NF_InitTiledBgSys(0);		// haut / top
	NF_InitTiledBgSys(1);		// bas / bottom

	//Texte / Text
	NF_InitTextSys(0); //haut / top
	NF_InitTextSys(1); //bas / bottom

	// Buffers du son / Sound buffer
	NF_InitRawSoundBuffers();

	// Chargement de la police de caractère /  Loading font
	NF_LoadTextFont("fnt/default", "haut", 256, 256, 0);
	NF_LoadTextFont("fnt/default", "bas", 256, 256, 0);

	// Calque police et couleur/ Font layer and color
	NF_CreateTextLayer(0, 0, 0,	"haut");
	NF_CreateTextLayer(1, 0, 0,	"bas");
	NF_BgSetPalColor(0, 0, 1, 0, 31, 0);
	NF_BgSetPalColor(1, 0, 1, 0, 31, 0);
	
	//Vars
	touchPosition touch;
	u16 newpress;
	s16 x;
	s16 y;
	u8 beat = 0; //high 0 / low 1
	
	NF_ResetRawSoundBuffers();
	NF_ClearTextLayer(1, 0);
	NF_ClearTextLayer(0, 0);
	NF_WriteText(0, 0, 0, 1, "___  ____    ___  ____ ____ ___ ");
	NF_WriteText(0, 0, 0, 2, "|  \\ [__     |  \\ |__| |___  |  ");
	NF_WriteText(0, 0, 0, 3, "|__/ ___]    |__/ |  | |     |  ");
	NF_WriteText(0, 0, 25, 5, "1.0");
	NF_WriteText(0, 0, 0, 22, "Corenting (www.corenting.fr)");
	NF_UpdateTextLayers(); // Actualisation du texte
	NF_LoadTiledBg("bg/1", "1", 256, 256);	
	NF_CreateTiledBg(1, 3, "1");

	//Harder Better Faster Stronger
	while(1) {
		
		// Scan touches et tactile
		scanKeys();
		touchRead(&touch);
		newpress = keysDown();
		x = touch.px;
		y = touch.py ;
	
		if (newpress&&(x > 51)&&(y > 182)&&(x < 92)&&(y < 192)) {
			if (beat == 1) {
				beat = 0;
			}
			else {
				beat = 1;
			}
		}
		
		if(beat == 0) {
			NF_WriteText(1, 0, 7, 23, "High");
			NF_UpdateTextLayers(); // Actualisation du texte
			// Chargement des samples
			do {
			NF_ResetRawSoundBuffers();
			NF_LoadRawSound("sfx/workit1", 0, 16384, 0);
			NF_LoadRawSound("sfx/makeit1", 1, 16384, 0);
			NF_LoadRawSound("sfx/doit1", 2, 16384, 0);
			NF_LoadRawSound("sfx/makesus1", 3, 16384, 0);
			NF_LoadRawSound("sfx/harder1", 4, 16384, 0);
			NF_LoadRawSound("sfx/better1", 5, 16384, 0);
			NF_LoadRawSound("sfx/faster1", 6, 16384, 0);
			NF_LoadRawSound("sfx/stronger1", 7, 16384, 0);
			NF_LoadRawSound("sfx/morethan1", 8, 16384, 0);
			NF_LoadRawSound("sfx/hour1", 9, 16384, 0);
			NF_LoadRawSound("sfx/our1", 10, 16384, 0);
			NF_LoadRawSound("sfx/never1", 11, 16384, 0);
			NF_LoadRawSound("sfx/ever1", 12, 16384, 0);
			NF_LoadRawSound("sfx/after1", 13, 16384, 0);
			NF_LoadRawSound("sfx/workis1", 14, 16384, 0);
			NF_LoadRawSound("sfx/over1", 15, 16384, 0);
			} while (0==1);
		}
		if(beat == 1) {
			NF_WriteText(1, 0, 7, 23, "Low ");
			NF_UpdateTextLayers(); // Actualisation du texte
			do {
			NF_ResetRawSoundBuffers();
			NF_LoadRawSound("sfx/workit2", 0, 16384, 0);
			NF_LoadRawSound("sfx/makeit2", 1, 16384, 0);
			NF_LoadRawSound("sfx/doit2", 2, 16384, 0);
			NF_LoadRawSound("sfx/makesus2", 3, 16384, 0);
			NF_LoadRawSound("sfx/harder2", 4, 16384, 0);
			NF_LoadRawSound("sfx/better2", 5, 16384, 0);
			NF_LoadRawSound("sfx/faster2", 6, 16384, 0);
			NF_LoadRawSound("sfx/stronger2", 7, 16384, 0);
			NF_LoadRawSound("sfx/morethan2", 8, 16384, 0);
			NF_LoadRawSound("sfx/hour2", 9, 16384, 0);
			NF_LoadRawSound("sfx/our2", 10, 16384, 0);
			NF_LoadRawSound("sfx/never2", 11, 16384, 0);
			NF_LoadRawSound("sfx/ever2", 12, 16384, 0);
			NF_LoadRawSound("sfx/after2", 13, 16384, 0);
			NF_LoadRawSound("sfx/workis2", 14, 16384, 0);
			NF_LoadRawSound("sfx/over2", 15, 16384, 0);
			} while (0==1);
		}
		
		if (newpress&&(x > 0)&&(y > 0)&&(x < 58)&&(y < 35)) {
			NF_PlayRawSound(0, 127, 127, false, 0);
		}
		
		if (newpress&&(x >= 66)&&(y >= 0)&&(x < 123)&&(y < 35)) {
			NF_PlayRawSound(1, 127, 127, false, 0);
		}
		
		if (newpress&&(x >= 132)&&(y >= 0)&&(x < 187)&&(y < 35)) {
			NF_PlayRawSound(2, 127, 127, false, 0);
		}
		
		if (newpress&&(x >= 197)&&(y >= 0)&&(x < 255)&&(y < 35)) {
			NF_PlayRawSound(3, 127, 127, false, 0);
		}
		
		if (newpress&&(x >= 0)&&(y >= 45)&&(x < 58)&&(y < 80)) {
			NF_PlayRawSound(4, 127, 127, false, 0);
		}
		
		if (newpress&&(x >= 67)&&(y >= 45)&&(x < 122)&&(y < 80)) {
			NF_PlayRawSound(5, 127, 127, false, 0);
		}		
		
		if (newpress&&(x >= 133)&&(y >= 45)&&(x < 189)&&(y < 80)) {
			NF_PlayRawSound(6, 127, 127, false, 0);
		}
		
		if (newpress&&(x >= 197)&&(y >= 45)&&(x < 252)&&(y < 80)) {
			NF_PlayRawSound(7, 127, 127, false, 0);
		}		

		if (newpress&&(x >= 0)&&(y >= 89)&&(x < 58)&&(y < 125)) {
			NF_PlayRawSound(8, 127, 127, false, 0);
		}	

		if (newpress&&(x >= 67)&&(y >= 89)&&(x < 122)&&(y < 125)) {
			NF_PlayRawSound(9, 127, 127, false, 0);
		}

		if (newpress&&(x >= 132)&&(y >= 89)&&(x < 190)&&(y < 125)) {
			NF_PlayRawSound(10, 127, 127, false, 0);
		}	
		
		if (newpress&&(x >= 198)&&(y >= 89)&&(x < 253)&&(y < 125)) {
			NF_PlayRawSound(11, 127, 127, false, 0);
		}

		if (newpress&&(x >= 0)&&(y >= 132)&&(x < 57)&&(y < 168)) {
			NF_PlayRawSound(12, 127, 127, false, 0);
		}

		if (newpress&&(x >= 66)&&(y >= 132)&&(x < 123)&&(y < 168)) {
			NF_PlayRawSound(13, 127, 127, false, 0);
		}

		if (newpress&&(x >= 132)&&(y >= 132)&&(x < 187)&&(y < 168)) {
			NF_PlayRawSound(14, 127, 127, false, 0);
		}

		if (newpress&&(x >= 197)&&(y >= 132)&&(x < 253)&&(y < 168)) {
			NF_PlayRawSound(15, 127, 127, false, 0);
		}	
		
		
		swiWaitForVBlank();
	}
	

	return 0; 

}