Code viewer
[HUD] Drawing a Rotated Mask Region
#Code
For HUD developers, this helper function allows you to create mask regions rotated about their center point.
/** * Helper function to facilitate drawing rotated mask regions. * This mask region is drawn from the top left, and it will be rotated about its center. * X, Y - Top Left coordinates * XL, YL - Width and Height of the Mask region * Yaw - Rotation to apply to the mask region * * NOTE: Remember to call H.Canvas.PopMaskRegion() when you're done! */ function PushRotatedMaskRegion(HUD H, float X, float Y, float XL, float YL, float Yaw) { local Vector CenterPos; local Rotator RegionRotation; CenterPos.X = X + (XL * 0.5); CenterPos.Y = Y + (YL * 0.5); RegionRotation.Yaw = Yaw; H.Canvas.PushTranslationMatrix(CenterPos); H.Canvas.PushRotationMatrix(RegionRotation); H.Canvas.PushTranslationMatrix(CenterPos * -1); H.Canvas.PushMaskRegion(X, Y, XL, YL); H.Canvas.PopTransform(); H.Canvas.PopTransform(); H.Canvas.PopTransform(); }