Hello !
I'm using tgui in a constructor ( player ).
i have one editBox, 5 radio, and one button.
But, when i try to register two player, it seems that the editBox and the 5 radio still contains their first value, and the player is create with the informations of the first player.
Thanks !!
I'm using tgui in a constructor ( player ).
i have one editBox, 5 radio, and one button.
But, when i try to register two player, it seems that the editBox and the 5 radio still contains their first value, and the player is create with the informations of the first player.
Code Select
while(1)
{
sf::Event event;
while (w.pollEvent(event))
{
// fermeture de la fenĂȘtre lorsque l'utilisateur le souhaite
if (event.type == sf::Event::Closed)
{
w.close();
exit(1);
}
w.handleEvent(event);
}
if(w.get<tgui::RadioButton>("un")->isChecked() && w.get<tgui::EditBox>("Username")->getText()!="" && draw==0)
{
cout<<"checked"<<endl;
tgui::Button * button = w.add<tgui::Button>();
button->load("../TGUI/objects/Button/Black");
button->setText("Suivant");
button->setSize(150, 50);
button->setPosition(620, 50);
button->setTextColor(sf::Color(51,204,255));
button->callbackID = 1;
draw++;
}
else if(w.get<tgui::RadioButton>("deux")->isChecked() && w.get<tgui::EditBox>("Username")->getText()!="" && draw==0)
{
tgui::Button * button = w.add<tgui::Button>();
button->load("../TGUI/objects/Button/Black");
button->setText("Suivant");
button->setSize(150, 50);
button->setPosition(620, 50);
button->setTextColor(sf::Color(51,204,255));
button->callbackID = cpt;
draw++;
}
else if(w.get<tgui::RadioButton>("trois")->isChecked() && w.get<tgui::EditBox>("Username")->getText()!="" && draw==0)
{
tgui::Button * button = w.add<tgui::Button>();
button->load("../TGUI/objects/Button/Black");
button->setText("Suivant");
button->setSize(150, 50);
button->setPosition(620, 50);
button->setTextColor(sf::Color(51,204,255));
button->callbackID = 1;
draw++;
}
else if(w.get<tgui::RadioButton>("quatre")->isChecked() && w.get<tgui::EditBox>("Username")->getText()!="" && draw==0)
{
tgui::Button * button = w.add<tgui::Button>();
button->load("../TGUI/objects/Button/Black");
button->setText("Suivant");
button->setSize(150, 50);
button->setPosition(620, 50);
button->setTextColor(sf::Color(51,204,255));
button->callbackID = 1;
draw++;
}
tgui::Callback callback;
while(w.getCallback(callback))
{
if(callback.callbackID == cpt)
{
if(w.get<tgui::RadioButton>("un")->isChecked() && w.get<tgui::EditBox>("Username")->getText()!="")
{
name=w.get<tgui::EditBox>("Username")->getText();
jeton="red";
return;
}
else if(w.get<tgui::RadioButton>("deux")->isChecked() && w.get<tgui::EditBox>("Username")->getText()!="")
{
name=w.get<tgui::EditBox>("Username")->getText();
jeton="red_corned";
return;
}
else if(w.get<tgui::RadioButton>("trois")->isChecked() && w.get<tgui::EditBox>("Username")->getText()!="")
{
name=w.get<tgui::EditBox>("Username")->getText();
jeton="black";
return;
}
else if(w.get<tgui::RadioButton>("quatre")->isChecked() && w.get<tgui::EditBox>("Username")->getText()!="")
{
name=w.get<tgui::EditBox>("Username")->getText();
jeton="green";
return;
}
}
}
w.drawGUI();
w.display();
}
Thanks !!