No matter what I seem to try whenever I compile my prog I get ther following error:
Heres my best guess, main:Code:warning: passing argument 1 of ‘blit_and_fade’ from incompatible pointer type
and function:Code:#include "screen.h" #include "vector.h" SDL_Surface *screen = NULL; SDL_Event event; int main() { screen = SDL_SetVideoMode(GRAPHICS_W, GRAPHICS_H, 32, SDL_SWSURFACE); Uint32 buffer[SCREEN_BUFFER_SIZE]={0xFFFFFFFF}; while(1) { blit_and_fade(&buffer, &screen, SCREEN_BUFFER_SIZE, 0.95); SDL_Flip(screen); while(SDL_PollEvent(&event))if(event.type==SDL_KEYDOWN) break; } return 0; }
How cn I get my pointer types compatible?Code:void blit_and_fade(Uint32 **src, SDL_Surface **dst, Uint32 size, float mod) { Uint32 *pix = (Uint32*)(*dst)->pixels; Uint32 *buf = (*src); Uint32 r_b, g; int fade = (int) (mod * 256.0); for(int i=0; i<size; i++, pix++, buf++) { *pix = *buf; r_b = (((*buf & 0x00FF00FF) * fade) & 0xFF00FF00) >> 8; g = (((*buf & 0x0000FF00) * fade) & 0x00FF0000) >> 8; *buf = r_b | g; } }



LinkBack URL
About LinkBacks



