0
在创建鼠标事件以在矩形中单击时,我将如何重新格式化if语句,以便不再为获取类型为'SDL_Rect'的临时对象的地址而发生错误。我该如何改变我的方法来使用临时对象的地址?
//Get the mouse offsets
x = event.motion.x;
y = event.motion.y;
SDL_Point point ={x, y};
bool isPointInTileMap = false;
for (int i = 0; i < TILE_HEIGHT; i++)
{
for (int j = 0; j < TILE_WIDTH; j++)
{
if (SDL_PointInRect(&point, &(tileMap_[i][j].getBoundRect())))
{
isPointInTileMap = true;
break;
}
}
}
完美,谢谢 – Vyff