我是 Raylib 的初学者,我想知道如何在 Raylib 中隐藏图像或精灵?
代码示例:
DrawCircle(400,400,100,RED);//circle 1
DrawCircle(200,200,50,RED); //circle 2
//here is where i want a funtion just to delete/hide circle 2
我相信没有真正的方法可以取消绘制某些东西,但是您可以轻松地控制是否首先绘制它,如下所示:
int condition = 1;
DrawCircle(400,400,100,RED);//circle 1
if(condition == 0)
{
// Circle is only drawn when condition is true
DrawCircle(200,200,50,RED); //circle 2
}
当您想隐藏它时,也许您可以将半径更改为 0:
float radius{ 50 };
while(!WindowShouldClose()){
DrawCircle(400,400,radius,RED);
if(condition)
radius = 0; //hide circle
else{
radius = 50;
}
}