Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - gupas

Pages: [1]
1
General Discussion / Containers refactoring cause some problems
« on: 06 August 2013, 20:27:14 »
Hello,

You recently merged Container and ContainerWidget and updated Gui (creating ContainerGui). However, there are some bugs with the size of a ContainerGui when you (re)create the window subsequently.
For example:
Code: [Select]
sf::Window window;
window.create(sf::VideoMode(800, 600), "title");
tgui::Gui gui(window);
window.create(sf::VideoMode(1024, 768), "title");
gui->getSize(); // == (800, 600) !!!


PS: [Off-topic] Nice work on the ComboBox widget, I tested and it works great.

2
Help requests / Tab widget
« on: 02 August 2013, 09:12:18 »
Hello,

I don't understand how Tabs are working. How can I add sub-widgets to each tab? Do you have an example please?
Fullexample only use empty Tab...

Thanks

3
Hello,

I just tried to build the last version of TGUI, but...
Code: [Select]
C:\Users\gupas\Desktop\TGUI\src\TGUI\TGUI.cpp: In function 'sf::Color tgui::extractColor(std::string)':
C:\Users\gupas\Desktop\TGUI\src\TGUI\TGUI.cpp:60:27: error: 'stoi' is not a member of 'std'
C:\Users\gupas\Desktop\TGUI\src\TGUI\TGUI.cpp:68:33: error: 'stoi' is not a member of 'std'
C:\Users\gupas\Desktop\TGUI\src\TGUI\TGUI.cpp:76:36: error: 'stoi' is not a member of 'std'
C:\Users\gupas\Desktop\TGUI\src\TGUI\TGUI.cpp:80:37: error: 'stoi' is not a member of 'std'
C:\Users\gupas\Desktop\TGUI\src\TGUI\TGUI.cpp:85:36: error: 'stoi' is not a member of 'std'
C:\Users\gupas\Desktop\TGUI\src\TGUI\TGUI.cpp: In function 'std::string tgui::convertColorToString(const sf::Color&)':
C:\Users\gupas\Desktop\TGUI\src\TGUI\TGUI.cpp:108:26: error: 'to_string' is not a member of 'std'
C:\Users\gupas\Desktop\TGUI\src\TGUI\TGUI.cpp:109:26: error: 'to_string' is not a member of 'std'
C:\Users\gupas\Desktop\TGUI\src\TGUI\TGUI.cpp:110:26: error: 'to_string' is not a member of 'std'
C:\Users\gupas\Desktop\TGUI\src\TGUI\TGUI.cpp:111:26: error: 'to_string' is not a member of 'std'
C:\Users\gupas\Desktop\TGUI\src\TGUI\TGUI.cpp:114:26: error: 'to_string' is not a member of 'std'
C:\Users\gupas\Desktop\TGUI\src\TGUI\TGUI.cpp:115:26: error: 'to_string' is not a member of 'std'
C:\Users\gupas\Desktop\TGUI\src\TGUI\TGUI.cpp:116:26: error: 'to_string' is not a member of 'std'
C:\Users\gupas\Desktop\TGUI\src\TGUI\TGUI.cpp: In function 'bool tgui::extractVector2f(std::string, tgui::Vector2f&)':
C:\Users\gupas\Desktop\TGUI\src\TGUI\TGUI.cpp:139:32: error: 'stof' is not a member of 'std'
C:\Users\gupas\Desktop\TGUI\src\TGUI\TGUI.cpp:143:32: error: 'stof' is not a member of 'std'
C:\Users\gupas\Desktop\TGUI\src\TGUI\TGUI.cpp: In function 'bool tgui::extractVector2u(std::string, tgui::Vector2u&)':
C:\Users\gupas\Desktop\TGUI\src\TGUI\TGUI.cpp:173:58: error: 'stoi' is not a member of 'std'
C:\Users\gupas\Desktop\TGUI\src\TGUI\TGUI.cpp:177:58: error: 'stoi' is not a member of 'std'
C:\Users\gupas\Desktop\TGUI\src\TGUI\TGUI.cpp: In function 'bool tgui::extractVector4u(std::string, tgui::Vector4u&)':
C:\Users\gupas\Desktop\TGUI\src\TGUI\TGUI.cpp:207:33: error: 'stoi' is not a member of 'std'
C:\Users\gupas\Desktop\TGUI\src\TGUI\TGUI.cpp:215:37: error: 'stoi' is not a member of 'std'
C:\Users\gupas\Desktop\TGUI\src\TGUI\TGUI.cpp:223:41: error: 'stoi' is not a member of 'std'
C:\Users\gupas\Desktop\TGUI\src\TGUI\TGUI.cpp:227:41: error: 'stoi' is not a member of 'std'
C:\Users\gupas\Desktop\TGUI\src\TGUI\TGUI.cpp: In function 'std::string tgui::convertColorToString(const sf::Color&)':
C:\Users\gupas\Desktop\TGUI\src\TGUI\TGUI.cpp:118:5: warning: control reaches end of non-void function [-Wreturn-type]

But I don't know what is wrong...
(I used CodeBlocks/Mingw)
Should I use SFML compiled with c++11 now? It is strange, but until your last commit it worked great with "only" the -std=c++0x option enabled.

4
Feature requests / MenuBar (small) improvement
« on: 29 July 2013, 11:07:04 »
Hello,

It would be great if menus of the MenuBar were opened/closed with a mouse clic (not only with pointing on them).

That's all. ;)

5
Help requests / Creating new Widgets by inheritance
« on: 27 July 2013, 10:33:09 »
Hello,

I defined an Interface class like this:
Code: [Select]
class Interface
    : public tgui::Grid
{
public:
    typedef tgui::SharedWidgetPtr<Interface> Ptr;

private:
    tgui::Picture::Ptr m_logo;
    std::vector<tgui::Label::Ptr> m_menuItems;

public:
    Interface();
    ~Interface();
};

I can create one instance of this using: Interface::Ptr interface(gui); in main().
I need to get the parent of the interface in its constructor. However, when the constructor runs, parent is not yet initialized...
So it is not possible to make Widgets constructor taking Parent in first parameter?

Code: [Select]
Interface::Interface()
    : tgui::Grid()
    , m_logo(*this)
{
    // Get parent size (normally)
    sf::Vector2f parentSize;
    tgui::Gui* guiParent = dynamic_cast<tgui::Gui*>(getParent());
    if (guiParent)
        parentSize = sf::Vector2f(guiParent->getWindow()->getSize());
    else if (getParent())
        parentSize = static_cast<tgui::ContainerWidget*>(getParent())->getSize();

    // Init logo
    m_logo->load("data/images/logo.png");

    // Init items
    tgui::Button::Ptr label(*this);
    label->setTextSize(30);
    label->setTextColor(sf::Color(255, 255, 255));

    tgui::Button::Ptr label2;

    label2 = label.clone();
    label2->setText("Introduction");
    add(label2);
    m_menuItems.push_back(label2);
    label2 = label.clone();
    label2->setText("Nouvelle partie");
    m_menuItems.push_back(label2);
    label2 = label.clone();
    label2->setText("Options");
    m_menuItems.push_back(label2);
    label2 = label.clone();
    label2->setText("Aide");
    m_menuItems.push_back(label2);
    label2 = label.clone();
    label2->setText("Crédits");
    m_menuItems.push_back(label2);
    label2 = label.clone();
    label2->setText("Quitter");
    m_menuItems.push_back(label2);

    // Add widget to the grid.
    addRow(200/*parentSize.y/3*/);
    addToRow(m_logo/*, tgui::Vector4u(0,0,0,0), Layout::Center*/);

    for (auto it = m_menuItems.begin(); it != m_menuItems.end(); ++it) {
        addRow(30);
        addToRow(*it);
    }
    updateWidgets(); // Not sure if it is needed but I tried with it and without it.
}


This should display a menu with a logo and below, a list of menu items. However, I have not any Label (menu item) displayed. Only the logo is shown, but it is not at the center of its tile. Do you have any idea of why?

Thanks for your answer.

6
Hello,

I tried TGUI and it is an awesome lib (really great work texus).

I compiled it from the latest git version and it worked great with examples (excepted Slider2d on FullExample but it is a dev version, no?).
Then I made some test on one of my project and when I closed the window, I had a segmentation fault.
These is call stack if you want (main.cpp:103 is the end of the main: return 0;):

Code: [Select]
#0 00454DC8 std::basic_string<unsigned int, std::char_traits<unsigned int>, std::allocator<unsigned int> >::_M_data(this=0xbaadf025) (c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/include/c++/bits/basic_string.h:290)
#1 00454DB7 std::basic_string<unsigned int, std::char_traits<unsigned int>, std::allocator<unsigned int> >::_M_rep(this=0xbaadf025) (c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/include/c++/bits/basic_string.h:298)
#2 004783D2 std::basic_string<unsigned int, std::char_traits<unsigned int>, std::allocator<unsigned int> >::~basic_string(this=0xbaadf025, __in_chrg=<optimized out>) (c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/include/c++/bits/basic_string.h:536)
#3 0044D26B sf::String::~String(this=0xbaadf025, __in_chrg=<optimized out>) (../external/include/SFML/System/String.hpp:43)
#4 0044DDC6 tgui::Callback::~Callback(this=0xbaadf00d, __in_chrg=<optimized out>) (../external/include/TGUI/Callback.hpp:46)
#5 004C4962 std::_Destroy<tgui::Callback>(__pointer=0xbaadf00d) (c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/include/c++/bits/stl_construct.h:95)
#6 00487F43 std::_Destroy_aux<false>::__destroy<tgui::Callback*>(__first=0xbaadf00d, __last=0xbaadf20d) (c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/include/c++/bits/stl_construct.h:105)
#7 004C4B04 std::_Destroy<tgui::Callback*>(__first=0xbaadf00d, __last=0xbaadf20d) (c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/include/c++/bits/stl_construct.h:128)
#8 004C4B20 std::_Destroy<tgui::Callback*, tgui::Callback>(__first=0xbaadf00d, __last=0xbaadf20d) (c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/include/c++/bits/stl_construct.h:155)
#9 004B02A2 std::deque<tgui::Callback, std::allocator<tgui::Callback> >::_M_destroy_data_aux(this=0x28fa6c, __first=..., __last=...) (c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/include/c++/bits/deque.tcc:804)
#10 004B0228 std::deque<tgui::Callback, std::allocator<tgui::Callback> >::_M_destroy_data(this=0x28fa6c, __first=..., __last=...) (c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/include/c++/bits/stl_deque.h:1825)
#11 004B0407 std::deque<tgui::Callback, std::allocator<tgui::Callback> >::~deque(this=0x28fa6c, __in_chrg=<optimized out>) (c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/include/c++/bits/stl_deque.h:907)
#12 004B0437 std::queue<tgui::Callback, std::deque<tgui::Callback, std::allocator<tgui::Callback> > >::~queue(this=0x28fa6c, __in_chrg=<optimized out>) (c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/include/c++/bits/stl_queue.h:92)
#13 0044DD88 tgui::Gui::~Gui(this=0x28fa08, __in_chrg=<optimized out>) (../external/include/TGUI/Gui.hpp:37)
#14 0040BAC8 main(argc=1, argv=0xcc34a8) (C:\Users\...\PROJECT\src\main.cpp:103)

I probably spent a couple of hours to find that it was because my project is a c++11 one while I built TGUI "normally".
I also spend some times to find how I can build TGUI using c++11. (If it can help someone, in cmake (using cmake gui), check "Advanced" and add "-std=c++11" (or any other option) to CMAKE_CXX_FLAGS).

However I still have a question:
SFML 2.0 packages are not built using c++11 (normally) but I use them without any problem in my c++11 project. So why, for TGUI, I need to build using c++11?


EDIT: Now I also remember that I had some problems with the font file: "Failed to add a new character to the font: the maximum texture size has been reached".
I tried to replace the font by an other version of DejaVuSans that I use in one project and it worked... Personally I don't understand why... I uploaded the working font if you are interested. The file is too big... Can you increase the max size, please? (compressed size is around 300KB)

Pages: [1]