examples: Cleanup and translate more examples to English

This commit is contained in:
Antonio Niño Díaz 2023-05-20 18:42:39 +01:00
parent eb91123a9a
commit c6d6883caf
6 changed files with 605 additions and 765 deletions

View File

@ -30,7 +30,7 @@ int main(int argc, char **argv)
NF_SetRootFolder("NITROFS"); NF_SetRootFolder("NITROFS");
consoleClear(); consoleClear();
// Initialize 3D engine in the top screen in mode 0 // Initialize 3D engine in the bottom screen in mode 0
NF_Set3D(1, 0); NF_Set3D(1, 0);
// Initialize tiled backgrounds system // Initialize tiled backgrounds system
@ -66,7 +66,7 @@ int main(int argc, char **argv)
s16 ix = 4; s16 ix = 4;
s16 iy = 4; s16 iy = 4;
// Create sprites // Initialize sprite variables and create the sprites
for (int n = 0; n < MAXSPRITES; n ++) for (int n = 0; n < MAXSPRITES; n ++)
{ {
x[n] = 128 - 32; x[n] = 128 - 32;

View File

@ -1,179 +1,143 @@
// SPDX-License-Identifier: CC0-1.0 // SPDX-License-Identifier: CC0-1.0
// //
// SPDX-FileContributor: NightFox & Co., 2009-2011 // SPDX-FileContributor: NightFox & Co., 2009-2011
//
// 3D animated sprite example
// http://www.nightfoxandco.com
/*
-------------------------------------------------
NightFox's Lib Template
Ejemplo de 3D Sprites animados
Requiere DevkitARM
Requiere NightFox's Lib
Codigo por NightFox
http://www.nightfoxandco.com
Inicio 10 de Octubre del 2009
-------------------------------------------------
*/
/*
-------------------------------------------------
Includes
-------------------------------------------------
*/
// Includes C
#include <stdio.h> #include <stdio.h>
#include <time.h> #include <time.h>
// Includes propietarios NDS
#include <nds.h> #include <nds.h>
#include <filesystem.h> #include <filesystem.h>
// Includes librerias propias
#include <nf_lib.h> #include <nf_lib.h>
/*
-------------------------------------------------
Main() - Bloque general del programa
-------------------------------------------------
*/
#define SPRITEMAXNUM 255 #define SPRITEMAXNUM 255
int main(int argc, char **argv) { int main(int argc, char **argv)
{
// Set random seed based on the current time
srand(time(NULL));
// Inicializa el random // Prepare a NitroFS initialization screen
srand(time(NULL)); NF_Set2D(0, 0);
NF_Set2D(1, 0);
consoleDemoInit();
printf("\n NitroFS init. Please wait.\n\n");
printf(" Iniciando NitroFS,\n por favor, espere.\n\n");
swiWaitForVBlank();
// Pantalla de espera inicializando NitroFS // Initialize NitroFS and set it as the root folder of the filesystem
NF_Set2D(0, 0); nitroFSInit(NULL);
NF_Set2D(1, 0); NF_SetRootFolder("NITROFS");
consoleDemoInit();
printf("\n NitroFS init. Please wait.\n\n");
printf(" Iniciando NitroFS,\n por favor, espere.\n\n");
swiWaitForVBlank();
// Define el ROOT e inicializa el sistema de archivos // Initialize 3D engine in the top screen in mode 0
nitroFSInit(NULL); NF_Set3D(0, 0);
NF_SetRootFolder("NITROFS"); // Define la carpeta ROOT para usar NITROFS
// Inicializa el motor 3D // Initialize 2D engine in the bottom
NF_Set3D(0, 0); // Modo 3D_0 en la pantalla superior NF_Set2D(1, 0);
// Inicializa el motor 2D // Initialize tiled backgrounds system
NF_Set2D(1, 0); // Modo 2D_0 en la pantalla inferior NF_InitTiledBgBuffers(); // Initialize storage buffers
NF_InitTiledBgSys(0); // Top screen
NF_InitTiledBgSys(1); // Bottom screen
// Inicializa los fondos tileados // Initialize 3D sprite system
NF_InitTiledBgBuffers(); // Inicializa los buffers para almacenar fondos NF_InitSpriteBuffers(); // Initialize storage buffers
NF_InitTiledBgSys(0); // Inicializa los fondos Tileados para la pantalla superior NF_Init3dSpriteSys();
NF_InitTiledBgSys(1); // Inicializa los fondos Tileados para la pantalla inferior
// Inicializa los buffers de los Sprites // Load background files from NitroFS
NF_InitSpriteBuffers(); // Inicializa los buffers para almacenar sprites y paletas NF_LoadTiledBg("bg/nfl", "nfl", 256, 256);
NF_LoadTiledBg("bg/bg3", "bg3", 256, 256);
// Inicializa el sistema de Sprites en 3D y OpenGL // Load sprite files from NitroFS
NF_Init3dSpriteSys(); for (int n = 0; n < SPRITEMAXNUM; n ++)
NF_LoadSpriteGfx("sprite/numbers", n, 16, 16);
// Carga los fondos tileados NF_LoadSpritePal("sprite/numbers", 0);
NF_LoadTiledBg("bg/nfl", "nfl", 256, 256);
NF_LoadTiledBg("bg/bg3", "bg3", 256, 256);
// Carga los graficos de los Sprites // Transfer the required sprites to VRAM
u8 n = 0; for (int n = 0; n < SPRITEMAXNUM; n ++)
for (n = 0; n < SPRITEMAXNUM; n ++) { NF_Vram3dSpriteGfx(n, n, true);
NF_LoadSpriteGfx("sprite/numbers", n, 16, 16);
}
NF_LoadSpritePal("sprite/numbers", 0);
NF_Vram3dSpritePal(0, 0);
// Manda los graficos y paletas a la VRAM // Create backgrounds in both screens
for (n = 0; n < SPRITEMAXNUM; n ++) { NF_CreateTiledBg(0, 3, "bg3");
NF_Vram3dSpriteGfx(n, n, true); NF_CreateTiledBg(1, 3, "nfl");
}
NF_Vram3dSpritePal(0, 0);
// Crea los fondos en ambas pantallas // Variables
NF_CreateTiledBg(0, 3, "bg3"); s16 x[SPRITEMAXNUM];
NF_CreateTiledBg(1, 3, "nfl"); s16 y[SPRITEMAXNUM];
s8 ix[SPRITEMAXNUM];
s8 iy[SPRITEMAXNUM];
u16 timer[SPRITEMAXNUM];
u8 frame[SPRITEMAXNUM];
// Initialize sprite variables and create the sprites
for (int n = 0; n < SPRITEMAXNUM; n++)
{
x[n] = rand() % 239;
y[n] = rand() % 175;
timer[n] = rand() % 20;
frame[n] = rand() % 10;
// Variables if ((rand() % 100) > 50)
s16 x[SPRITEMAXNUM]; ix[n] = 1;
s16 y[SPRITEMAXNUM]; else
s8 ix[SPRITEMAXNUM]; ix[n] = -1;
s8 iy[SPRITEMAXNUM];
u16 timer[SPRITEMAXNUM];
u8 frame[SPRITEMAXNUM];
// Inicializa las variables if ((rand() % 100) > 50)
for (n = 0; n < SPRITEMAXNUM; n ++) { iy[n] = 1;
x[n] = (((int)(rand() % 239))); else
y[n] = (((int)(rand() % 175))); iy[n] = -1;
timer[n] = (((int)(rand() % 20)));
frame[n] = (((int)(rand() % 10)));
if ((rand() % 100) > 50) {
ix[n] = 1;
} else {
ix[n] = -1;
}
if ((rand() % 100) > 50) {
iy[n] = 1;
} else {
iy[n] = -1;
}
// Crea los Sprites 3D
NF_Create3dSprite(n, n, 0, x[n], y[n]);
NF_Set3dSpriteFrame(n, frame[n]);
}
// Y ordenalos en la cola segun su ID (El mas bajo tiene prioridad) NF_Create3dSprite(n, n, 0, x[n], y[n]);
NF_Sort3dSprites(); NF_Set3dSpriteFrame(n, frame[n]);
}
// Bucle (repite para siempre) // Sort their priorites based on their IDs (lower IDs have higher priority)
while(1) { NF_Sort3dSprites();
// Mueve todos los Sprites while (1)
for (n = 0; n < SPRITEMAXNUM; n ++) { {
x[n] += ix[n]; // Move sprites
if ((x[n] < 0) || (x[n] > (255 - NF_3DSPRITE[n].width))) ix[n] = -ix[n]; for (int n = 0; n < SPRITEMAXNUM; n ++)
y[n] += iy[n]; {
if ((y[n] < 0) || (y[n] > (191 - NF_3DSPRITE[n].height))) iy[n] = -iy[n]; x[n] += ix[n];
timer[n] ++; if ((x[n] < 0) || (x[n] > (255 - NF_3DSPRITE[n].width)))
if (timer[n] > 19) { ix[n] = -ix[n];
timer[n] = 0;
frame[n] ++;
if (frame[n] > 9) frame[n] = 0;
}
NF_Move3dSprite(n, x[n], y[n]);
NF_Set3dSpriteFrame(n, frame[n]);
}
// Dibuja los 3D Sprites y[n] += iy[n];
NF_Draw3dSprites(); if ((y[n] < 0) || (y[n] > (191 - NF_3DSPRITE[n].height)))
iy[n] = -iy[n];
// Actualiza la escena 3D, si no lo haces, no se mostrara en pantalla timer[n] ++;
glFlush(0); if (timer[n] > 19)
{
timer[n] = 0;
frame[n]++;
if (frame[n] > 9)
frame[n] = 0;
}
// Espera al sincronismo vertical NF_Move3dSprite(n, x[n], y[n]);
swiWaitForVBlank(); NF_Set3dSpriteFrame(n, frame[n]);
}
// Actualiza las texturas de los 3D Sprites animados con KEEPFRAMES == TRUE // Draw all 3D sprites
NF_Update3dSpritesGfx(); NF_Draw3dSprites();
// Tell the GPU to draw the scene and wait until it's done
glFlush(0);
} // Wait for the screen refresh
swiWaitForVBlank();
return 0; // Update textures of any 3D sprite with "keepframes == true"
NF_Update3dSpritesGfx();
}
return 0;
} }

View File

@ -1,183 +1,143 @@
// SPDX-License-Identifier: CC0-1.0 // SPDX-License-Identifier: CC0-1.0
// //
// SPDX-FileContributor: NightFox & Co., 2009-2011 // SPDX-FileContributor: NightFox & Co., 2009-2011
//
// Basic 3D sprite example.
// http://www.nightfoxandco.com
/*
-------------------------------------------------
NightFox's Lib Template
Ejemplo de 3D Sprites
Requiere DevkitARM
Requiere NightFox's Lib
Codigo por NightFox
http://www.nightfoxandco.com
Inicio 10 de Octubre del 2009
-------------------------------------------------
*/
/*
-------------------------------------------------
Includes
-------------------------------------------------
*/
// Includes C
#include <stdio.h> #include <stdio.h>
#include <time.h> #include <time.h>
// Includes propietarios NDS
#include <nds.h> #include <nds.h>
#include <filesystem.h> #include <filesystem.h>
// Includes librerias propias
#include <nf_lib.h> #include <nf_lib.h>
#define MAXSPRITES 32 #define MAXSPRITES 32
int main(int argc, char **argv)
{
// Set random seed based on the current time
srand(time(NULL));
/* // Prepare a NitroFS initialization screen
------------------------------------------------- NF_Set2D(0, 0);
Main() - Bloque general del programa NF_Set2D(1, 0);
------------------------------------------------- consoleDemoInit();
*/ printf("\n NitroFS init. Please wait.\n\n");
printf(" Iniciando NitroFS,\n por favor, espere.\n\n");
swiWaitForVBlank();
int main(int argc, char **argv) { // Initialize NitroFS and set it as the root folder of the filesystem
nitroFSInit(NULL);
NF_SetRootFolder("NITROFS");
// Inicializa el random // Initialize 3D engine in the top screen in mode 0
srand(time(NULL)); NF_Set3D(0, 0);
// Pantalla de espera inicializando NitroFS // Initialize 2D engine in the bottom screen in mode 0
NF_Set2D(0, 0); NF_Set2D(1, 0);
NF_Set2D(1, 0);
consoleDemoInit();
printf("\n NitroFS init. Please wait.\n\n");
printf(" Iniciando NitroFS,\n por favor, espere.\n\n");
swiWaitForVBlank();
// Define el ROOT e inicializa el sistema de archivos // Initialize tiled backgrounds system
nitroFSInit(NULL); NF_InitTiledBgBuffers(); // Initialize storage buffers
NF_SetRootFolder("NITROFS"); // Define la carpeta ROOT para usar NITROFS NF_InitTiledBgSys(0); // Top screen
NF_InitTiledBgSys(1); // Bottom screen
// Inicializa el motor 3D // Initialize 3D sprite system
NF_Set3D(0, 0); // Modo 3D_0 en la pantalla superior NF_InitSpriteBuffers(); // Initialize storage buffers
NF_Init3dSpriteSys();
// Inicializa el motor 2D // Load background files from NitroFS
NF_Set2D(1, 0); // Modo 2D_0 en la pantalla inferior NF_LoadTiledBg("bg/nfl", "nfl", 256, 256);
NF_LoadTiledBg("bg/bg3", "bg3", 256, 256);
// Inicializa los fondos tileados // Load sprite files from NitroFS
NF_InitTiledBgBuffers(); // Inicializa los buffers para almacenar fondos NF_LoadSpriteGfx("sprite/blueball", 0, 64, 64);
NF_InitTiledBgSys(0); // Inicializa los fondos Tileados para la pantalla superior NF_LoadSpritePal("sprite/blueball", 0);
NF_InitTiledBgSys(1); // Inicializa los fondos Tileados para la pantalla inferior NF_LoadSpriteGfx("sprite/redcar", 1, 128, 64);
NF_LoadSpritePal("sprite/redcar", 1);
// Inicializa los buffers de los Sprites // Transfer the required sprites to VRAM
NF_InitSpriteBuffers(); // Inicializa los buffers para almacenar sprites y paletas NF_Vram3dSpriteGfx(0, 0, true);
NF_Vram3dSpritePal(0, 0);
NF_Vram3dSpriteGfx(1, 1, true);
NF_Vram3dSpritePal(1, 1);
// Inicializa el sistema de Sprites en 3D y OpenGL // Create backgrounds in both screens
NF_Init3dSpriteSys(); NF_CreateTiledBg(0, 3, "bg3");
NF_CreateTiledBg(1, 3, "nfl");
// Carga los fondos tileados // Variables
NF_LoadTiledBg("bg/nfl", "nfl", 256, 256); s16 x[MAXSPRITES];
NF_LoadTiledBg("bg/bg3", "bg3", 256, 256); s16 y[MAXSPRITES];
s16 ix[MAXSPRITES];
s16 iy[MAXSPRITES];
// Carga los graficos de los Sprites // Initialize sprite variables and create the sprites
NF_LoadSpriteGfx("sprite/blueball", 0, 64, 64); for (int n = 0; n < MAXSPRITES; n ++)
NF_LoadSpritePal("sprite/blueball", 0); {
NF_LoadSpriteGfx("sprite/redcar", 1, 128, 64); int r = n % 2;
NF_LoadSpritePal("sprite/redcar", 1);
// Manda los graficos y paletas a la VRAM x[n] = rand() % 128;
NF_Vram3dSpriteGfx(0, 0, true); y[n] = rand() % 112;
NF_Vram3dSpritePal(0, 0); if ((rand() % 100) > 50)
NF_Vram3dSpriteGfx(1, 1, true); ix[n] = 1;
NF_Vram3dSpritePal(1, 1); else
ix[n] = -1;
if ((rand() % 100) > 50)
iy[n] = 1;
else
iy[n] = -1;
// Crea los fondos en ambas pantallas NF_Create3dSprite(n, r, r, x[n], y[n]);
NF_CreateTiledBg(0, 3, "bg3"); }
NF_CreateTiledBg(1, 3, "nfl");
// Sort their priorites based on their IDs (lower IDs have higher priority)
NF_Sort3dSprites();
// Variables while (1)
u16 n = 0; {
u16 r = 0; // Read keys
s16 x[MAXSPRITES]; scanKeys();
s16 y[MAXSPRITES]; u16 keys = keysDown();
s16 ix[MAXSPRITES];
s16 iy[MAXSPRITES];
// Inicializa las variables // Move sprites
for (n = 0; n < MAXSPRITES; n ++) { for (int n = 0; n < MAXSPRITES; n ++)
r = (n % 2); {
x[n] = (((int)(rand() % 128))); x[n] += ix[n];
y[n] = (((int)(rand() % 112))); if ((x[n] < 0) || (x[n] > (255 - NF_3DSPRITE[n].width)))
if ((rand() % 100) > 50) { ix[n] = -ix[n];
ix[n] = 1;
} else {
ix[n] = -1;
}
if ((rand() % 100) > 50) {
iy[n] = 1;
} else {
iy[n] = -1;
}
// Crea los Sprites 3D
NF_Create3dSprite(n, r, r, x[n], y[n]);
}
// Y ordenalos en la cola segun su ID (El mas bajo tiene prioridad) y[n] += iy[n];
NF_Sort3dSprites(); if ((y[n] < 0) || (y[n] > (191 - NF_3DSPRITE[n].height)))
iy[n] = -iy[n];
// Variable para la lectura del teclado NF_Move3dSprite(n, x[n], y[n]);
u16 keys = 0; }
// Bucle (repite para siempre) // Show or hide all sprites with even ID
while(1) { if (keys & KEY_A)
{
for (int n = 0; n < MAXSPRITES; n += 2)
NF_Show3dSprite(n, true);
}
// Lee el teclado if (keys & KEY_B)
scanKeys(); {
keys = keysDown(); for (int n = 0; n < MAXSPRITES; n += 2)
NF_Show3dSprite(n, false);
}
// Mueve todos los Sprites // Draw all 3D sprites
for (n = 0; n < MAXSPRITES; n ++) { NF_Draw3dSprites();
x[n] += ix[n];
if ((x[n] < 0) || (x[n] > (255 - NF_3DSPRITE[n].width))) ix[n] = -ix[n];
y[n] += iy[n];
if ((y[n] < 0) || (y[n] > (191 - NF_3DSPRITE[n].height))) iy[n] = -iy[n];
NF_Move3dSprite(n, x[n], y[n]);
}
// Muestra u oculta los sprites pares // Tell the GPU to draw the scene and wait until it's done
if (keys & KEY_A) { glFlush(0);
for (n = 0; n < MAXSPRITES; n +=2) {
NF_Show3dSprite(n, true);
}
}
if (keys & KEY_B) {
for (n = 0; n < MAXSPRITES; n +=2) {
NF_Show3dSprite(n, false);
}
} // Wait for the screen refresh
swiWaitForVBlank();
// Dibuja los 3D Sprites }
NF_Draw3dSprites();
// Actualiza la escena 3D, si no lo haces, no se mostrara en pantalla
glFlush(0);
// Espera al sincronismo vertical
swiWaitForVBlank();
}
return 0;
return 0;
} }

View File

@ -1,244 +1,224 @@
// SPDX-License-Identifier: CC0-1.0 // SPDX-License-Identifier: CC0-1.0
// //
// SPDX-FileContributor: NightFox & Co., 2009-2011 // SPDX-FileContributor: NightFox & Co., 2009-2011
//
// Example of rotating and scaling 3D sprites.
// http://www.nightfoxandco.com
/*
-------------------------------------------------
NightFox's Lib Template
Ejemplo de 3D Sprites
Rotacion y escalado
Requiere DevkitARM
Requiere NightFox's Lib
Codigo por NightFox
http://www.nightfoxandco.com
Inicio 10 de Octubre del 2009
-------------------------------------------------
*/
/*
-------------------------------------------------
Includes
-------------------------------------------------
*/
// Includes C
#include <stdio.h> #include <stdio.h>
#include <time.h> #include <time.h>
// Includes propietarios NDS
#include <nds.h> #include <nds.h>
#include <filesystem.h> #include <filesystem.h>
// Includes librerias propias
#include <nf_lib.h> #include <nf_lib.h>
#define MAXSPRITES 8 #define MAXSPRITES 8
int main(int argc, char **argv)
{
// Set random seed based on the current time
srand(time(NULL));
/* // Prepare a NitroFS initialization screen
------------------------------------------------- NF_Set2D(0, 0);
Main() - Bloque general del programa NF_Set2D(1, 0);
------------------------------------------------- consoleDemoInit();
*/ printf("\n NitroFS init. Please wait.\n\n");
printf(" Iniciando NitroFS,\n por favor, espere.\n\n");
swiWaitForVBlank();
int main(int argc, char **argv) { // Initialize NitroFS and set it as the root folder of the filesystem
nitroFSInit(NULL);
NF_SetRootFolder("NITROFS");
// Inicializa el random // Initialize 3D engine in the top screen in mode 0
srand(time(NULL)); NF_Set3D(0, 0);
// Pantalla de espera inicializando NitroFS // Initialize tiled backgrounds system
NF_Set2D(0, 0); NF_InitTiledBgBuffers(); // Initialize storage buffers
NF_Set2D(1, 0); NF_InitTiledBgSys(0); // Top screen
consoleDemoInit();
printf("\n NitroFS init. Please wait.\n\n");
printf(" Iniciando NitroFS,\n por favor, espere.\n\n");
swiWaitForVBlank();
// Define el ROOT e inicializa el sistema de archivos // Initialize 3D sprite system
nitroFSInit(NULL); NF_InitSpriteBuffers(); // Initialize storage buffers
NF_SetRootFolder("NITROFS"); // Define la carpeta ROOT para usar NITROFS NF_Init3dSpriteSys();
// Inicializa el motor 3D // Load background files from NitroFS
NF_Set3D(0, 0); // Modo 3D_0 en la pantalla superior NF_LoadTiledBg("bg/bg3", "bg3", 256, 256);
// Inicializa los fondos tileados // Load sprite files from NitroFS
NF_InitTiledBgBuffers(); // Inicializa los buffers para almacenar fondos NF_LoadSpriteGfx("sprite/blueball", 0, 64, 64);
NF_InitTiledBgSys(0); // Inicializa los fondos Tileados para la pantalla superior NF_LoadSpritePal("sprite/blueball", 0);
NF_LoadSpriteGfx("sprite/redcar", 1, 128, 64);
NF_LoadSpritePal("sprite/redcar", 1);
// Inicializa los buffers de los Sprites // Transfer the required sprites to VRAM
NF_InitSpriteBuffers(); // Inicializa los buffers para almacenar sprites y paletas NF_Vram3dSpriteGfx(0, 0, true);
NF_Vram3dSpritePal(0, 0);
NF_Vram3dSpriteGfx(1, 1, true);
NF_Vram3dSpritePal(1, 1);
// Inicializa el sistema de Sprites en 3D y OpenGL // Create background
NF_Init3dSpriteSys(); NF_CreateTiledBg(0, 3, "bg3");
// Carga los fondos tileados // Variables
NF_LoadTiledBg("bg/bg3", "bg3", 256, 256); s16 x[MAXSPRITES];
s16 y[MAXSPRITES];
s16 ix[MAXSPRITES];
s16 iy[MAXSPRITES];
s16 rx[MAXSPRITES];
s16 ry[MAXSPRITES];
s16 rz[MAXSPRITES];
s16 scale[MAXSPRITES];
// Carga los graficos de los Sprites // Initialize sprite variables and create the sprites
NF_LoadSpriteGfx("sprite/blueball", 0, 64, 64); for (int n = 0; n < MAXSPRITES; n++)
NF_LoadSpritePal("sprite/blueball", 0); {
NF_LoadSpriteGfx("sprite/redcar", 1, 128, 64); int r;
NF_LoadSpritePal("sprite/redcar", 1);
// Manda los graficos y paletas a la VRAM if ((n % 2) == 0)
NF_Vram3dSpriteGfx(0, 0, true); r = 1;
NF_Vram3dSpritePal(0, 0); else
NF_Vram3dSpriteGfx(1, 1, true); r = 0;
NF_Vram3dSpritePal(1, 1);
x[n] = (rand() % 128) + 1;
y[n] = (rand() % 112) + 1;
if ((rand() % 100) > 50)
ix[n] = 1;
else
ix[n] = -1;
// Crea los fondos en ambas pantallas if ((rand() % 100) > 50)
NF_CreateTiledBg(0, 3, "bg3"); iy[n] = 1;
else
iy[n] = -1;
rx[n] = 0;
ry[n] = 0;
rz[n] = 0;
scale[n] = 64;
// Variables NF_Create3dSprite(n, r, r, x[n], y[n]);
u16 n = 0; }
u16 r = 0;
s16 x[MAXSPRITES];
s16 y[MAXSPRITES];
s16 ix[MAXSPRITES];
s16 iy[MAXSPRITES];
s16 rx[MAXSPRITES];
s16 ry[MAXSPRITES];
s16 rz[MAXSPRITES];
s16 scale[MAXSPRITES];
// Inicializa las variables // Sort their priorites based on their IDs (lower IDs have higher priority)
for (n = 0; n < MAXSPRITES; n ++) { NF_Sort3dSprites();
if ((n % 2) == 0) {
r = 1;
} else {
r = 0;
}
x[n] = (((int)(rand() % 128)) + 1);
y[n] = (((int)(rand() % 112)) + 1);
if ((rand() % 100) > 50) {
ix[n] = 1;
} else {
ix[n] = -1;
}
if ((rand() % 100) > 50) {
iy[n] = 1;
} else {
iy[n] = -1;
}
rx[n] = 0;
ry[n] = 0;
rz[n] = 0;
scale[n] = 64;
// Crea los Sprites 3D
NF_Create3dSprite(n, r, r, x[n], y[n]);
}
// Y ordenalos en la cola segun su ID (El mas bajo tiene prioridad) // Variable that contains the ID of the sprite selected by the user
NF_Sort3dSprites(); s16 id = 0;
// Variable para la lectura del teclado while (1)
u16 press = 0; {
u16 held = 0; // Read keys
s16 id = 0; scanKeys();
u16 press = keysDown();
u16 held = keysHeld();
// Bucle (repite para siempre) // Move sprites
while(1) { for (int n = 0; n < MAXSPRITES; n++)
{
x[n] += ix[n];
if ((x[n] < 1) || (x[n] > (255 - NF_3DSPRITE[n].width)))
ix[n] = -ix[n];
// Lee el teclado y[n] += iy[n];
scanKeys(); if ((y[n] < 1) || (y[n] > (191 - NF_3DSPRITE[n].height)))
press = keysDown(); iy[n] = -iy[n];
held = keysHeld();
// Mueve todos los Sprites NF_Move3dSprite(n, x[n], y[n]);
for (n = 0; n < MAXSPRITES; n ++) { }
x[n] += ix[n];
if ((x[n] < 1) || (x[n] > (255 - NF_3DSPRITE[n].width))) ix[n] = -ix[n];
y[n] += iy[n];
if ((y[n] < 1) || (y[n] > (191 - NF_3DSPRITE[n].height))) iy[n] = -iy[n];
NF_Move3dSprite(n, x[n], y[n]);
}
// Selecciona el Sprite con A y B // Change the selected sprite by pressing A or B
if (press & KEY_A) { if (press & KEY_A)
id ++; {
if (id > (MAXSPRITES - 1)) id = 0; id++;
} if (id > (MAXSPRITES - 1))
if (press & KEY_B) { id = 0;
id --; }
if (id < 0) id = (MAXSPRITES - 1); if (press & KEY_B)
} {
id--;
if (id < 0)
id = MAXSPRITES - 1;
}
// Rota el Z del Sprite ID // Rotate Z axis of the selcted sprite
if (held & KEY_RIGHT) { if (held & KEY_RIGHT)
rz[id] += 2; {
if (rz[id] > 512) rz[id] -= 512; rz[id] += 2;
} if (rz[id] > 512)
if (held & KEY_LEFT) { rz[id] -= 512;
rz[id] -= 2; }
if (rz[id] < 0) rz[id] += 512; if (held & KEY_LEFT)
} {
rz[id] -= 2;
if (rz[id] < 0)
rz[id] += 512;
}
// Rota el Y del Sprite ID // Rotate Y axis of the selcted sprite
if (held & KEY_DOWN) { if (held & KEY_DOWN)
ry[id] += 2; {
if (ry[id] > 512) ry[id] -= 512; ry[id] += 2;
} if (ry[id] > 512)
if (held & KEY_UP) { ry[id] -= 512;
ry[id] -= 2; }
if (ry[id] < 0) ry[id] += 512; if (held & KEY_UP)
} {
ry[id] -= 2;
if (ry[id] < 0)
ry[id] += 512;
}
// Rota el X del Sprite ID // Rotate X axis of the selcted sprite
if (held & KEY_X) { if (held & KEY_X)
rx[id] += 2; {
if (rx[id] > 512) rx[id] -= 512; rx[id] += 2;
} if (rx[id] > 512)
if (held & KEY_Y) { rx[id] -= 512;
rx[id] -= 2; }
if (rx[id] < 0) rx[id] += 512; if (held & KEY_Y)
} {
rx[id] -= 2;
if (rx[id] < 0)
rx[id] += 512;
}
// Escala el sprite // Scale sprite
if (held & KEY_R) { if (held & KEY_R)
scale[id] += 2; {
if (scale[id] > 512) scale[id] = 512; scale[id] += 2;
} if (scale[id] > 512)
if (held & KEY_L) { scale[id] = 512;
scale[id] -= 2; }
if (scale[id] < 0) scale[id] = 0; if (held & KEY_L)
} {
scale[id] -= 2;
if (scale[id] < 0)
scale[id] = 0;
}
// Aplica la rotacion // Apply rotation and scale
NF_Rotate3dSprite(id, rx[id], ry[id], rz[id]); NF_Rotate3dSprite(id, rx[id], ry[id], rz[id]);
NF_Scale3dSprite(id, scale[id], scale[id]);
// Aplica el escalado // Draw all 3D sprites
NF_Scale3dSprite(id, scale[id], scale[id]); NF_Draw3dSprites();
// Dibuja los 3D Sprites // Tell the GPU to draw the scene and wait until it's done
NF_Draw3dSprites(); glFlush(0);
// Actualiza la escena 3D, si no lo haces, no se mostrara en pantalla // Print debug information
glFlush(0); consoleClear();
printf("A / B - Sprite select %d\n", id);
printf("Rotate Z (LEFT/RIGHT) %d\n", rz[id]);
printf("Rotate Y (UP/DOWN) %d\n", ry[id]);
printf("Rotate X (X/Y) %d\n", rx[id]);
printf("Scale (R/L) %d\n", scale[id]);
// Debug // Wait for the screen refresh
consoleClear(); swiWaitForVBlank();
printf("A / B - Sprite select %d\n", id); }
printf("Rotate Z (LEFT/RIGHT) %d\n", rz[id]);
printf("Rotate Y (UP/DOWN) %d\n", ry[id]);
printf("Rotate X (X/Y) %d\n", rx[id]);
printf("Scale (R/L) %d\n", scale[id]);
// Espera al sincronismo vertical
swiWaitForVBlank();
}
return 0;
return 0;
} }

View File

@ -1,194 +1,169 @@
// SPDX-License-Identifier: CC0-1.0 // SPDX-License-Identifier: CC0-1.0
// //
// SPDX-FileContributor: NightFox & Co., 2009-2011 // SPDX-FileContributor: NightFox & Co., 2009-2011
//
// Priority change example.
// http://www.nightfoxandco.com
/*
-------------------------------------------------
NightFox's Lib Template
Ejemplo de 3D Sprites - Cambio de prioridad
Requiere DevkitARM
Requiere NightFox's Lib
Codigo por NightFox
http://www.nightfoxandco.com
Inicio 10 de Octubre del 2009
-------------------------------------------------
*/
/*
-------------------------------------------------
Includes
-------------------------------------------------
*/
// Includes C
#include <stdio.h> #include <stdio.h>
#include <time.h> #include <time.h>
// Includes propietarios NDS
#include <nds.h> #include <nds.h>
#include <filesystem.h> #include <filesystem.h>
// Includes librerias propias
#include <nf_lib.h> #include <nf_lib.h>
#define MAXSPRITES 16 #define MAXSPRITES 16
#define TARGET 8 #define TARGET 8
int main(int argc, char **argv)
{
// Set random seed based on the current time
srand(time(NULL));
/* // Prepare a NitroFS initialization screen
------------------------------------------------- NF_Set2D(0, 0);
Main() - Bloque general del programa NF_Set2D(1, 0);
------------------------------------------------- consoleDemoInit();
*/ printf("\n NitroFS init. Please wait.\n\n");
printf(" Iniciando NitroFS,\n por favor, espere.\n\n");
swiWaitForVBlank();
int main(int argc, char **argv) { // Initialize NitroFS and set it as the root folder of the filesystem
nitroFSInit(NULL);
NF_SetRootFolder("NITROFS");
// Inicializa el random // Initialize 3D engine in the top screen in mode 0
srand(time(NULL)); NF_Set3D(0, 0);
// Pantalla de espera inicializando NitroFS // Initialize tiled backgrounds system
NF_Set2D(0, 0); NF_InitTiledBgBuffers(); // Initialize storage buffers
NF_Set2D(1, 0); NF_InitTiledBgSys(0); // Top screen
consoleDemoInit();
printf("\n NitroFS init. Please wait.\n\n");
printf(" Iniciando NitroFS,\n por favor, espere.\n\n");
swiWaitForVBlank();
// Define el ROOT e inicializa el sistema de archivos // Initialize 3D sprite system
nitroFSInit(NULL); NF_InitSpriteBuffers(); // Initialize storage buffers
NF_SetRootFolder("NITROFS"); // Define la carpeta ROOT para usar NITROFS NF_Init3dSpriteSys();
// Inicializa el motor 3D // Load background files from NitroFS
NF_Set3D(0, 0); // Modo 3D_0 en la pantalla superior NF_LoadTiledBg("bg/bg3", "bg3", 256, 256);
// Inicializa los fondos tileados // Load sprite files from NitroFS
NF_InitTiledBgBuffers(); // Inicializa los buffers para almacenar fondos NF_LoadSpriteGfx("sprite/blueball", 0, 64, 64);
NF_InitTiledBgSys(0); // Inicializa los fondos Tileados para la pantalla superior NF_LoadSpritePal("sprite/blueball", 0);
NF_LoadSpriteGfx("sprite/redcar", 1, 128, 64);
NF_LoadSpritePal("sprite/redcar", 1);
// Inicializa los buffers de los Sprites // Transfer the required sprites to VRAM
NF_InitSpriteBuffers(); // Inicializa los buffers para almacenar sprites y paletas NF_Vram3dSpriteGfx(0, 0, true);
NF_Vram3dSpritePal(0, 0);
NF_Vram3dSpriteGfx(1, 1, true);
NF_Vram3dSpritePal(1, 1);
// Inicializa el sistema de Sprites en 3D y OpenGL // Create background
NF_Init3dSpriteSys(); NF_CreateTiledBg(0, 3, "bg3");
// Carga los fondos tileados // Variables
NF_LoadTiledBg("bg/bg3", "bg3", 256, 256); s16 x[MAXSPRITES];
s16 y[MAXSPRITES];
s16 ix[MAXSPRITES];
s16 iy[MAXSPRITES];
// Carga los graficos de los Sprites // Initialize sprite variables and create the sprites
NF_LoadSpriteGfx("sprite/blueball", 0, 64, 64); for (int n = 0; n < MAXSPRITES; n++)
NF_LoadSpritePal("sprite/blueball", 0); {
NF_LoadSpriteGfx("sprite/redcar", 1, 128, 64); int r;
NF_LoadSpritePal("sprite/redcar", 1);
// Manda los graficos y paletas a la VRAM if (n == TARGET)
NF_Vram3dSpriteGfx(0, 0, true); r = 1;
NF_Vram3dSpritePal(0, 0); else
NF_Vram3dSpriteGfx(1, 1, true); r = 0;
NF_Vram3dSpritePal(1, 1);
x[n] = rand() % 128;
y[n] = rand() % 112;
// Crea los fondos en ambas pantallas if ((rand() % 100) > 50)
NF_CreateTiledBg(0, 3, "bg3"); ix[n] = 1;
else
ix[n] = -1;
if ((rand() % 100) > 50)
iy[n] = 1;
else
iy[n] = -1;
// Variables NF_Create3dSprite(n, r, r, x[n], y[n]);
u16 n = 0; }
u16 r = 0;
s16 x[MAXSPRITES];
s16 y[MAXSPRITES];
s16 ix[MAXSPRITES];
s16 iy[MAXSPRITES];
// Inicializa las variables // Sort their priorites based on their IDs (lower IDs have higher priority)
for (n = 0; n < MAXSPRITES; n ++) { NF_Sort3dSprites();
if (n == TARGET) {
r = 1;
} else {
r = 0;
}
x[n] = (((int)(rand() % 128)));
y[n] = (((int)(rand() % 112)));
if ((rand() % 100) > 50) {
ix[n] = 1;
} else {
ix[n] = -1;
}
if ((rand() % 100) > 50) {
iy[n] = 1;
} else {
iy[n] = -1;
}
// Crea los Sprites 3D
NF_Create3dSprite(n, r, r, x[n], y[n]);
}
// Y ordenalos en la cola segun su ID (El mas bajo tiene prioridad) // Variable that holds the current priority of the user-controlled sprite
NF_Sort3dSprites(); s16 prio = TARGET;
// Variable para la lectura del teclado while (1)
u16 keys = 0; {
s16 prio = TARGET; // Read keys
scanKeys();
u16 keys = keysDown();
// Bucle (repite para siempre) // Move sprites
while(1) { for (int n = 0; n < MAXSPRITES; n++)
{
x[n] += ix[n];
if ((x[n] < 0) || (x[n] > (255 - NF_3DSPRITE[n].width)))
ix[n] = -ix[n];
// Lee el teclado y[n] += iy[n];
scanKeys(); if ((y[n] < 0) || (y[n] > (191 - NF_3DSPRITE[n].height)))
keys = keysDown(); iy[n] = -iy[n];
// Mueve todos los Sprites NF_Move3dSprite(n, x[n], y[n]);
for (n = 0; n < MAXSPRITES; n ++) { }
x[n] += ix[n];
if ((x[n] < 0) || (x[n] > (255 - NF_3DSPRITE[n].width))) ix[n] = -ix[n];
y[n] += iy[n];
if ((y[n] < 0) || (y[n] > (191 - NF_3DSPRITE[n].height))) iy[n] = -iy[n];
NF_Move3dSprite(n, x[n], y[n]);
}
// Cambia la prioridad del Sprite seleccionado // Change the priority of the sprite
if ((keys & KEY_A) && (prio > 0)) { if ((keys & KEY_A) && (prio > 0))
prio --; {
NF_Set3dSpritePriority(TARGET, prio); prio --;
} NF_Set3dSpritePriority(TARGET, prio);
if ((keys & KEY_B) && (prio < (MAXSPRITES - 1))) { }
prio ++; if ((keys & KEY_B) && (prio < (MAXSPRITES - 1)))
NF_Set3dSpritePriority(TARGET, prio); {
} prio ++;
// Restaura la prioridad por defecto NF_Set3dSpritePriority(TARGET, prio);
if (keys & KEY_X) NF_3dSpriteSetDepth(TARGET, 0); }
// Fuerza estar al frente
if (keys & KEY_R) NF_3dSpriteSetDepth(TARGET, -512);
// Fuerza estar al fondo
if (keys & KEY_L) NF_3dSpriteSetDepth(TARGET, 512);
// Dibuja los 3D Sprites // Restore default priority
NF_Draw3dSprites(); if (keys & KEY_X)
NF_3dSpriteSetDepth(TARGET, 0);
// Actualiza la escena 3D, si no lo haces, no se mostrara en pantalla // Move sprite on top of everything
glFlush(0); if (keys & KEY_R)
NF_3dSpriteSetDepth(TARGET, -512);
// Debug // Move sprite to the back
consoleClear(); if (keys & KEY_L)
for (n = 0; n < NF_CREATED_3DSPRITE.total; n ++) { NF_3dSpriteSetDepth(TARGET, 512);
printf("Pri:%02d Spr:%02d Spr:%02d Pri:%02d\n", n, NF_CREATED_3DSPRITE.id[n], n, NF_3DSPRITE[n].prio);
}
printf("\nSprite Id%02d is on %02d priority\n\n", TARGET, NF_3DSPRITE[TARGET].prio);
printf("A - Near B - Far");
// Espera al sincronismo vertical // Draw all 3D sprites
swiWaitForVBlank(); NF_Draw3dSprites();
} // Tell the GPU to draw the scene and wait until it's done
glFlush(0);
return 0; // Print debug information
consoleClear();
for (int n = 0; n < NF_CREATED_3DSPRITE.total; n++)
{
printf("Pri:%02d Spr:%02d Spr:%02d Pri:%02d\n",
n, NF_CREATED_3DSPRITE.id[n], n, NF_3DSPRITE[n].prio);
}
printf("\nSprite Id%02d is on %02d priority\n\n",
TARGET, NF_3DSPRITE[TARGET].prio);
printf("A - Near B - Far");
// Wait for the screen refresh
swiWaitForVBlank();
}
return 0;
} }

View File

@ -1,183 +1,144 @@
// SPDX-License-Identifier: CC0-1.0 // SPDX-License-Identifier: CC0-1.0
// //
// SPDX-FileContributor: NightFox & Co., 2009-2011 // SPDX-FileContributor: NightFox & Co., 2009-2011
//
// Priority swap example.
// http://www.nightfoxandco.com
/*
-------------------------------------------------
NightFox's Lib Template
Ejemplo de 3D Sprites
Intercambio de prioridades
Requiere DevkitARM
Requiere NightFox's Lib
Codigo por NightFox
http://www.nightfoxandco.com
Inicio 10 de Octubre del 2009
-------------------------------------------------
*/
/*
-------------------------------------------------
Includes
-------------------------------------------------
*/
// Includes C
#include <stdio.h> #include <stdio.h>
#include <time.h> #include <time.h>
// Includes propietarios NDS
#include <nds.h> #include <nds.h>
#include <filesystem.h> #include <filesystem.h>
// Includes librerias propias
#include <nf_lib.h> #include <nf_lib.h>
#define MAXSPRITES 32 #define MAXSPRITES 32
int main(int argc, char **argv)
{
// Set random seed based on the current time
srand(time(NULL));
/* // Prepare a NitroFS initialization screen
------------------------------------------------- NF_Set2D(0, 0);
Main() - Bloque general del programa NF_Set2D(1, 0);
------------------------------------------------- consoleDemoInit();
*/ printf("\n NitroFS init. Please wait.\n\n");
printf(" Iniciando NitroFS,\n por favor, espere.\n\n");
swiWaitForVBlank();
int main(int argc, char **argv) { // Initialize NitroFS and set it as the root folder of the filesystem
nitroFSInit(NULL);
NF_SetRootFolder("NITROFS");
// Inicializa el random // Initialize 3D engine in the top screen in mode 0
srand(time(NULL)); NF_Set3D(0, 0);
// Pantalla de espera inicializando NitroFS // Initialize tiled backgrounds system
NF_Set2D(0, 0); NF_InitTiledBgBuffers(); // Initialize storage buffers
NF_Set2D(1, 0); NF_InitTiledBgSys(0); // Top screen
consoleDemoInit();
printf("\n NitroFS init. Please wait.\n\n");
printf(" Iniciando NitroFS,\n por favor, espere.\n\n");
swiWaitForVBlank();
// Define el ROOT e inicializa el sistema de archivos // Initialize 3D sprite system
nitroFSInit(NULL); NF_InitSpriteBuffers(); // Initialize storage buffers
NF_SetRootFolder("NITROFS"); // Define la carpeta ROOT para usar NITROFS NF_Init3dSpriteSys();
// Inicializa el motor 3D // Load background files from NitroFS
NF_Set3D(0, 0); // Modo 3D_0 en la pantalla superior NF_LoadTiledBg("bg/bg3", "bg3", 256, 256);
// Inicializa los fondos tileados // Load sprite files from NitroFS
NF_InitTiledBgBuffers(); // Inicializa los buffers para almacenar fondos NF_LoadSpriteGfx("sprite/blueball", 0, 64, 64);
NF_InitTiledBgSys(0); // Inicializa los fondos Tileados para la pantalla superior NF_LoadSpritePal("sprite/blueball", 0);
NF_LoadSpriteGfx("sprite/redcar", 1, 128, 64);
NF_LoadSpritePal("sprite/redcar", 1);
// Inicializa los buffers de los Sprites // Transfer the required sprites to VRAM
NF_InitSpriteBuffers(); // Inicializa los buffers para almacenar sprites y paletas NF_Vram3dSpriteGfx(0, 0, true);
NF_Vram3dSpritePal(0, 0);
NF_Vram3dSpriteGfx(1, 1, true);
NF_Vram3dSpritePal(1, 1);
// Inicializa el sistema de Sprites en 3D y OpenGL // Create background
NF_Init3dSpriteSys(); NF_CreateTiledBg(0, 3, "bg3");
// Carga los fondos tileados // Variables
NF_LoadTiledBg("bg/bg3", "bg3", 256, 256); s16 x[MAXSPRITES];
s16 y[MAXSPRITES];
s16 ix[MAXSPRITES];
s16 iy[MAXSPRITES];
// Carga los graficos de los Sprites // Initialize sprite variables and create the sprites
NF_LoadSpriteGfx("sprite/blueball", 0, 64, 64); for (int n = 0; n < MAXSPRITES; n++)
NF_LoadSpritePal("sprite/blueball", 0); {
NF_LoadSpriteGfx("sprite/redcar", 1, 128, 64); int r;
NF_LoadSpritePal("sprite/redcar", 1);
// Manda los graficos y paletas a la VRAM if ((n == 0) || (n == (MAXSPRITES - 1)))
NF_Vram3dSpriteGfx(0, 0, true); r = 1;
NF_Vram3dSpritePal(0, 0); else
NF_Vram3dSpriteGfx(1, 1, true); r = 0;
NF_Vram3dSpritePal(1, 1);
x[n] = (rand() % 128) + 1;
y[n] = (rand() % 112) + 1;
// Crea los fondos en ambas pantallas if ((rand() % 100) > 50)
NF_CreateTiledBg(0, 3, "bg3"); ix[n] = 1;
else
ix[n] = -1;
if ((rand() % 100) > 50)
iy[n] = 1;
else
iy[n] = -1;
// Variables NF_Create3dSprite(n, r, r, x[n], y[n]);
u16 n = 0; }
u16 r = 0;
s16 x[MAXSPRITES];
s16 y[MAXSPRITES];
s16 ix[MAXSPRITES];
s16 iy[MAXSPRITES];
// Inicializa las variables // Sort their priorites based on their IDs (lower IDs have higher priority)
for (n = 0; n < MAXSPRITES; n ++) { NF_Sort3dSprites();
if ((n == 0) || (n == (MAXSPRITES - 1))) {
r = 1;
} else {
r = 0;
}
x[n] = (((int)(rand() % 128)) + 1);
y[n] = (((int)(rand() % 112)) + 1);
if ((rand() % 100) > 50) {
ix[n] = 1;
} else {
ix[n] = -1;
}
if ((rand() % 100) > 50) {
iy[n] = 1;
} else {
iy[n] = -1;
}
// Crea los Sprites 3D
NF_Create3dSprite(n, r, r, x[n], y[n]);
}
// Y ordenalos en la cola segun su ID (El mas bajo tiene prioridad) while (1)
NF_Sort3dSprites(); {
// Read keys
scanKeys();
u16 keys = keysDown();
// Variable para la lectura del teclado // Move sprites
u16 keys = 0; for (int n = 0; n < MAXSPRITES; n++)
{
x[n] += ix[n];
if ((x[n] < 1) || (x[n] > (255 - NF_3DSPRITE[n].width)))
ix[n] = -ix[n];
// Bucle (repite para siempre) y[n] += iy[n];
while(1) { if ((y[n] < 1) || (y[n] > (191 - NF_3DSPRITE[n].height)))
iy[n] = -iy[n];
// Lee el teclado NF_Move3dSprite(n, x[n], y[n]);
scanKeys(); }
keys = keysDown();
// Mueve todos los Sprites // Show or hide sprites with even ID
for (n = 0; n < MAXSPRITES; n ++) { if (keys & KEY_A)
x[n] += ix[n]; NF_Swap3dSpritePriority(0, MAXSPRITES - 1);
if ((x[n] < 1) || (x[n] > (255 - NF_3DSPRITE[n].width))) ix[n] = -ix[n];
y[n] += iy[n];
if ((y[n] < 1) || (y[n] > (191 - NF_3DSPRITE[n].height))) iy[n] = -iy[n];
NF_Move3dSprite(n, x[n], y[n]);
}
// Muestra u oculta los sprites pares if (keys & KEY_B)
if (keys & KEY_A) { NF_Swap3dSpritePriority(MAXSPRITES - 1, 0);
NF_Swap3dSpritePriority(0, (MAXSPRITES - 1));
}
if (keys & KEY_B) {
NF_Swap3dSpritePriority((MAXSPRITES - 1), 0);
}
// Dibuja los 3D Sprites // Draw all 3D sprites
NF_Draw3dSprites(); NF_Draw3dSprites();
// Actualiza la escena 3D, si no lo haces, no se mostrara en pantalla // Tell the GPU to draw the scene and wait until it's done
glFlush(0); glFlush(0);
// Debug // Print debug information
consoleClear(); consoleClear();
printf("\nSprite Id%02d is on %02d priority\n", 0, NF_3DSPRITE[0].prio); printf("\nSprite Id%02d is on %02d priority\n", 0, NF_3DSPRITE[0].prio);
printf("Sprite Id%02d is on %02d priority\n\n", (MAXSPRITES - 1), NF_3DSPRITE[(MAXSPRITES - 1)].prio); printf("Sprite Id%02d is on %02d priority\n\n",
printf("A or B - Swap 0 & %d", (MAXSPRITES - 1)); MAXSPRITES - 1, NF_3DSPRITE[MAXSPRITES - 1].prio);
printf("A or B - Swap 0 & %d", MAXSPRITES - 1);
// Espera al sincronismo vertical // Wait for the screen refresh
swiWaitForVBlank(); swiWaitForVBlank();
}
}
return 0;
return 0;
} }