From Wikipedia, the free encyclopedia
Jump to: navigation, search
Developer(s) Cesar Rincon
Stable release
20130409 / April 9, 2013 (2013-04-09)
Operating system Cross-platform
Type API
License Creative Commons

NFlib or NightFox’s lib is a library written in the C programming language that was developed to facilitate programming for the Nintendo DS. It is based upon devkitARM and libnds. It contains functions that simplify the implementation of backgrounds, sprites, and collision detection, among other core components.

256 colors tiled backgrounds[edit]

It is possible to load up to 32 backgrounds to RAM from files using the FAT filesystem or the Nitro filesystem. The pixel size of backgrounds must be in multiples of 256. The library's background system also supports extended palettes and can have up to 16 palettes of 256 colors. The VRAM configuration allows the use of 96 kilobytes for tiles and 32 Kilobytes for maps. The library also supports infinite maps, using the “bank swap” technique, maintaining the entire map on RAM and copying only the necessary portions to VRAM. The only limitation is the size of the Tileset, which may not exceed 96 Kilobytes for all of the layers. NFLib also contains functions for manipulating backgrounds, including displaying/hiding backgrounds, unloading backgrounds from RAM, changing individual map tiles via code, changing palette colors, and extending palettes.

256 colors sprite (computer graphics)|sprites[edit]

Users can load up to 256 graphics and 64 palettes for sprites. The library supports the creation, deletion, hiding, rotation, resizing, and flipping of sprites. Users can place up to 128 sprites per screen. It also supports animated sprites with unlimited numbers of frames, with either all frames or just the current frame available to be stored in VRAM. In addition, the library supports the modification of a sprite palette to create effects.

Text engine[edit]

Based on the tiled backgrounds system, the library supports fonts sized at 8×8 and 8×16 pixels. The fonts functionality supports up to 256 colors for colored fonts, the ability to define custom colors, and multiple text orientation, including normal, rotated clockwise, rotated counterclockwise, and scrolling, among others. A font must be loaded for each text layer, with up to 4 per screen.


The library offers basic support for loading RAW files from the FAT filesystem or the Nitro filesystem. The Libnds engine may be used for playback. Users can load up to 32 sounds in RAM.

Collision maps[edit]

Many games require the use of Collision Maps. NFlib supports Collision Maps, which are editable from code. The library supports work with up to 32 maps at a time, storing them in RAM.

8-bit color and 16-bit color backgrounds[edit]

Users can use 8-bit color or 16-bit color backgrounds and images if additional color depth is needed on the screen. The library includes functions for loading and drawing these backgrounds on the screen. Users can load up to 16 RAW images of 8-bit color or 16-bit color. This system also has support writing to the Backbuffer.


The library provides functions for loading and displays bitmap files. Users can load 8, 16 or 24 bits bitmap files and display them on the screen (16-bit mode). The library also handles the loading of BMP files and conversion into 16-bit color depth.

3D computer graphics|3D sprite (computer graphics)/sprites[edit]

Unique features using the 3D engine of the Nintendo DS, which can create up to 256 sprites on a screen simultaneously with a maximum size of 1024×1024, with the possibility of rotation, scaling and up to 62 units of different transparency.

WIFI Support[edit]

Very basic support for communication using wireless. Only includes a test functions for communication using the UDP protcol.


The library includes more than 30 examples ready for compilation. These examples showcase almost all of the library's functionality.


Complete documentation in PDF in included and features in-depth descriptions of all of the functions.


External links[edit]