I have a small problem with this method,
this is my code ( I have more code but this is the part that gives me errors)
void ranCol( SDL_Surface sprite[], SDL_Rect paste)
{
SDL_FillRect(sprite[y],NULL,temp);
SDL_BlitSurface(sprite[y],&paste[y],rScreen(),NULL);
}
I get 2 errors
error C2664: 'SDL_FillRect' : cannot convert parameter 1 from 'SDL_Surface' to 'SDL_Surface *'
error C2664: 'randCol' : cannot convert parameter 2 from 'SDL_Surface *[50000]' to 'SDL_Surface []'
Can anyone help me get this working?
EDIT: Here is the code incase someone wants to comile it
void randCol(int times, SDL_Surface* sprite[], SDL_Rect paste)
{
int unsigned temp = 10101;//seed
for(int y = 0;y < times;y++)
{
temp = temp*(y+y+1);
temp = (temp^(0xffffff))>>2;
//printf("%x\n",temp);
SDL_FillRect(sprite[y],NULL,temp);
SDL_BlitSurface(sprite[y],&paste[y],rScreen(),NULL);
}
}
You should always manipulate
pointerstoSDL_Surfaces… change your function toI am not sure where your
[y]comes from! If it’s from an array ofSDL_Surface, pass a singleSDL_Surfaceas a parameter to the function, it will be clearer.If you want to pass an ARRAY of items, use the following signature:
But you will still need to pass your
yin some way, either as a parameter or as a member / global.