c++ game engine for Nintendo DS and Gameboy Advance homebrew
Go to file
2022-03-13 13:53:06 -04:00
.vscode keep using c++11 for now 2022-03-11 00:28:20 -05:00
example_code merge BackgroundData and SpriteData into TileDdata 2022-03-13 13:53:06 -04:00
NDSA merge BackgroundData and SpriteData into TileDdata 2022-03-13 13:53:06 -04:00
tools mapToS.py output grit-compatible; includeMap() 2022-03-13 13:38:58 -04:00
.gitignore no .sav files 2022-03-10 23:50:11 -05:00
changelog.md formatting; speed up bullets; add to changelog 2022-03-10 23:32:31 -05:00
license.md v1.5 2022-01-16 17:11:17 -05:00
Makefile don't use -Wno-reorder 2022-03-12 21:40:30 -05:00
ndsa_GBA.gba free newMap if allocated 2022-03-11 21:59:25 -05:00
ndsa_NDS.nds free newMap if allocated 2022-03-11 21:59:25 -05:00
readme.md merge BackgroundData and SpriteData into TileDdata 2022-03-13 13:53:06 -04:00

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
  }
}