I need to draw a filled triangle in the HUD. How can I do this without using a FSlateBrush?
I don’t think that’s really a Slate thing (I haven’t seen anything that even suggested primitive shapes, it’s not really that kind of system…), sounds like something you’d do with canvas in the HUD class itself. Getting the HUD stuff to talk to your Slate stuff shouldn’t be too hard.
It’s working. Thank you very much.
Just to clarify, you can use Slate to draw any kind of primitive geometry by overriding OnPaint
function inside your custom widget and using FSlateDrawElement::Make*()
method to draw whatever you want.
* can be “Box”, “Line”, “Text” etc… So if you want your widget to be displayed as a box you would do something like that:
int32 SMyCustomWidget::OnPaint( ARGS_HERE) const
{
FSlateDrawElement::MakeBox( ARGS_HERE );
}
to draw triangle you would use FSlateDrawElement::MakeCustom()
and pass points as parameters. So as you can see its definitely possible to draw primitives in Slate but its easier to make it in Canvas.
I think the use of ICustomSlateElement primitives correctly in this situation. Thank you.