SDL_Rect problem

void animation(SDL_Rect* nubz){
nubz.x += 32;
nubz.y = 0;
nubz.w = 32;
nubz.h = 32;
}
// this next stuff is in main
SDL_Rect rect1; // Pos in image
rect1.x=200;
rect1.y=200;
SDL_Rect rect2;
animation(rect2);
SDL_BlitSurface(image1,&rect2,buffer,&rect1); // draws the image

\main.cpp||In function 'void animation(SDL_Rect*)':|
\main.cpp|11|error: request for member 'x' in 'nubz', which is of non-class type 'SDL_Rect*'|
\main.cpp|12|error: request for member 'y' in 'nubz', which is of non-class type 'SDL_Rect*'|
\main.cpp|13|error: request for member 'w' in 'nubz', which is of non-class type 'SDL_Rect*'|
\main.cpp|14|error: request for member 'h' in 'nubz', which is of non-class type 'SDL_Rect*'|
\main.cpp||In function 'int SDL_main(int, char**)':|
\main.cpp|70|error: cannot convert 'SDL_Rect' to 'SDL_Rect*' for argument '1' to 'void animation(SDL_Rect*)'|
\main.cpp|74|warning: comparison between signed and unsigned integer

i gues my problem is "SDL_Rect*" in "animation" but without the "*"
it wont do anithing.
i got no other idea how to do it outside main...
Last edited on
the dot operator (.) is used to access members of an object.
The arrow operator (->) is used to access members of a pointer to an object.

Since SDL_Rect* is a pointer, you would use ->

 
nubz->x += 32;
WOW ...
I just faceplm .Going to sit in corner and cry.

Thx on help.
Topic archived. No new replies allowed.