Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - moktar

#1
Help requests / strange problem with tgui objects
07 September 2013, 16:58:16
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.
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 !!
#2
Installation help / Indefined reference tgui::Window
06 September 2013, 18:15:30
Hello all,

I'm trying to implement tgui in my sfml project but i've an error when i try to compil. I'm using a makefile.
My question is : How to implement TGUI in a makefile ? I only have a main.cpp.

My makefile :
app: main.o
g++ main.o -o app -L ../TGUI/lib  -L ../SFML/lib -lsfml-graphics -lsfml-window -lsfml-system

main.o: main.cpp
g++ -c main.cpp -I ../SFML/include -I ../TGUI/include


Thanks !!