Add support for custom background brush to Button
This commit is contained in:
@@ -71,6 +71,12 @@ namespace FlaxEngine.GUI
|
||||
/// </summary>
|
||||
public event Action<Button> ButtonClicked;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the brush used for background drawing.
|
||||
/// </summary>
|
||||
[EditorOrder(2000), Tooltip("The brush used for background drawing.")]
|
||||
public IBrush BackgroundBrush { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the border.
|
||||
/// </summary>
|
||||
@@ -206,7 +212,10 @@ namespace FlaxEngine.GUI
|
||||
}
|
||||
|
||||
// Draw background
|
||||
Render2D.FillRectangle(clientRect, backgroundColor);
|
||||
if (BackgroundBrush != null)
|
||||
BackgroundBrush.Draw(clientRect, backgroundColor);
|
||||
else
|
||||
Render2D.FillRectangle(clientRect, backgroundColor);
|
||||
Render2D.DrawRectangle(clientRect, borderColor);
|
||||
|
||||
// Draw text
|
||||
|
||||
Reference in New Issue
Block a user