Background image wierd
Posted: Wed Jun 22, 2011 1:17 pm
Hi,
At first, thanks for reading. I'm a beginner of programming voor de NDS and I try to put a image on the background of the main screen. On the internet I've found some example code but it only works with image at size of 256x192. I currently have the code as it needs to be, but I can't find out how to get a larger image as background.
If you wonder why I want a larger image as background, it's because I want to scroll the image from left to right. To draw the image on the screen I use:
The rest of the code can be found here: http://www.feonx.com/imageslide.rar
Can someone help me?
P.S: Sorry for my bad english.
Kind requards,
Feonx
At first, thanks for reading. I'm a beginner of programming voor de NDS and I try to put a image on the background of the main screen. On the internet I've found some example code but it only works with image at size of 256x192. I currently have the code as it needs to be, but I can't find out how to get a larger image as background.
If you wonder why I want a larger image as background, it's because I want to scroll the image from left to right. To draw the image on the screen I use:
Code: Select all
draw_bitmap(main_background, IMAGE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
void draw_bitmap(Color* background, Color* bitmap, s16 x, s16 y, s16 width, s16 height)
{
s16 y_pos, x_pos;
for(y_pos = 0; y_pos < height; y_pos++)
{
for(x_pos = 0; x_pos < width; x_pos++)
{
draw_pixel(background, x + x_pos, y + y_pos, bitmap[(y_pos * width) + x_pos]);
}
}
}
inline void draw_pixel(Color* background, s16 x, s16 y, Color color)
{
if(x >= 0 && x < SCREEN_WIDTH && y >= 0 && y < SCREEN_HEIGHT)
{
background[(y * 256) + x] = color;
}
}
Can someone help me?
P.S: Sorry for my bad english.
Kind requards,
Feonx