Black screen when loading widgets
« on: 26 March 2014, 19:31:03 »
Hi ! :)

I just installed tgui and i have a very strange problem : i always got a black screen trying to run the library. To solve this, i tried to reduce the nb of lines to isolate the problem.

This is my code (very simple) :

#include <TGUI/TGUI.hpp>

void loadWidgets( tgui::Gui& gui )
{
    tgui::EditBox::Ptr editBoxUsername(gui, L"Username");
}

int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "TGUI window");
    tgui::Gui gui(window);

    loadWidgets(gui);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();

            gui.handleEvent(event);
        }

        window.clear(sf::Color(255,123,40)); // I draw in orange to test the problem

        window.display();
    }

    return EXIT_SUCCESS;
}


This code is giving me black screen. However, if i delete the line "loadWidgets(gui);" (just creating an editbox), the screen is orange (as it should be). I find this very strange... how just creating a new object (not even drawing it) could interfere with the render of my application ?

I'm working with Code::Blocks, tgui 0.6 downloaded with MinGW precompiled libraries.

Do you have any idea or suggestion ?  :o
« Last Edit: 26 March 2014, 19:38:45 by Faellan »

*

texus

  • *****
  • 1161
    • View Profile
    • Texus's Blog
Re: Black screen when loading widgets
« Reply #1 on: 26 March 2014, 19:44:41 »
Thats really strange.

Are you sure that you are using the sfml libraries included in the tgui download?
Are you linking statically or dynamically, in debug or release mode?
You are using MinGW 4.7.1, right?

I'll try it on my windows as well and see if I can reproduce the problem.

*

texus

  • *****
  • 1161
    • View Profile
    • Texus's Blog
Re: Black screen when loading widgets
« Reply #2 on: 26 March 2014, 20:29:27 »
It seems to work fine here.
If you can't solve the problem then you can send me the .cbp file and maybe I can find a mistake in it.

Re: Black screen when loading widgets
« Reply #3 on: 27 March 2014, 17:30:32 »
Hi !

Well, i unistalled all my tgui files and re-downloaded them totally and it seems to work now, i don't know what was the problem, ty for the support and nice lib ! :D