NightFox’s Lib
Data Structures | Macros | Functions | Variables
nf_tiledbg.h File Reference

Functions related to regular tiled backgrounds. More...

#include <nds.h>

Data Structures

struct  NF_TYPE_TBG_INFO
 Struct that holds information about regular tiled backgrounds. More...
 
struct  NF_TYPE_EXBGPAL_INFO
 Struct that holds information about extended palettes. More...
 
struct  NF_TYPE_TBGLAYERS_INFO
 Struct that holds information about backgrounds loaded to the screen. More...
 

Macros

#define NF_SLOTS_TBG   64
 Maximum number of slots of tiled backgrounds.
 
#define NF_SLOTS_EXBGPAL   128
 Maximum number of slots for extended palettes (max 16 per background)
 
#define NF_MAX_BANKS_TILES   8
 Maxmimum number of VRAM blocks used for tilesets.
 
#define NF_MAX_BANKS_MAPS   16
 Maxmimum number of VRAM blocks used for maps.
 

Functions

void NF_InitTiledBgBuffers (void)
 Initialize library to load files from the filesystem to create tiled BGs. More...
 
void NF_ResetTiledBgBuffers (void)
 Reset state used for tiled BGs loaded from FAT. More...
 
void NF_InitTiledBgSys (int screen)
 Initialize the tiled BG engine of the selected screen. More...
 
void NF_LoadTiledBg (const char *file, const char *name, u32 width, u32 height)
 Load all files needed to create a tiled BG from FAT to RAM. More...
 
void NF_LoadTilesForBg (const char *file, const char *name, u32 width, u32 height, u32 tile_start, u32 tile_end)
 Load a tilesed and palette from FAT to RAM. More...
 
void NF_UnloadTiledBg (const char *name)
 Delete from RAM the BG with the specified name. More...
 
void NF_CreateTiledBg (int screen, u32 layer, const char *name)
 Create a BG on the screen, using data loaded in RAM. More...
 
void NF_DeleteTiledBg (int screen, u32 layer)
 Delete the BG of the specified screen and layer. More...
 
u32 NF_GetTileMapAddress (int screen, u32 layer, u32 tile_x, u32 tile_y)
 Gets the address of the tile at the specified position. More...
 
u32 NF_GetTileOfMap (int screen, u32 layer, u32 tile_x, u32 tile_y)
 Gets the value of the tile at the specified position. More...
 
void NF_SetTileOfMap (int screen, u32 layer, u32 tile_x, u32 tile_y, u32 tile)
 Sets the value of the tile at the specified position. More...
 
void NF_UpdateVramMap (int screen, u32 layer)
 Updates the map of the specified screen and layer specified. More...
 
void NF_BgSetPalColor (int screen, u32 layer, u32 number, u32 r, u32 g, u32 b)
 Changes the value of one color of the palette of a background. More...
 
void NF_BgEditPalColor (int screen, u32 layer, u32 number, u32 r, u32 g, u32 b)
 Changes the value of one color of the palete of the specified background. More...
 
void NF_BgUpdatePalette (int screen, u32 layer)
 Updates the palette of a background from RAM to VRAM. More...
 
void NF_BgGetPalColor (int screen, u32 layer, u32 number, u8 *r, u8 *g, u8 *b)
 Gets the RGB value of a color of the palette of the selected background, which is loaded in RAM. More...
 
u32 NF_GetTilePal (int screen, u32 layer, u32 tile_x, u32 tile_y)
 Returns the number of extended palette used by specified tile. More...
 
void NF_SetTilePal (int screen, u32 layer, u32 tile_x, u32 tile_y, u32 pal)
 Sets the extended palette to use for the tile especified. More...
 
void NF_LoadExBgPal (const char *file, u32 slot)
 Load a palette from a file to RAM to use it as a background extended palette. More...
 
void NF_UnloadExBgPal (u32 slot)
 Deletes a loaded palette from RAM. More...
 
void NF_VramExBgPal (int screen, u32 layer, u32 id, u32 slot)
 Transfers a palette from RAM to VRAM to be used as extended palette. More...
 
void NF_SetExBgPal (int screen, u32 layer, u32 pal)
 Sets the extended palette to be used in the specified background. More...
 
void NF_SetTileHflip (int screen, u32 layer, u32 tile_x, u32 tile_y)
 Inverts the horizontal flip status of a tile in the specified map. More...
 
void NF_SetTileVflip (int screen, u32 layer, u32 tile_x, u32 tile_y)
 Inverts the vertical flip status of a tile in the specified map. More...
 
void NF_RotateTileGfx (u32 slot, u32 tile, u32 rotation)
 Rotates the graphics of a tile in RAM by the specified angle. More...
 

Variables

u8 NF_BANKS_TILES [2]
 Maxmimum number of tile banks. More...
 
u8 NF_BANKS_MAPS [2]
 Maxmimum number of map banks. More...
 
char * NF_BUFFER_BGTILES [NF_SLOTS_TBG]
 Buffers to hold background tiles.
 
char * NF_BUFFER_BGMAP [NF_SLOTS_TBG]
 Buffers to hold background maps.
 
char * NF_BUFFER_BGPAL [NF_SLOTS_TBG]
 Buffers to hold background palettes.
 
NF_TYPE_TBG_INFO NF_TILEDBG [NF_SLOTS_TBG]
 Information of all tiled backgrounds.
 
NF_TYPE_EXBGPAL_INFO NF_EXBGPAL [NF_SLOTS_EXBGPAL]
 Information of all extended palettes.
 
NF_TYPE_TBGLAYERS_INFO NF_TILEDBG_LAYERS [2][4]
 Information of all backgrounds loaded to the screen.
 
u8 NF_TILEBLOCKS [2][NF_MAX_BANKS_TILES]
 Array of free blocks used for tiles.
 
u8 NF_MAPBLOCKS [2][NF_MAX_BANKS_MAPS]
 Array of free blocks used for maps.
 

Detailed Description

Functions related to regular tiled backgrounds.