natu icon indicating copy to clipboard operation
natu copied to clipboard

Toolkit for writing Game Boy Advance games in Nim

NOTE! Nim and dkP's libtonc don't work together due to conflicing definitions of bool.

This is fixed in the devel branch of Natu, so it's recommended to use that for now.

Quickstart: After installing devkitARM and Nim:

git clone https://github.com/exelotl/natu
cd natu
git checkout devel              # switch to devel branch
git submodule update --init     # clone libtonc and maxmod submodules
nimble install                  # install the lib and asset converter to ~/.nimble
cd examples/hello_world         # go to an example
nim build                       # run the "build" nimscript task

Natu GBA Logo

Natu is a package for making Game Boy Advance games in Nim.

Primarily a wrapper for libtonc, we are now growing in our own direction: ditching some old conventions to be more Nim-friendly, and adding more libraries.

Features

  • Full GBA memory map + flag definitions
  • BIOS routines
  • Interrupt manager
  • A powerful text system (TTE)
  • Surfaces (draw to tiles like a canvas)
  • Efficient copy routines
  • Sin/Cos/Div LUTs + other math functions
  • Fixed-point numbers, 2D vector types
  • Random number generator
  • Hardware sprites, affine matrix helpers
  • Color/palette utilities
  • Button states (hit, down, released)
  • mGBA logging functions
  • Maxmod bindings for music/sfx
  • Posprintf wrapper for string formatting

Usage

You will need devkitARM with GBA tools and libraries. If you are using the graphical installer, simply check "tools for GBA development" during setup. Otherwise be sure to install the gba-dev group of packages. Either way, the libtonc package is included so you should be good to go!

Before diving into Nim, try building some of the Tonc 'advanced' demos to make sure your environment is good.

The examples in this repo each use a nimscript configuration which should make a good starting point for any project. From within an example you can run nim build in the terminal to produce a GBA rom.

Happy coding! And if you need any help you can reach me (exelotl) on the gbadev discord.

Thanks

tonc + libtonc by cearn
devkitARM toolchain maintained by wintermute
maxmod sound system by mukunda johnson
mGBA by endrift
posprintf by dan posluns
natu logo by hot_pengu, based on pixel art by iamrifki


Natu