Hi

Just tried to install and get TGUI working. I get a black screen no matter what I try.

What I've done:

- I have a working installation of Code::Blocks + SFML 2.1 (I use them daily) on Xubuntu (12.04)
- I downloaded TGUI 0.6 source from tgui.eu
- I ran cmake . , no problems
- I ran sudo make install -j6 ... again no problems.

I added -ltgui before the SFML libs, starting from a working example SFML project
I added linker search dir to TGUI/lib and compiler search to TGUI/include in project options.

I copy-pasted the example "login" screen source into the main.cpp of the project.

I get a black "TGUI Window" screen (so SFML is working) but no TGUI elements at all are showing up.

I have followed the install instructions fully.

TGUI form builder works though.

I am a bit at loss where to look for the problem. Any help would be appreciated.   

*

texus

  • *****
  • 1143
    • View Profile
    • Texus's Blog
You didn't change any line from the example code? There are no errors printed in the terminal?

The form builder is just a program that links agains the just build libraries, which means that the libraries have to be build correctly.

The first thing you can try is this:
- open the terminal in the folder TGUI_Path/examples/LoginScreen
- type "g++ LoginScreen.cpp -std=c++11 -ltgui -lsfml-graphics -lsfml-window -lsfml-system"
- run "./a.out"

Does it display a black screen too? If it doesn't, then something is wrong with your code (e.g. a wrong pathname for loading the widgets).
« Last Edit: 23 July 2014, 22:47:12 by texus »

./a.out: error while loading shared libraries: libtgui.so.0.6.4: cannot open shared object file: No such file or directory

... which is rather interesting, I do not know where I might have made a mistake with the installation

*

texus

  • *****
  • 1143
    • View Profile
    • Texus's Blog
I would expect the same error then when you try to run your own code.

This error isn't necessarily a problem. If you are lucky it is just a caching problem, otherwise your linker isn't searching in the right folder. See if "sudo ldconfig" solves it.

I simply copied the missing libtgui into /usr/local/lib

a.out works now, although login entry boxes look broken

I changed the project to generate a console window, apparently missing font and background picture are causing some problems.

I will investigate further.

Happily compiling and working in Code::Blocks. It works well.

but...

Any idea why graphics for buttons are broken like this ?


photo host

*

texus

  • *****
  • 1143
    • View Profile
    • Texus's Blog
I can clearly see that the texture repeat is broken, but I tested the download from my site two days ago with your previous question and the login example ran fine on my pc.

So in order to be certain that its not a problem with your graphics driver, you should try testing a small sfml program.
Code: [Select]
// Load a small to medium sized texture, set it to repeat
sf::Texture texture;
texture.loadFromFile("Filename.jpg");
texture.setRepeated(true);

// Create the sprite and give it a texture rect that is several times larger than the size of the texture
sf::Sprite sprite;
sprite.setTexture(texture);
sprite.setTextureRect({0, 0, 800, 600});

// Draw the sprite and see if it displays without gaps between the repeated texture
window.draw(sprite);

If that would display correctly then I have a serious problem, if it is broken too then it is only on your pc.

Edit: I just tested the FullExample with v0.6.4 and I cannot reproduce the problem. So there is nothing that I can fix, I can only tell how to get around this problem in case you can't solve it.
« Last Edit: 25 July 2014, 22:44:53 by texus »