[SDL] truble to get the color of a surface pixel
f
ferranf at gmail.com
Mon Jul 3 12:06:34 PDT 2006
i need to get the color of a pixel of specific position of a surface,
i'm trying something like this:
int frogoutofbounds(SDL_Surface *maskbackground)
{
SDL_Color col;
Uint32 pixupleft;
SDL_PixelFormat *fmt;
Uint8 r,g,b;
pixupleft=frog.pos.x+(frog.pos.y*800);
fmt=maskbackground->format;
SDL_GetRGB(pixupleft,fmt,&r,&g,&b);
col.g=g;
printf("green color:%d\n",col.g);
.....
but this don't return me the rgb code, it returns me an non-sense
number that isn't correct.
frog is a global struct that have the position of a sprite (frog.pos)
, i want to know if the upper left corner of the sprite (800x600
screen size) is over the "black zone" of the mask of the background.
thanks in advance
--
f || www.ct.upc.edu/%7eferran
More information about the SDL
mailing list