Rounded borders for containers

Started by Xdesign, 15 November 2021, 18:55:08

Xdesign

I've noticed non of the containers have setRoundedBorderRadius() method. Thinking it wouldn't be hard to implement since button class already has it and would be essential to modern ways of ui design. Im a missing something or is it really not in tgui?

texus

#1
It's not in TGUI yet, but it indeed shouldn't be hard to add.

I didn't want to add rounded borders to all widgets because with the current design it would be a lot of copy-pasting work and requires changing each individual widget. The idea was to first redesign the widgets so that they are rendered with reusable components. Adding rounded borders then would immediately make it available for all widgets. But the redesign had some issues and was delayed.
Because all previous requests about rounded borders were about the button widget, I decided to add setRoundedBorderRadius to the button renderer to at least allow using it for the most common use case.

Do you only need it for the Panel widget?
Does it matter that the mouse events still treat the widget as a rectangle for now? (Because ignoring the mouse events when on the corners seems to be only implemented when using textures, even for the button widget)
Then I can quickly add that to TGUI.

Xdesign

Well its only design wise, so mouse event should still treat it as rect because it doesnt matter. It would be great to have atleast one container with rounded borders such as Panel. I think as well that not all container classes necessarily need to have it. Thanks in advance!

texus

The setRoundedBorderRadius function has been added to PanelRenderer in TGUI 0.9 and 0.10-dev.

I did notice one other limitation though. Since TGUI can only clip rectangles, widgets inside the panel can still be drawn outside the rounded corners (if you place a widget there).

The 0.10-dev downloads on the download page have been updated. If you don't use Visual Studio or want TGUI 0.9 then you will have to build TGUI yourself (with the source code from github).

Xdesign

#4
Thank you so much for implementing so fast!
I thought that could be a problem too.
I cant think of a solution is actually workable but im sure people will give ideas in future if they really mind it.
Anyway, its great for me! Thanks again  :D