From GameBrew - a wiki dedicated to Video Game Homebrew.

TypeGame engine

µLibrary is a new library for Nintendo DS. Basically, it is meant to use the 3D GPU to create nice 2D games very easily, using a different approach than existing libraries (similar to OSLib). A few examples are supplied, as well as a Doxygen documentation and a small .chm documentation with a FAQ. There are also 2 templates for VHAM, Programmers Notepad or just make, one with PALib and one without it.

The 3D GPU provides additional effects over the 2D GPU, like full transparency with alpha channel (objects can blend amongst them), a larger number of sprites (up to 1536 instead of 128), no zoom or rotation limit (2x with the 2D GPU), a larger limit for the sprite size (2048x2048 instead of 64x64). It is also possible to draw primitives like lines, rectangles, etc. allowing nice effects like in Yoshi's island for example.

µLibrary also provides a low level layer and is open to the hardware. You can also mix 2D and 3D in a single project.

It was participated in the NEO Spring Compo 2007 (winner).


  • Supported image formats: PNG, GIF, JPG.
  • Special image effects: stretching, tinting (4 corners), mirroring, rotation (with a defined center), selection of an image frame to display (just like on spritesheets).
  • 18-bit render quality instead of 15-bit: provides 8 times more colors.
  • Virtual file system: possible to load files independantly from the actual support (RAM, libFat, GBFS are supported by default, but you can define your own). Allows to create more easily software that are compatible with all existing linkers.
  • Untextured geometry (rectangles, gradients, lines, etc).
  • Basic message box system.
  • VideoGL wrapper for texture and palette loading in VRAM: Able to load and unload things dynamically and more flexible (you can choose which banks you want to use for what, etc).
  • Keypad and touchscreen handler namely with support of stylus speed and double click and support of autorepeated keys (menus for example).
  • Includes 2 splash screens.
  • Low level wrapper to draw primitives.
  • Text system using the same font format as OSLib.


Enter into the Install folder of your distribution.

There is a batch file, named Install.bat, that will copy files. First edit it and verify that the paths are corrects (ROOTPATH=C:\devkitpro\libnds by default, change it to the path where libnds is located).

Once finished, execute it. After a confirmation, it will copy all files to their respective locations so that you can use it.

User guide

Library comes with two templates, located in the Templates folder of its install:

  • uLib_without_PALib - This project will begin with µLibrary only.
  • uLib_with_PALib - As its name suggests, this project contains everything to get started on a new project using simultaneously µLibrary and PALib.

The render method is similar to a sheet of paper. You first draw a background, then put some mountains, then some trees, some characters and so on: you draw your objects in the order they should appear on the screen (the first is behind, the last one is over the others).

Some examples are provided by the developer:

The doxygen documentation is available here.




Version 1.12 2009/03/17

  • This release is only to keep working with the newest devkitpro & libnds releases.
  • A lot of things have changed and some important things must have been rewritten.
  • This was the occasion of creating better makefiles, update samples, changing the logo and do other minor changes.

Version 1.11 2008/08/23

  • devKitPro has not really changed (thankfully), so no mandatory updates were needed.
  • Fixes a few bugs, namely the palette issues reported by some people.

Version 1.10 2007/12/26

  • As usual, works with and requires the latest libnds version; that's a shame because nothing will run on emulators from now. You can however solve this problem by replacing your copy of basic.arm7 in your libnds folder by mine (you can find it in the tools folder).
  • Added ulMoveScreenView, ulRotateScreenView, ulScaleScreenView and ulResetScreenView to apply special transformations to your screen. You can for example rotate the screen as a whole or only a list of objects without any effort. This will namely allow you to scale and rotate objects like maps and text, which isn't available by default.
  • Fonts now work better. Now the font2oft tool is in the 'tools' folder.
  • Added ulGetColorRed, ulGetColorGreen, ulGetColorBlue to retrieve the component values of a color.
  • Added ulLoadFontFile to directly load a font from a file.
  • PNG files with alpha can now be loaded directly as UL_PF_PAL5_A3 and UL_PF_PAL3_A5. The alpha will be taken in account and set in the resulting image. Note that you will have to enable blending as usual with ulSetAlpha and by setting another polygroup, because if all objects are with the same polygroup, none will blend with any other.
  • Loading unpaletted PNG files to paletted formats reworked. If there isn't enough colors for the whole image, the nearest is taken. However you should avoid this situation because it's an extremely simple but weak method for reducing the colors of an image.

Version 1.00 bêta 4 2007/07/14

  • Works with, and requires the last libnds version.
  • Added ulDeleteMap function.
  • Using bank B for textures wasn't working correctly; all my excuses.
  • Some JPG files with a vertical size not multiple of 8 or 16 were loaded incorrectly.

External links