WTools

Overview

WTools.h provides convenience macros for configuring FSlateBrush properties on UMG widgets. They set the resource texture, image size, tint color and outline color in a single call.

Macros

Name Description
CDRYX_SET_BRUSH Sets resource object, image size, tint and outline color on a raw FSlateBrush
CDRYX_SET_UBUTTON_BRUSH Sets a brush on a specific UButton style state (Normal, Hovered, Pressed, Disabled)
CDRYX_SET_UIMAGE_BRUSH Sets a brush on a UImage widget
// CDRYX_SET_BRUSH(slateBrush, image, size, tint, outlineColor)
// Operates directly on an FSlateBrush reference.
FSlateBrush brush;
CDRYX_SET_BRUSH(brush, myTexture, FVector2D(64, 64), FLinearColor::White, FLinearColor::Black)

// CDRYX_SET_UBUTTON_BRUSH(btn, STYLE, image, size, tint, outlineColor)
// STYLE is one of: Normal, Hovered, Pressed, Disabled.
CDRYX_SET_UBUTTON_BRUSH(myButton, Normal, myTexture, FVector2D(64, 64), FLinearColor(0.5, 0.5, 0.5, 0.5), FLinearColor::White)
CDRYX_SET_UBUTTON_BRUSH(myButton, Hovered, myTexture, FVector2D(64, 64), FLinearColor::White, FLinearColor::White)
CDRYX_SET_UBUTTON_BRUSH(myButton, Pressed, myTexture, FVector2D(64, 64), FLinearColor::Red, FLinearColor::White)
CDRYX_SET_UBUTTON_BRUSH(myButton, Disabled, myTexture, FVector2D(64, 64), FLinearColor(0.25, 0.25, 0.25, 0.5), FLinearColor::Black)

// CDRYX_SET_UIMAGE_BRUSH(img, image, size, tint, outlineColor)
// Operates on a UImage* widget.
CDRYX_SET_UIMAGE_BRUSH(myImage, myTexture, FVector2D(myTexture->GetSizeX(), myTexture->GetSizeY()), FLinearColor::White, FLinearColor::White)