Hello,
I haven't asked If I wasn't really confused :)
OK, so I am just beginning SDL programming in C, and I was running fine, until I tried getting a pixel colour.
Basically, I am trying to run the code from this page:
http://www.libsdl.org/cgi/docwiki.cgi/Pixel_20Access
This is the cut down version of my code:
gcc output:
PS! I believe the line 38 error comes from the faulty(?) line 36, since it's a simple if cond.
Any help would be much appreciated :)
Thank you.
I haven't asked If I wasn't really confused :)
OK, so I am just beginning SDL programming in C, and I was running fine, until I tried getting a pixel colour.
Basically, I am trying to run the code from this page:
http://www.libsdl.org/cgi/docwiki.cgi/Pixel_20Access
This is the cut down version of my code:
Code:
[I]snip[/I]
SDL_Color GetPixel ( SDL_Surface* Screen , int x , int y ) ; //define struct
[I]snip[/I]
int main( int argc, char* argv[] )
{
SDL_Init( SDL_INIT_VIDEO );
SDL_Surface* Screen = SDL_SetVideoMode( width, height , 32, DL_HWSURFACE | SDL_DOUBLEBUF ) ; //use Screen as surface
[I]snip[/I]
curr_col = GetPixel(Screen, ant[1], ant[2]); //DOESN'T WORK! this is line 36
[I]snip[/I]
boxRGBA(Screen,
ant[1], ant[2],
ant[3], ant[4],
ant[5], ant[6], ant[7], ant[8]); //DOES WORK
[I]snip[/I]
Code:
test.c: In function ‘main’:
[B]test.c:36: error: incompatible types in assignment[/B]
test.c:38: error: expected expression before ‘{’ token
Any help would be much appreciated :)
Thank you.
Comment