Skip to content
/ ndsa Public

c++ game engine for Nintendo DS and Gameboy Advance homebrew

License

Notifications You must be signed in to change notification settings

nicklausw/ndsa

Repository files navigation

NDSA - Nintendo DS Advanced Engine

Write for NDS and GBA in one codebase!

A project from 2016 that I'd like to bring back. It's a header library which wraps libnds/libgba functions, adds an object system, so on. NOTE: Requires gritn. Other than that, if you have devkitPro installed, you should be able to clone the repo, run GNU make and have fun.

Objects

Declare an object like so:

struct Player : Object {
  using ParentConstructors;
  void Step() override {
    // code run once per frame
  }
};

Run it like so:

// this object uses the sprite manSprite at (150, 50)
Player *player = new Player(manSprite, 150, 50, TopScreen);

Don't need a sprite? Don't give the object one.

Player *player = new Player();

Sprites

For now, use 8-bit paletted images. See example_code/images directory for examples of proper .grit files to go with them.

includeTiles(man);
Sprite *manSprite = new Sprite(TileData(man), Size_32x32, Colors256);

Spritesheets

includeTiles(spriteSheet);
SpriteSheet *spriteSheet = new SpriteSheet(TileData(spriteSheet), Size_32x32, Colors256);
Sprite *manSprite = spriteSheet->getByIndex(3);

Input

if(Buttons.A.Pressed()) {
  // do something...
} else if(Buttons.Up.Held()) {
  // do something else...
}

Backgrounds

Same deal as sprites; use 8-bit paletted images.

includeTiles(bg);
includeMap(bg); // this can be from bg.png or bg.tmx (tilemap)
Background.Set(TileData(bg), MapData(bg), TopScreen);

Random Numbers

// get random number
return Random.Next();

The Main Function

Use this in favor of your own int main:

#include <NDSA/Main.hh>
void NDSA::Game() {
  while(System.Frame()) {
    // this code runs once every frame
  }
}

About

c++ game engine for Nintendo DS and Gameboy Advance homebrew

Resources

License

Stars

Watchers

Forks

Packages

No packages published