need help, trying to get started

Post Reply
kennypu
Posts: 1
Joined: Sat Feb 06, 2010 3:05 am

need help, trying to get started

Post by kennypu » Sat Feb 06, 2010 3:09 am

hello
I was trying to get started in making ds games and apps, and I have successfully installed the toolchains and compiled some example files, and now I am trying to start on a simple project.
To keep things simple, for some reason I cannot compile my code becaues I get an error saying:

Code: Select all

error: 'backgroundBitmap' was not declared in this scope
error: 'backgroundbitmapLen' was not declared in this scope
those constants were created in a separate header file for the sprites created by grit. For some reason it keeps tripping out on that, and I am not sure why. I would assume that those constants are global, so I would think scope shouldn't matter, but I am no pro. Any help? If you want the whole code, it is:

Code: Select all

/****************************************
* 	NDS Sprite Tutorial    	
* 	Author: opearn		
****************************************/
 
/*includes*/
 
//include
 
#include <nds.h> 
#include "background.h"
void initVideo()
{
	vramSetMainBanks(VRAM_A_MAIN_BG_0x06000000,
                     VRAM_B_MAIN_BG_0x06020000,
                     VRAM_C_SUB_BG_0x06200000,
                     VRAM_D_LCD);

    /*  Set the video mode on the main screen. */
    videoSetMode(MODE_5_2D | // Set the graphics mode to Mode 5
                 DISPLAY_BG2_ACTIVE | // Enable BG2 for display
                 DISPLAY_BG3_ACTIVE); //Enable BG3 for display

    /*  Set the video mode on the sub screen. */
    videoSetModeSub(MODE_5_2D | // Set the graphics mode to Mode 5
                    DISPLAY_BG3_ACTIVE); // Enable BG3 for display
}
void initBackgrounds() {
    /*  Set up affine background 3 on main as a 16-bit color background. */
    REG_BG3CNT = BG_BMP16_256x256 |
                 BG_BMP_BASE(0) | // The starting place in memory
                 BG_PRIORITY(3); // A low priority

    /*  Set the affine transformation matrix for the main screen background 3
     *  to be the identity matrix.
     */
    REG_BG3PA = 1 << 8;
    REG_BG3PB = 0;
    REG_BG3PC = 0;
    REG_BG3PD = 1 << 8;

    /*  Place main screen background 3 at the origin (upper left of the
     *  screen).
     */
    REG_BG3X = 0;
    REG_BG3Y = 0;
}

/* Select a low priority DMA channel to perform our background
 * copying. */
static const int DMA_CHANNEL = 3;

void displayBG() {
    dmaCopyHalfWords(DMA_CHANNEL,
                     backgroundBitmap, /* This variable is generated for us by
                                       * grit. */
                     (uint16 *)BG_BMP_RAM(0), /* Our address for main
                                               * background 3 */
                     backgroundBitmapLen); /* This length (in bytes) is generated
                                           * from grit. */
}

int main() {
powerOn(POWER_ALL_2D);

lcdMainOnBottom();
initVideo();
initBackgrounds();

/*display the backgrounds. */
displayBG();
return 0;
}
 
I am following Patater's tutorial. Thanks

User avatar
vuurrobin
Posts: 219
Joined: Fri Jul 11, 2008 8:49 pm
Location: The Netherlands
Contact:

Re: need help, trying to get started

Post by vuurrobin » Sat Feb 06, 2010 12:07 pm

it could be that grit is converting the image into a tilemap instead of a bitmap. check your grit file to see in what you're converting it, or else check the background.h file. it should be in the build folder.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest