struct Ball {
SDL_Surface *picture;
SDL_Rect des;
SDL_Rect source;
int speedX;
int speedY;
};
class Block {
public:
SDL_Surface *color;
SDL_Rect des;
SDL_Rect source;
bool activation;
bool invisibility;
bool checkHit (Ball *ball);
void makeInvisible();
};
bool Block::checkHit(Ball *ball)
{
if (activation)
{
if (ball->des.x >= Block.des.x && ball->des.x <= Block.des.x + Block.source.w)
{
ball->speedY *= -1;
activation = false;
return true;
}
else return false;
}
}
当我想编译这个程序时,编译器在 Block::checkHit error C2275: 'Block' : 非法使用这种类型作为表达式时发现错误
我能做些什么 ?