-1
我有一个小问题,用这种方法, 这是我的代码(我有更多的代码,但是这是给我的错误的部分)SDL方法,参数皈依
void ranCol(SDL_Surface sprite[], SDL_Rect paste)
{
SDL_FillRect(sprite[y],NULL,temp);
SDL_BlitSurface(sprite[y],&paste[y],rScreen(),NULL);
}
我得到2个错误
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 []'
任何人都可以帮助我实现这个目标吗?
编辑:这里是代码柜面有人想comile它
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);
}
}
'SDL_Surface *'等于'SDL_Surface []'在函数参数列表中,作为数组切片到pinter。 – Lol4t0
that [y]是一个循环,但它不会干涉任何事情 – Laggy
@Laggy'y'不在你的函数范围内,它是全局的吗? – emartel