login tutorial plus new window [Solved]

Started by wmbuRn, 10 July 2013, 09:41:46

wmbuRn

So i made login from tutorial, and more:

if (loginCallback.id == 1)
            {
                // Get the username and password
                tgui::EditBox::Ptr editBoxUsername = gui.get("Username");
                tgui::EditBox::Ptr editBoxPassword = gui.get("Password");

                sf::String username = editBoxUsername->getText();
                sf::String password = editBoxPassword->getText();

                a = Doit(a); // simple decrypter, since value for a and b is stored as variable
                b = Doit(b); // so a and b without Doit function have encrypted values
            if (username == a && password == b)
            {
            loginScreen.close();
            mainScreen.create(sf::VideoMode(800, 600), "A new Title");
            }

            if (username != a || password != b)
            {
            sf::sleep(sf::seconds(1));
            shaking = 1;
            }

So old window [loginScreen] get closed, and new window [mainScreen] get created. So i made new
(while (mainScreen.isOpen))
{
    // awesome stuff here like events and callback
}

But new window start taking 80% of cpu. Its not directly related to tGui, [it is indirectly]
And i added mainScreen.setFramerateLimit(30); everywhere but it is still using 70-80% of CPU. Untila i start clicking inside empty window than CPU usage goes to 1% for this app, until i stop clicking, then it goes back to 70-80% . :)
So.. any idea what am i doing wrong ? if needed I can upload entire project and post link here. :)

wmbuRn