We are about to switch to a new forum software. Until then we have removed the registration on this forum.
It starts with Intro, so the function draws a title "game" and a cp5 textfield "player".
when the button next is pressed the GAMESTATUS changes to "gamestarted", this starts the next if statement. this one draws an ellipse. the title "game" gets overwritten by the background but the cp5 textfield doesn't.
any idea how the textfield can be overwritten by the background or deleted/hide. Or is there a better way to change a "window". hope you can help me.
import controlP5.*;
ControlP5 cp5;
String GAMESTATUS = "Intro";
void setup()
{
size(1920, 1080);
cp5 = new ControlP5(this);
cp5.addButton("next").setPosition(500, 500).setSize(400, 100);
}
void draw()
{
background(#FEF4E9);
fill(#FF0000);
if(GAMESTATUS.equals("Intro"))
{
textFont(createFont("Verdana", 50));
text("game", 850,60);
cp5.addTextfield("player").setPosition(200, 200).setSize(200, 50);
}
else if(GAMESTATUS.equals("gamestarted"))
{
ellipse(56, 46, 55, 55);
}
}
public void next()
{
GAMESTATUS = "gamestarted";
}