mirror of
https://github.com/knightfox75/nds_nflib.git
synced 2025-06-18 16:55:32 -04:00
Start using doxygen comments in library headers
This commit is contained in:
parent
32834534b1
commit
e1ed5b15ef
284
include/nf_2d.h
284
include/nf_2d.h
@ -15,117 +15,233 @@ extern "C" {
|
||||
|
||||
#include <nds.h>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Funcion NF_Set2D();
|
||||
/// Init 2D mode for the selected screen.
|
||||
///
|
||||
/// Modes:
|
||||
/// 0 - Tiled BGs (256 colors).
|
||||
/// 2 - Affine BGs of 8 bits in layers 2 & 3
|
||||
/// 5 - Bitmap BGs at 8 or 16 bits.
|
||||
///
|
||||
/// Example:
|
||||
/// <pre>
|
||||
/// // Init 2D mode for tiled BGs and sprites on screen 1 (bottom)
|
||||
/// NF_Set2D(1, 0);
|
||||
/// </pre>
|
||||
///
|
||||
/// @param screen Screen (0 - 1).
|
||||
/// @param mode Mode (0, 2, 5).
|
||||
void NF_Set2D(u8 screen, u8 mode);
|
||||
// Inicia el modo 2D seleccionado en la pantalla deseada
|
||||
|
||||
|
||||
|
||||
// Funcion NF_ShowBg();
|
||||
/// Makes the BG of the selected layer and screen visible.
|
||||
///
|
||||
/// Use this command to make visible a BG previously hidden with NF_HideBg().
|
||||
///
|
||||
/// Example:
|
||||
/// <pre>
|
||||
/// // Makes the BG of layer 2 in screen 0 (top) visible
|
||||
/// NF_ShowBg(0, 2);
|
||||
/// </pre>
|
||||
///
|
||||
/// @param screen Screen (0 - 1).
|
||||
/// @param layer Layer (0 - 3).
|
||||
void NF_ShowBg(u8 screen, u8 layer);
|
||||
// Haz visible el fondo de la capa y pantalla dados
|
||||
|
||||
|
||||
|
||||
// Funcion NF_HideBg();
|
||||
/// Makes the BG of the selected layer and screen invisible.
|
||||
///
|
||||
/// Example:
|
||||
/// <pre>
|
||||
/// // Makes the BG of layer 2 in screen 0 (top) invisible
|
||||
/// NF_HideBg(0, 2);
|
||||
/// </pre>
|
||||
///
|
||||
/// @param screen Screen (0 - 1).
|
||||
/// @param layer Layer (0 - 3).
|
||||
void NF_HideBg(u8 screen, u8 layer);
|
||||
// Oculta el fondo de la capa y pantalla dados
|
||||
|
||||
|
||||
|
||||
// Funcion NF_ScrollBg();
|
||||
/// Moves the BG of the selected layer and screen to the specified coordinates.
|
||||
///
|
||||
/// If the map is taller or wider than 512, it must be kept in RAM all the time.
|
||||
///
|
||||
/// Example:
|
||||
/// <pre>
|
||||
/// // Move the BG of layer 1 and screen 0 to the coordinates (128, 96)
|
||||
/// NF_ScrollBg(0, 1, 128, 96);
|
||||
/// </pre>
|
||||
///
|
||||
/// @param screen Screen (0 - 1).
|
||||
/// @param layer Layer (0 - 3).
|
||||
/// @param x X coordinate.
|
||||
/// @param y Y coordinate.
|
||||
void NF_ScrollBg(u8 screen, u8 layer, s16 x, s16 y);
|
||||
// Mueve el fondo a las coordenadas especificadas.
|
||||
// Debes de indicar la pantalla, capa, y coordenadas X e Y
|
||||
// Si el mapa es mayor de 512 en alguna medida, debes de mantener el fondo en RAM
|
||||
|
||||
|
||||
|
||||
// Funcion NF_MoveSprite();
|
||||
/// Moves the selected sprite of a screen to the specified coordinates.
|
||||
///
|
||||
/// Example:
|
||||
/// <pre>
|
||||
/// // Moves sprite 35 of screen 0 to the coordinates (100, 50).
|
||||
/// NF_MoveSprite(0, 35, 100, 50);
|
||||
/// </pre>
|
||||
///
|
||||
/// @param screen Screen (0 - 1).
|
||||
/// @param id Sprite ID (0 - 127).
|
||||
/// @param x X coordinate.
|
||||
/// @param y Y coordinate.
|
||||
void NF_MoveSprite(u8 screen, u8 id, s16 x, s16 y);
|
||||
// Mueve el Sprite a las coordenadas especificadas
|
||||
// Debes de indicar la pantalla, id de sprite y coordenadas
|
||||
|
||||
|
||||
|
||||
// Funcion NF_SpriteLayer();
|
||||
/// Selects the layer where a sprite will be drawn.
|
||||
///
|
||||
/// Layer 0 is on top of the others, layer 3 is at the bottom.
|
||||
///
|
||||
/// Example:
|
||||
/// <pre>
|
||||
/// // Sprite 35 of screen 1 will be drawn over layer 2.
|
||||
/// NF_SpriteLayer(1, 35, 2);
|
||||
/// </pre>
|
||||
///
|
||||
/// @param screen Screen (0 - 1).
|
||||
/// @param id Sprite ID (0 - 127).
|
||||
/// @param layer Layer (0 - 3).
|
||||
void NF_SpriteLayer(u8 screen, u8 id, u8 layer);
|
||||
// Define la capa sobre la que el sprite sera dibujado
|
||||
// Debes de indicar la pantalla, id del sprite y capa
|
||||
|
||||
|
||||
|
||||
// Funcion NF_ShowSprite();
|
||||
/// Shows or hides a sprite.
|
||||
///
|
||||
/// If you hide a sprite, it becomes invisible, without deleting it.
|
||||
///
|
||||
/// Example:
|
||||
/// <pre>
|
||||
/// // Hides the sprite nº35 on screen 0.
|
||||
/// NF_ShowSprite(0, 35, false);
|
||||
/// // Makes visible the Sprite nº45 on screen 1.
|
||||
/// NF_ShowSprite(1, 45, true);
|
||||
/// </pre>
|
||||
///
|
||||
/// @param screen Screen (0 - 1).
|
||||
/// @param id Sprite ID (0 - 127).
|
||||
/// @param show Set to true to show the sprite, false otherwise.
|
||||
void NF_ShowSprite(u8 screen, u8 id, bool show);
|
||||
// Muestra o oculta el sprite
|
||||
// Debes especificar la pantalla, id del sprite y el estado (true, false)
|
||||
|
||||
|
||||
|
||||
// Funcion NF_HflipSprite();
|
||||
/// Sets the horizontal flip state of a sprite.
|
||||
///
|
||||
/// Example:
|
||||
/// <pre>
|
||||
/// // Flips sprite 35 of screen 0 horizontally
|
||||
/// NF_HflipSprite(0, 35, true);
|
||||
/// </pre>
|
||||
///
|
||||
/// @param screen Screen (0 - 1).
|
||||
/// @param id Sprite ID (0 - 127).
|
||||
/// @param hflip Set to true to flip the sprite, false otherwise.
|
||||
void NF_HflipSprite(u8 screen, u8 id, bool hflip);
|
||||
// Voltea el Sprite horizontalmente
|
||||
// Debes especificar la pantalla, id del sprite y el estado (true, false)
|
||||
|
||||
/// Gets the horizontal flip state of a sprite.
|
||||
///
|
||||
/// Example:
|
||||
/// <pre>
|
||||
/// // Stores true in "state" if sprite 35 of screen 0 is flipped
|
||||
/// bool hflip = NF_GetSpriteHflip(0, 35);
|
||||
/// </pre>
|
||||
///
|
||||
/// @param screen Screen (0 - 1).
|
||||
/// @param id Sprite ID (0 - 127).
|
||||
/// @return hflip Returns true if the sprite is flipped, false otherwise.
|
||||
bool NF_GetSpriteHflip(u8 screen, u8 id);
|
||||
|
||||
|
||||
// Funcion NF_GetSpriteHflip();
|
||||
extern bool NF_GetSpriteHflip(u8 screen, u8 id);
|
||||
// Devuelve el estado del volteado horizontal de un sprite
|
||||
// Debes especificar la pantalla y la id del sprite
|
||||
|
||||
|
||||
|
||||
// Funcion NF_VflipSprite();
|
||||
/// Sets the vertical flip state of a sprite.
|
||||
///
|
||||
/// Example:
|
||||
/// <pre>
|
||||
/// // Flips sprite 35 of screen 0 vertically
|
||||
/// NF_VflipSprite(0, 35, true);
|
||||
/// </pre>
|
||||
///
|
||||
/// @param screen Screen (0 - 1).
|
||||
/// @param id Sprite ID (0 - 127).
|
||||
/// @param vflip Set to true to flip the sprite, false otherwise.
|
||||
void NF_VflipSprite(u8 screen, u8 id, bool vflip);
|
||||
// Voltea el Sprite verticalmente
|
||||
// Debes especificar la pantalla, id del sprite y el estado (true, false)
|
||||
|
||||
/// Gets the vertical flip state of a sprite.
|
||||
///
|
||||
/// Example:
|
||||
/// <pre>
|
||||
/// // Stores true in "state" if sprite 35 of screen 0 is flipped
|
||||
/// bool hflip = NF_GetSpriteVflip(0, 35);
|
||||
/// </pre>
|
||||
///
|
||||
/// @param screen Screen (0 - 1).
|
||||
/// @param id Sprite ID (0 - 127).
|
||||
/// @return vflip Returns true if the sprite is flipped, false otherwise.
|
||||
bool NF_GetSpriteVflip(u8 screen, u8 id);
|
||||
|
||||
|
||||
// Funcion NF_GetSpriteVflip();
|
||||
extern bool NF_GetSpriteVflip(u8 screen, u8 id);
|
||||
// Devuelve el estado del volteado vertical de un sprite
|
||||
// Debes especificar la pantalla y la id del sprite
|
||||
|
||||
|
||||
|
||||
// Funcion NF_SpriteFrame();
|
||||
/// Selects which frame of the animation of a sprite is shown.
|
||||
///
|
||||
/// Example:
|
||||
/// <pre>
|
||||
/// // Sprite 20 of screen 0 shows frame 5.
|
||||
/// NF_SpriteFrame(0, 20, 5);
|
||||
/// </pre>
|
||||
///
|
||||
/// @param screen Screen (0 - 1).
|
||||
/// @param id Sprite ID (0 - 127).
|
||||
/// @param frame The frame to show.
|
||||
void NF_SpriteFrame(u8 screen, u8 id, u16 frame);
|
||||
// Cambia el frame de un Sprite
|
||||
// Debes especificar la pantalla, el Id del sprite y el frame
|
||||
|
||||
|
||||
|
||||
// Funcion NF_EnableSpriteRotScale();
|
||||
/// Makes a sprite available to be rotated and scaled.
|
||||
///
|
||||
/// You must specify which rotset of the 32 availables will be used by the
|
||||
/// sprite. Multiple sprites can share the same rotset. If "doublesize" is
|
||||
/// disabled, the max size for sprites is 32x32. Otherwise the sprite will be
|
||||
/// clipped.
|
||||
///
|
||||
/// If you enable RotScale for a sprite the flip states will be ignored.
|
||||
///
|
||||
/// Example:
|
||||
/// <pre>
|
||||
/// // Enables the rotation and scalation for sprite 111 in screen 1, using the
|
||||
/// // RotSet 12, with “doublesize” disabled.
|
||||
/// NF_EnableSpriteRotScale(1, 111, 12, false);
|
||||
/// </pre>
|
||||
///
|
||||
/// @param screen Screen (0 - 1).
|
||||
/// @param sprite Sprite ID (0 - 127).
|
||||
/// @param id RotSet ID (0 - 31).
|
||||
/// @param doublesize Set to true to enable double size mode.
|
||||
void NF_EnableSpriteRotScale(u8 screen, u8 sprite, u8 id, bool doublesize);
|
||||
// Habilita el sprite como rotable y escalable
|
||||
// Debes especificar la pantalla, nº de sprite, id de rotacion y si
|
||||
// tiene que activarse el doublesize (tamaño x2)
|
||||
|
||||
|
||||
|
||||
// Funcion NF_DisableSpriteRotScale();
|
||||
/// Disables the rotation and scalation of sprite.
|
||||
///
|
||||
/// Example:
|
||||
/// <pre>
|
||||
/// // Disable rotation and scalation of sprite 46 of screen 0.
|
||||
/// NF_DisableSpriteRotScale(0, 46);
|
||||
/// </pre>
|
||||
///
|
||||
/// @param screen Screen (0 - 1).
|
||||
/// @param sprite Sprite ID (0 - 127).
|
||||
void NF_DisableSpriteRotScale(u8 screen, u8 sprite);
|
||||
// Deshabilita un sprite como rotable y escalable
|
||||
// Debes especificar la pantalla y el nº de sprite
|
||||
|
||||
|
||||
|
||||
|
||||
// Funcion NF_SpriteRotScale();
|
||||
/// Setup the rotation and scalation values of a RotSet.
|
||||
///
|
||||
/// All sprites assigned to this RotSet will rotate and scale using those
|
||||
/// values. Rotation angles are in 512 base. This means the rotation will go
|
||||
/// from -512 to 512 (-360 to 360 degrees). Scale values go from 0 to 512. A
|
||||
/// 100% scale is 256.
|
||||
///
|
||||
/// Example:
|
||||
/// <pre>
|
||||
/// // Rotate all sprites with RotSet 16 by 90 degrees to the right, with 100%
|
||||
/// // scale in both directions, on screen 0.
|
||||
/// NF_SpriteRotScale(0, 16, 128, 256, 256);
|
||||
/// // Rotate all sprites with RotSet 10 by 180 degrees to the left, scaling the
|
||||
/// // X size by 200% and the Y size by 100%, on screen 1.
|
||||
/// NF_SpriteRotScale(1, 10, -256, 512, 256);
|
||||
/// </pre>
|
||||
///
|
||||
/// @param screen Screen (0 - 1).
|
||||
/// @param sprite Sprite ID (0 - 127).
|
||||
/// @param angle Angle (-512 to 512).
|
||||
/// @param sx X scale (0 to 512), 100% = 256.
|
||||
/// @param sy Y scale (0 to 512), 100% = 256.
|
||||
void NF_SpriteRotScale(u8 screen, u8 id, s16 angle, u16 sx, u16 sy);
|
||||
// Define el angulo de rotacion y escala de los Sprites asociados a la Id.
|
||||
// El rango del angulo es desde -512 a 512, siendo 0 el valor central
|
||||
// El rango de escalado va de 0 a 512, siendo 256 el valor normal (100%)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -15,67 +15,86 @@ extern "C" {
|
||||
|
||||
#include <nds.h>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Define la variable global NF_ROOTFOLDER
|
||||
/// Root folder used by NFLib
|
||||
extern char NF_ROOTFOLDER[32];
|
||||
|
||||
|
||||
|
||||
// Funcion NF_Error();
|
||||
/// Stops program execution and shows the error on the screen.
|
||||
///
|
||||
/// This command is used internally by the lib to generate debug messages and
|
||||
/// it will rarely be used in you code.
|
||||
///
|
||||
/// 101: File not found.
|
||||
/// 102: Not enough memory.
|
||||
/// 103: Not enough free slots.
|
||||
/// 104: Background not found.
|
||||
/// 105: Background not created.
|
||||
/// 106: Value outside of bounds.
|
||||
/// 107: Not enough contiguous blocks in VRAM (tiles).
|
||||
/// 108: Not enough contiguous blocks in VRAM (maps).
|
||||
/// 109: ID already used.
|
||||
/// 110: ID not loaded in RAM.
|
||||
/// 111: ID not loaded in VRAM.
|
||||
/// 112: Sprite not created.
|
||||
/// 113: Not enough VRAM.
|
||||
/// 114: Text layer doesn't exist.
|
||||
/// 115: Background dimensions are invalid (not multiple of 256).
|
||||
/// 116: File too big.
|
||||
/// 117: Affine background dimensions are invalid.
|
||||
/// 118: Affine creation layer is invalid.
|
||||
///
|
||||
/// @param code Error code.
|
||||
/// @param text Description.
|
||||
/// @param value Additional info.
|
||||
void NF_Error(u16 code, const char* text, u32 value);
|
||||
// Errores para debug. Detiene el sistema e informa del error
|
||||
// 101: Fichero no encontrado
|
||||
// 102: Memoria insuficiente
|
||||
// 103: No quedan Slots libres
|
||||
// 104: Fondo no encontrado
|
||||
// 105: Fondo no creado
|
||||
// 106: Fuera de rango
|
||||
// 107: Insuficientes bloques contiguos en VRAM (Tiles)
|
||||
// 108: Insuficientes bloques contiguos en VRAM (Maps)
|
||||
// 109: Id ocupada (ya esta en uso)
|
||||
// 110: Id no cargada (en RAM)
|
||||
// 111: Id no en VRAM
|
||||
// 112: Sprite no creado
|
||||
// 113: Memoria VRAM insuficiente
|
||||
// 114: La capa de Texto no existe
|
||||
// 115: Medidas del fondo no compatibles (no son multiplos de 256)
|
||||
// 116: Archivo demasiado grande
|
||||
// 117: Medidas del fondo affine incorrectas
|
||||
// 118: Capa de creacion del fondo affine incorrecta
|
||||
|
||||
|
||||
|
||||
// Funcion NF_SetRootFolder();
|
||||
/// Defines the root folder of your project (FAT or NitroFS).
|
||||
///
|
||||
/// This makes it easy to change the name of folder that contains all files of
|
||||
/// your project after it’s compiled. It’s imperative the use of this function
|
||||
/// before loading any file from FAT.
|
||||
///
|
||||
/// If you want to use NitroFS, use "NITROFS" as root folder name. You must
|
||||
/// configure your Makefile correctly to include the NitroFS files in your ROM.
|
||||
/// When using a flashcard, it must support argv. Use Homebrew Menu to launch
|
||||
/// the ROM if your flashcard doesn't support it.
|
||||
///
|
||||
/// Example:
|
||||
/// <pre>
|
||||
/// // Define "mygame" folder as root for your project using FAT
|
||||
/// NF_SetRootFolder("mygame");
|
||||
/// </pre>
|
||||
///
|
||||
/// @param folder
|
||||
void NF_SetRootFolder(const char* folder);
|
||||
// Define el nombre de la carpeta que se usara como "root" si se usa la FAT
|
||||
|
||||
|
||||
|
||||
// Funcion NF_DmaMemCopy();
|
||||
/// Function copy blocks of memory from RAM to VRAM fast.
|
||||
///
|
||||
/// DMA copies from RAM to VRAM are the most efficient. The function checks if
|
||||
/// the data is aligned for the DMA copy. If not, it uses memcpy() insead.
|
||||
///
|
||||
/// Example:
|
||||
/// <pre>
|
||||
/// // Copy to address 0x06000000 (VRAM_A) 128 KB of memory from "buffer"
|
||||
/// NF_DmaMemCopy((void*)0x06000000, buffer, 131072);
|
||||
/// </pre>
|
||||
///
|
||||
/// @param destination Destination pointer.
|
||||
/// @param source Source pointer.
|
||||
/// @param size Number of bytes to copy.
|
||||
void NF_DmaMemCopy(void* destination, const void* source, u32 size);
|
||||
// Copia un bloque de memoria usando DMA (canal 3, halfwords) y vaciando previamente
|
||||
// el cache. Con pruebas de bloques grandes (64kb o 128kb) he observado que memcpy();
|
||||
// sigue siendo mas rapida.
|
||||
|
||||
|
||||
|
||||
// Funcion NF_GetLanguage();
|
||||
/// Returns the language ID set by the user in the firmware.
|
||||
///
|
||||
/// 0 : Japanese
|
||||
/// 1 : English
|
||||
/// 2 : French
|
||||
/// 3 : German
|
||||
/// 4 : Italian
|
||||
/// 5 : Spanish
|
||||
/// 6 : Chinese
|
||||
///
|
||||
/// @return The language ID.
|
||||
extern u8 NF_GetLanguage(void);
|
||||
// Devuelve el ID del idioma del usuario
|
||||
// 0 : Japanese
|
||||
// 1 : English
|
||||
// 2 : French
|
||||
// 3 : German
|
||||
// 4 : Italian
|
||||
// 5 : Spanish
|
||||
// 6 : Chinese
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user