gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

C/C++ > Displaying An Image(Converted to .c)

#124839 - Split - Mon Apr 09, 2007 2:00 am

It's neen a while since i've used C++ and i've kinda forgot basically everything i knew ><. I have an image and converted it to a .c file. I know how to put it in the program and include it i jsut dont know a bit of code that can allow me to display it...

#124843 - Ant6n - Mon Apr 09, 2007 3:13 am

something like this, maybe.
might have to adapt the macros (the capitalized stuff), the name of the pic. used this with 240x160 16 pic.

Code:

extern const unsigned short lemmingBitmap[38400];

int main(void)
{
    //set mode 3
    LCD_CONTROL = LCD_MODE(3) | LCD_BG2ON;
    //copy picture
    int n;
    for (n=0;n<240*160;n++)
        ((u16*)VRAM)[n] = lemmingBitmap[n];
   while(1)
   {
       
   }

   return 0;
}