Recent Posts

Pages: 1 ... 8 9 [10]
91
Feature requests / Visual Studio warnings
« Last post by Ardent Coder on 18 September 2019, 17:09:32 »
It is good to have a project compile with no errors and warnings. But sometimes third party libraries introduce warning messages into our projects and so is the case with TGUI.
I think you should build the library in Visual Studio because it provides serious warnings as well that are ought to be noticed. One of the four warnings I'm currently getting says "Dereferencing NULL pointer mOwner" inside CopiedPtr.hpp line 121, which I guess, can prove fatal during runtime!
I hope these issues will be solved in an upcoming version of this library so that the developers can build their projects without worrying about the warnings that are produced while compiling such libraries.
92
Help requests / Re: OOP and TGUI
« Last post by texus on 17 September 2019, 22:35:28 »
I don't do it because i don't want to complicate the code. It doesn't add much complexity, but I feel like the minimal examples should be as straightforward as possible: just a main function with the minimum required code in them. By adding classes you are adding stuff to the code that is irrelevant to the example.

I'm not against OOP for larger examples, but for the really simple examples I don't really feel that it is needed.

It might be a good idea to have at least one example with a class though, it could be useful to demonstrate how to initialize the gui in a class and how to connect member functions. These are cases that people likely face but are currently not covered in the examples.

Calling setTarget is one way to do it, but even in a class you can still use the constructor by using the initializer list:
MyFrame::MyFrame(int argc, char* argv[]) :
    window(sf::VideoMode(800, 600), "TGUI window"),
    gui(window)
{
93
Help requests / OOP and TGUI
« Last post by Kvaz1r on 17 September 2019, 11:58:45 »
I noticed that all examples use only "all in main" style. Is there any reason why it don't write in OOP-style?
Minimal example(it took for me a while before I realize how create Gui inside class):

Code: [Select]
#include <TGUI/TGUI.hpp>

class MyFrame
{
public:
    MyFrame(int argc, char* argv[]);
    void main();

protected:
    tgui::Button::Ptr m_Button;

private:
    sf::RenderWindow window;
    tgui::Gui gui;
};

MyFrame::MyFrame(int argc, char* argv[])
{
    window.create(sf::VideoMode(800, 600), "TGUI window");
    gui.setTarget(window);
    auto panel = tgui::ScrollablePanel::create();
    m_Button = tgui::Button::create("Press");
    panel->add(m_Button);
    gui.add(panel);
}

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

            else if (event.type == sf::Event::Resized)
            {
                window.setView(sf::View(sf::FloatRect(0.f, 0.f, static_cast<float>(event.size.width), static_cast<float>(event.size.height))));
                gui.setView(window.getView());
            }
            gui.handleEvent(event);
        }

        window.clear();
        gui.draw();
        window.display();
    }
}

int main(int argc, char* argv[])
{
    MyFrame f(argc, argv);
    f.main();
}
94
Feature requests / Re: Add table widget
« Last post by Kvaz1r on 16 September 2019, 19:54:03 »
great, thank you
95
Feature requests / Re: Add table widget
« Last post by texus on 16 September 2019, 19:49:19 »
I made setItemColor virtual now.
96
Feature requests / Re: Add table widget
« Last post by Kvaz1r on 16 September 2019, 19:48:11 »
Yes, you're right, it's my mistake.
97
Feature requests / Re: Missing .pdb files
« Last post by Ardent Coder on 16 September 2019, 19:16:19 »
Thank you
98
Feature requests / Re: Add table widget
« Last post by texus on 16 September 2019, 19:13:15 »
Isn't making just setItemColor virtual enough, as the other will just call that function? Or do you have something that needs to be changed in these functions as well?
99
Feature requests / Re: Missing .pdb files
« Last post by texus on 16 September 2019, 19:09:30 »
I'll look into it in the near future. The next TGUI build is likely to happen on a completely different PC anyway so I'll make the changes to copy the pdb files with the library then.
100
Feature requests / Missing .pdb files
« Last post by Ardent Coder on 16 September 2019, 14:29:36 »
The lib folder does not contain the corresponding .pdb files of the libraries. You should distribute the .pdb files along with the libraries or embed them into the libraries while building them so that the users of your library does not get a linker warning. It will also help us debug our programs better.
Pages: 1 ... 8 9 [10]