Background problem
Posted: Sat Oct 16, 2010 9:44 am
I have been following the tutorials @ http://www.dev-scene.com and an having problems with the tutorial about the background.
The code I have is this
But I'm getting these errors:
The code I have is this
Code: Select all
#include <nds.h>
#include <stdio.h>
#include <nds/arm9/background.h>
#include "cirno_bin.h"
typedef struct
{
char signature[2];
unsigned int fileSize;
unsigned int reserved;
unsigned int offset;
}__attribute__ ((packed)) BmpHeader;
typedef struct
{
unsigned int headerSize;
unsigned int width;
unsigned int height;
unsigned short planeCount;
unsigned short bitDepth;
unsigned int compression;
unsigned int compressedImageSize;
unsigned int horizontalResolution;
unsigned int verticalResolution;
unsigned int numColors;
unsigned int importantColors;
}__attribute__ ((packed)) BmpImageInfo;
typedef struct
{
unsigned char blue;
unsigned char green;
unsigned char red;
unsigned char reserved;
}__attribute__ ((packed)) Rgb;
typedef struct
{
BmpHeader header;
BmpImageInfo info;
Rgb colors[256];
unsigned short image[1];
}__attribute__ ((packed)) BmpFile;
//---------------------------------------------------------------------------------
int main(void) {
//---------------------------------------------------------------------------------
int iy,ix,i;
BmpFile* bmp = (BmpFile*)cirno_bin;
consoleDemoInit();
//printf("%c%c\n", bmp->header.signature[0], bmp->header.signature[1]);
//printf("bit depth: %i\n", bmp->info.bitDepth);
//printf("width: %i\n", bmp->info.width);
//printf("height: %i\n", bmp->info.height);
//copy the palette
for(i = 0; i < 256; i++)
{
Background_palette[i] = RGB15(bmp->colors[i].red >> 3, bmp->colors[i].green >> 3, bmp->colors[i].blue >> 3);
}
//copy the image
for(iy = 0; iy < bmp->info.height; iy++)
{
for(ix = 0; ix < bmp->info.width / 2; ix++)
video_buffer[iy * 128 + ix] = bmp->image[(bmp->info.height - 1 - iy) * ((bmp->info.width + 3) & ~3) / 2 + ix];
}
while(1){
swiWaitForVBlank();
}
return 0;
}
Any ideas what I'm doing wrong?C:\devkitPro\examples\nds\Projects\background_test>make
main.cpp
arm-eabi-g++ -MMD -MP -MF /c/devkitPro/examples/nds/Projects/background_test/bui
ld/main.d -g -Wall -O2 -fomit-frame-pointer -ffast-math -mthumb -mthumb-interwor
k -march=armv5te -mtune=arm946e-s -iquote /c/devkitPro/examples/nds/Projects/bac
kground_test/include -I/c/devkitPro/libnds/include -I/c/devkitPro/examples/nds/P
rojects/background_test/build -DARM9 -fno-rtti -fno-exceptions -c /c/devkitPro/e
xamples/nds/Projects/background_test/source/main.cpp -o main.o
c:/devkitPro/examples/nds/Projects/background_test/source/main.cpp: In function
'int main()':
c:/devkitPro/examples/nds/Projects/background_test/source/main.cpp:65:3: error:
'Background_palette' was not declared in this scope
c:/devkitPro/examples/nds/Projects/background_test/source/main.cpp:68:29: warnin
g: comparison between signed and unsigned integer expressions
c:/devkitPro/examples/nds/Projects/background_test/source/main.cpp:70:38: warnin
g: comparison between signed and unsigned integer expressions
c:/devkitPro/examples/nds/Projects/background_test/source/main.cpp:71:4: error:
'video_buffer' was not declared in this scope
make[1]: *** [main.o] Error 1
make: *** [build] Error 2
C:\devkitPro\examples\nds\Projects\background_test>