Does this look good?
Code:
SDL_LockSurface(SDL_GetVideoSurface());
for ( int x = 0; x != SDL_GetVideoSurface()->w; ++x )
{
for ( int y = 0; y != SDL_GetVideoSurface()->h; ++y )
{
Uint32 pixel = getpixel(SDL_GetVideoSurface(),x,y);
Uint8 r = 0;
Uint8 g = 0;
Uint8 b = 0;
SDL_GetRGB(pixel, SDL_GetVideoSurface()->format, &r, &g, &b);
r = g = b = (( r+g+b )/3);
putpixel(SDL_GetVideoSurface(),x,y, SDL_MapRGB(SDL_GetVideoSurface()->format, r,g,b));
}
}
SDL_UnlockSurface(SDL_GetVideoSurface());
EDIT:
I wont always be doing the entire screen, but more asking about my method of doing it.