hey, i have a little problem with editbox it doesn't work...
when i compile sample project it work, but in my game not...
what is wrong?
#include "include/Client.h"
#include <TGUI/TGUI.hpp>
int main()
{
Client client;
sf::RenderWindow window(sf::VideoMode(800, 600), "Client");
tgui::Form Menu( window );
tgui::Form Create( window );
Menu.setGlobalFont( "Font/djvs.ttf");
Create.setGlobalFont( "Font/djvs.ttf");
tgui::Button::Ptr connect(Menu);
tgui::Button::Ptr disconnect(Menu);
tgui::Button::Ptr createaccount(Menu);
tgui::Button::Ptr create(Create);
tgui::Label::Ptr labelUsername(Create);
labelUsername->setText("Username:");
labelUsername->setPosition(200, 100);
tgui::Label::Ptr labelPassword(Create);
labelPassword->setText("Password:");
labelPassword->setPosition(200, 250);
tgui::Label::Ptr labelMail(Create);
labelMail->setText("E-Mail:");
labelMail->setPosition(200, 400);
tgui::EditBox::Ptr editBoxUsername(Create, "Username");
editBoxUsername->load("gui/EditBox/Black");
editBoxUsername->setSize(400, 40);
editBoxUsername->setPosition(200, 140);
tgui::EditBox::Ptr editBoxPassword = Create.copy(editBoxUsername, "Password");
editBoxPassword->setPosition(200, 290);
editBoxPassword->setSize(400, 40);
editBoxPassword->setPasswordChar('*');
tgui::EditBox::Ptr editBoxMail(Create, "E-Mail");
editBoxMail->load("gui/Editbox/Black");
editBoxMail->setSize(400,40);
editBoxMail->setPosition(200, 440);
createaccount->load("gui/Button/Black");
createaccount->setSize(260, 60);
createaccount->setPosition(270, 280);
createaccount->setText("Create Account");
createaccount->bindCallback(tgui::Button::LeftMouseClicked);
createaccount->setCallbackId(1);
connect->load("gui/Button/Black");
connect->setSize(260, 60);
connect->setPosition(270, 340);
connect->setText("Connect");
connect->bindCallback(tgui::Button::LeftMouseClicked);
connect->setCallbackId(2);
disconnect->load("gui/Button/Black");
disconnect->setSize(260, 60);
disconnect->setPosition(270, 400);
disconnect->setText("Disconnect");
disconnect->bindCallback(tgui::Button::LeftMouseClicked);
disconnect->setCallbackId(3);
create->load("gui/Button/Black");
create->setSize(260, 60);
create->setPosition(270, 700);
create->setText("Create Account");
create->bindCallback(tgui::Button::LeftMouseClicked);
create->setCallbackId(1);
int menu = 2;
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
Menu.handleEvent(event);
}
tgui::Callback callback;
switch( menu)
{
case 1:
{
while( Create.pollCallback(callback))
{
switch( callback.callbackId)
{
case 1:
{
editBoxUsername = Create.get("Username");
editBoxPassword = Create.get("Password");
editBoxMail = Create.get("E-Mail");
sf::String username = editBoxUsername->getText();
sf::String password = editBoxPassword->getText();
sf::String email = editBoxMail->getText();
menu==2;
break;
}
}
}
break;
}
case 2:
{
while (Menu.pollCallback(callback))
{
switch( callback.callbackId)
{
case 1:
{
if( client.init( "127.0.0.1", 6667 ))
menu = 1;
else menu=2;
break;
}
case 2:
{
client.init( "127.0.0.1", 6667 );
menu=2;
break;
}
case 3:
{
client.Disconnect();
menu=2;
break;
}
}
}
break;
}
}
window.clear();
switch(menu)
{
case 1:
{
Create.draw();
break;
}
case 2:
{
Menu.draw();
break;
}
}
window.display();
}
}