What do i need to know to use TGUI ?

Started by 2ant, 09 August 2021, 11:38:52


Hello, i am trying to use tgui with opencv and sfml.

I managed to install them and i am now learning how to use them.

Since i'm a semi-beginner in c++, i don't know how to do some things but i want to learn.

for ex : I want to close the window when i click on a menu item.

I had trouble to write the hierarchy in menu->connectMenuItem("File","Exit",[&]{ window.close(); });

When i look at a documentation, some things are hard to get.

What do i need to learn to understand how to use tgui ?

I know i need at least to understand signals and lambda functions.

Can you tell me what other subjects i need to know about ?

Do you know any good sites or books ?


Understanding std::function and lambdas is useful for the signals in TGUI (since examples often use lambdas to keep the code shorter).
Understanding smart pointers (e.g. shared_ptr) is useful to work with TGUI widgets (since Widget::Ptr is just an alias for std::shared_ptr<Widget>).
Other than that, a basic understanding of c++ is required, but you might be able to learn it as you go.

The tutorials (https://tgui.eu/tutorials/0.9/) and example codes (https://tgui.eu/examples/0.9/) provide some useful information.

menu->connectMenuItem("File","Exit",[&]{ window.close(); }); should work fine. Do you have a case where it doesn't work?


Thank you for your answer and thank you for TGUI !!

menu->connectMenuItem("File","Exit",[&]{ window.close(); });  works fine but
when i first posted this i was decifering the doc ( connectMenuItem() [1/2] )
and then i looked at ( connectMenuItem() [2/2] )  and left the correct answer in the post.

If anyone has more advices, please share !


As usual - just write code, don't be afraid to be mistaken and don't hesitate to ask.