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.
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();
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);
includeTiles(spriteSheet);
SpriteSheet *spriteSheet = new SpriteSheet(TileData(spriteSheet), Size_32x32, Colors256);
Sprite *manSprite = spriteSheet->getByIndex(3);
if(Buttons.A.Pressed()) {
// do something...
} else if(Buttons.Up.Held()) {
// do something else...
}
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);
// get random number
return Random.Next();
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
}
}