I am a beginner at Raylib and I was wondering how to hide an image or sprite in Raylib?
code example:
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
I am a beginner at Raylib and I was wondering how to hide an image or sprite in Raylib?
code example:
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
I believe there's no real way of undrawing something but you could easily control whether you draw it or not in the first place like so:
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
}
Maybe you can change the radius to 0 when you want to hide it:
float radius{ 50 };
while(!WindowShouldClose()){
DrawCircle(400,400,radius,RED);
if(condition)
radius = 0; //hide circle
else{
radius = 50;
}
}
If you want to "draw" an invisible circle for, say, collision. Then you should implement your own, see https://github.com/raysan5/raylib/blob/master/src/rshapes.c for the example, look at the functions with "DrawCircle" in it.