problem with tgui

closed account (Dy7SLyTq)
so im using sfml 2.1 and the latest tgui, but i cant figure out what is wrong with my code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
    special thanks to:
        cire
        naraku9333
*/

#include <TGUI/TGUI.hpp>

int main()
{
    sf::RenderWindow   App          (sf::VideoMode(800, 600), "Fuck it. Uploads Happen.");
    tgui::Gui          Gui          (App);
    tgui::Picture::Ptr Background   (Gui, "BackgroundImage");
    tgui::EditBox::Ptr Picture      (Gui, "PictureFolder"),
                       Status       (Gui, "StatusList");
    tgui::Label::Ptr   PictureLabel (Gui);
    tgui::Label::Ptr   StatusLabel  (Gui);
    tgui::Button::Ptr  Button       (Gui);

    if(!Gui.setGlobalFont("font/Exo-Light.otf")) return -1;

    App.setPosition              (sf::Vector2i(125, 75));
    Background   ->load          ("Background.jpg");
    Picture      ->load          ("widgets/EditBox/BabyBlue");
    Picture      ->setSize       (400, 40);
    Picture      ->setPosition   (200, 140);
    Status       ->load          ("widgets/EditBox/BabyBlue");
    Status       ->setSize       (400, 40);
    Status       ->setPosition   (200, 290);
    PictureLabel ->setText       ("Pictures:");
    PictureLabel ->setPosition   (200, 100);
    StatusLabel  ->setText       ("Status:");
    StatusLabel  ->setPosition   (200, 250);
    Button       ->load          ("widgets/Black.conf");
    Button       ->setSize       (260, 60);
    Button       ->setPosition   (270, 440);
    Button       ->setText       ("Start");
    Button       ->bindCallback  (tgui::Button::LeftMouseClicked);
    Button       ->setCallbackId (1);

    while(App.isOpen())
    {
        sf::Event Event;

        while(App.pollEvent(Event))
        {
            if(Event.type == sf::Event::Closed)                                               App.close();
            if(Event.type == sf::Event::KeyPressed && Event.key.code == sf::Keyboard::Escape) App.close();
 
            Gui.handleEvent(Event);
        }   

        tgui::Callback Callback;

        while(Gui.pollCallback(Callback))
        {
            if (Callback.id == 1)
            {
                tgui::EditBox::Ptr PicturesBox = Gui.get("PictureFolder");
                tgui::EditBox::Ptr StatusBox   = Gui.get("StatusList");

                sf::String PictureFolder = PicturesBox ->getText();
                sf::String StatusList    = StatusBox   ->getText();
            }
        }
 
        App.clear();
 
        Gui.draw();
 
        App.display();
    }
 
    return 0;
}


what it does is the same thing as if i made an sf::window with nothing drawn to it, ie takes a snapshot of the process behind it and use that. the only difference is i cant exit out of anything unless i go back to the terminal and throw ctrl+c at it. because of this and the fact nothing is getting drawn to the window, i feel that one of the event polls is caught in an infinite loop but i dont know which one
Last edited on
closed account (Dy7SLyTq)
ive actually narrowed it down to line 25
On lines 24 and 27 don't you need a file name?
Try...
24
25
26
27
Picture->load("widgets/BabyBlue.conf");
Picture->setSize(400, 40);
Picture->setPosition(200, 150);
Status->load("widgets/BabyBlue.conf");
closed account (Dy7SLyTq)
i tried that and naraku and it gave me this: TGUI error: Failed to parse value for NormalImage_L in section EditBox in widgets/White.conf.
TGUI error: Failed to parse value for NormalImage_L in section EditBox in widgets/White.conf.
TGUI error: Failed to parse value for NormalImage_L in section Button in widgets/White.conf.

(i decided to use white instead)
That's odd, your code works for me (with the change I suggested). Maybe ask on the TGUI forum.
closed account (Dy7SLyTq)
alright. just out of curiosity what was your os and compile command? and where did you put widgets?
Windows 7, Visual Studio handles the command for me. I put the widgets directory in my project folder. I'll test it later with linux.

Edit: Tried in my Ubuntu 13.04 VM using
g++ -std=c++11 -o test test.cpp -ltgui -lsfml-graphics -lsfml-window -lsfml-system
and it worked fine.
Last edited on
closed account (Dy7SLyTq)
and you only used the widgets folder?
Yes I copied the widgets/ folder to where test.cpp is.
Topic archived. No new replies allowed.