1

我是 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
4

2 回答 2

1

我相信没有真正的方法可以取消绘制某些东西,但是您可以轻松地控制是否首先绘制它,如下所示:

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
}
于 2020-12-21T06:11:54.190 回答
0

当您想隐藏它时,也许您可​​以将半径更改为 0:

float radius{ 50 };   
while(!WindowShouldClose()){
   DrawCircle(400,400,radius,RED);
   if(condition)
       radius = 0; //hide circle
   else{
     radius  = 50;
     }
   }
于 2021-08-02T09:29:14.290 回答