Main Menu

Recent posts

#31
General Discussion / Re: Just discovered TGUI recen...
Last post by Bluemoon - 04 January 2025, 20:23:48
Seconded. I've spent a lot of time looking for decent GUI dev options for my C++/SDL2 project, and none of them have really ticked all the boxes. TGUI looks fantastic - the builder is going to see a lot of use!
#32
Help requests / Re: Dynamic image support for ...
Last post by byronhaochen - 03 January 2025, 04:44:18
Quote from: texus on 31 December 2024, 11:58:49Animated textures are not supported directly.

You would have to load each frame into a texture and then call the getRenderer()->setTexture() function with a different texture each time you want to update the visible frame.
thank you
#33
Help requests / Re: Dynamic image support for ...
Last post by texus - 31 December 2024, 11:58:49
Animated textures are not supported directly.

You would have to load each frame into a texture and then call the getRenderer()->setTexture() function with a different texture each time you want to update the visible frame.
#34
Help requests / Re: Dynamic image support for ...
Last post by byronhaochen - 31 December 2024, 11:35:14
Similar to GIF...
#35
Help requests / Re: Dynamic image support for ...
Last post by texus - 31 December 2024, 10:45:55
What do you mean with "dynamic image support"? Just changing the texture?

You can change the texture in the widget renderer:
Code (cpp) Select
picture->getRenderer()->setTexture("image.png");
#36
Help requests / Dynamic image support for Butt...
Last post by byronhaochen - 31 December 2024, 09:49:14
Hi, how to implement dynamic image support for button and picture? :)
#37
Help requests / Re: Custom childWindow not fu...
Last post by byronhaochen - 26 December 2024, 10:03:37
Thanks! :)
#38
Help requests / Re: Custom childWindow not fu...
Last post by texus - 26 December 2024, 08:38:10
The theme doesn't contain a section for your custom widget, so the BackgroundColor and TitleBarColor in the renderer are never set. No value is apparently transparent here.

In your constructor code you have 'getRendererNoThrow(m_type)', I guess if you change it to 'getRendererNoThrow("ChildWindow")' then it would load correctly.

Alternatively, the Theme class has a few static functions to allow specifying relationships between widgets. I'm guessing you need 'tgui::Theme::addRendererInheritanceParent("YourCustomWidgetName", "ChildWindow");' somewhere before creating the widget to tell the Theme to fall back to the "ChildWindow" section for your custom widget type if no more specific section exists.
#39
Help requests / Custom childWindow not fully ...
Last post by byronhaochen - 26 December 2024, 06:43:17
I use childWindow as the base class to make a custom widget, but the background becomes invisible after drawing. What is the reason for this?  :)
2024-12-26 13-32-29-76.jpg
NewProjectWindow::NewProjectWindow(const char* typeName, bool initRenderer) :
ChildWindow(typeName, false)
{
if (initRenderer)
{
m_renderer = aurora::makeCopied<NewProjectWindowRenderer>();
setRenderer(Theme::getDefault()->getRendererNoThrow(m_type));
}
setTitleButtons(ChildWindow::TitleButton::None);
setTextSize(getGlobalTextSize());

setClientSize({ 450, 350 });
init();
}

#40
Help requests / Re: Combobox with many many it...
Last post by texus - 20 December 2024, 10:57:52
Do you need to assign an id to each item (i.e. second parameter of addItem function)? If not then you can use "addMultipleItems" (added in TGUI 1.6) to add all items at once.

For changing an item, are you using changeItem? That function has to loop through all items to find a matching string, changeItemByIndex is much faster if you know the index of the item that needs to be changed.

I'm not sure if a combo box with so many items is a user-friendly UI design though.