What do i need to know to use TGUI ?

  • 3 Replies
  • 263 Views
What do i need to know to use TGUI ?
« on: 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 ?
« Last Edit: 09 August 2021, 12:08:47 by 2ant »

*

texus

  • *****
  • 1631
    • View Profile
    • Texus's Blog
Re: What do i need to know to use TGUI ?
« Reply #1 on: 09 August 2021, 16:43:43 »
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?

Re: What do i need to know to use TGUI ?
« Reply #2 on: 09 August 2021, 17:42:28 »
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 !

Re: What do i need to know to use TGUI ?
« Reply #3 on: 10 August 2021, 09:56:37 »
As usual - just write code, don't be afraid to be mistaken and don't hesitate to ask.