Nintendo DS. Error Showing a simple sprite using NightFoxLib

281 views Asked by At

I'm getting into simple NDS Development. I'm trying to build a simple game. I built like a button (that is handled like a sprite) and tried to show it on the screen. This is the result: here is what no$gba shows. I followed this tutorial: https://gbatemp.net/threads/ds-programming-for-newbies.322106/page-8#post-4445495 and also this stackoverflow: How can I display sprites on screen on the Nintendo DS using nflib?. I post the code down here:

#include <cstdio> // useless for this question
#include <cstdlib> // useless for this question
#include <ctime> // useless for this question
#include <fstream> // useless for this question
#include <nds.h> 
#include <nf_lib.h>
#include "commands.h" // useless for this question
#define DECKSOFCARDS 8 // useless for this question

using namespace std;

int main() {
    // Turn on MODE 0 on the Top Screen
    NF_Set2D(0, 0);

    // Set the Root Folder
    NF_SetRootFolder("NITROFS");

    // Initialize the Tiled Backgrounds System on the Top Screen
    NF_InitTiledBgBuffers();
    NF_InitTiledBgSys(0);

    // Initialize the Tiled Sprites System on the Bottom Screen
    NF_InitSpriteBuffers();
    NF_InitSpriteSys(0);


    // Load our Tiled Sprite
    NF_LoadSpriteGfx("buttonplay", 0, 128, 80);// Tempy!
    NF_LoadSpritePal("palette", 0);

    // Transfer our sprite to VRAM
    NF_VramSpriteGfx(0, 0, 0, false);
    NF_VramSpritePal(0, 0, 0);

    // Create the Sprite!
    NF_CreateSprite(0, 0, 0, 0, 10, 20);

    while (1) {
        //Update NF OAM Settings
        NF_SpriteOamSet(0);
        swiWaitForVBlank();
        //Update OAM!
        oamUpdate(&oamMain);
    }
    return 0;
}

I try to post the sprite too (i converted with grit by running the convert_sprites bat file. Here is the Sprite in bmp format i created very fastly with photoshop (128x80) (It's like the emulator only shows the "white" part of the rounded button). Palette file: https://file.io/rcaKNpF4ODCt IMG file that grit produced: https://file.io/pNuZH9b8Avvl

Thanks for your help! Have a nice day!

1

There are 1 answers

0
Thomas BERNARD On

It's maybe because your image is not in the right size. You need to make an image with height and width which can be divided by 256