#7283 - Vector - Fri Jun 13, 2003 7:04 pm
Hey all,
maybe i just missed something really stupid but i have a question. i have C code that compiles for devkitadv and runs when i use literals in the functions, but when i added a "bitmap" structure, and pass it by pointer to the functions, i don't get anything on screen.
here is the structure:
i used malloc() to get memory for the bmp, but the problem lies elsewhere because it even breaks when i just set the bmp ptr to video memory.
i modified putpixel() from
to:
now when I do:
the bitmap implementation was the only thing i changed. mode 4 is already set up, with the palette loaded (vba shows the palette loaded in memory, but still only a blank screen.
anyone know whats wrong?
maybe i just missed something really stupid but i have a question. i have C code that compiles for devkitadv and runs when i use literals in the functions, but when i added a "bitmap" structure, and pass it by pointer to the functions, i don't get anything on screen.
here is the structure:
Code: |
typedef struct { (u16*) bmp; int w; int h; } bitmap; |
i used malloc() to get memory for the bmp, but the problem lies elsewhere because it even breaks when i just set the bmp ptr to video memory.
i modified putpixel() from
Code: |
void putpixel(int x, y, u16 color) { videobuffer[y*120 + x] = color; } |
to:
Code: |
void putpixel(bitmap* bmp, int x, y, u16 color) { bmp->bmp[bmp->w*y + x] = color; } |
now when I do:
Code: |
bitmap* videobuffer; videobuffer->bmp = (16*)0x6000000; videobuffer->w = 120; // mode 4, so write 2 pixels at once :-( videobuffer->h = 160; putpixel(videobuffer, 10, 10, 0xf0f); |
the bitmap implementation was the only thing i changed. mode 4 is already set up, with the palette loaded (vba shows the palette loaded in memory, but still only a blank screen.
anyone know whats wrong?