Examples

Learn by example to get quickly up to speed.

The examples assume that you have at least basic knowledge about:

  • Modern C++ (Butano is based on modern C++ concepts like shared ownership, RAII, standard containers...).
  • Old school 2D graphics (what are sprites, backgrounds, color palettes...).
  • Basics of retro game development (at least to know that floating point usage is a no-no and things like that).

Deep knowledge of GBA hardware is not required, as Butano wraps most of the functionality in its own classes.

As always, to understand how the little machine works, Tonc and GBATEK are your friends.

Butano brings multiple examples of most aspects of the engine in /path/to/butano/examples/. Each example project contains multiple mini examples showcasing how easy is to work with Butano.

The included example projects are the following:

Affine backgrounds

Image

Demonstrates usage of backgrounds with affine transformations.

Audio

Image

Shows how to play Direct Sound music and sound effects with Butano.

DMG audio

Image

Simple DMG music playback example.

Audio player

Image

Basic audio player example.

Blending

Image

Demonstrates usage of transparency, intensity and fade blending.

Cameras

Image

Shows how a camera affects the displayed elements.

Core

Image

Shows how to sleep and reset the GBA among other things.

Date and time

Image

Real time clock (RTC) showcase (if your cart has one).

Dynamic affine background

Image

Basic dynamic affine background example.

Dynamic regular background

Image

Basic dynamic regular background example.

External tool

Image

Shows how to call an external tool from the project's Makefile.

Green swap

Image

See how it looks this undocumented graphic effect.

HDMA palette

Image

In this example, the background palette is updated with HDMA.

Keypad

Image

Simple keypad status demo.

Link communication

Image

Multiplayer communication through a link cable.

Logging

Image

Integration of emulator logging into Butano.

Map collision

Image

Sprite against map collision example.

Mode 7

Image

Basic SNES mode 7 like background example.

Mosaic

Image

Sprites and backgrounds mosaic effects.

Color palettes

Image

Showcases multiple color palette effects.

Flat polygons

Image

Showcases flat polygons rendering with sprites.

Profiler

Image

Basic code blocks profiling.

Regular backgrounds

Image

Shows how to use regular backgrounds with Butano.

Random

Image

Simple random number generation example.

Rumble

Image

Vibration showcase (if your cart supports it).

Sprite affine matrices

Image

Demonstrates usage of one affine matrix for multiple sprites.

Sprites

Image

Simple sprites examples.

Game Pak SRAM

Image

SRAM reads and writes with Butano.

Text

Image

Showcase of Butano sprite text rendering.

Textured polygons

Image

Showcases textured polygons rendering with sprites.

Timers

Image

Simple timer example.

Windows

Image

Demonstrates usage of rectangle and sprite windows.

World map

Image

Showcase of a 4096x4096 world map with a perspective effect.