AronaSlate/Source/Arona/UI/Widget/SUpdatableTexture.cpp
2024-01-25 11:21:15 +08:00

25 lines
779 B
C++

// Fill out your copyright notice in the Description page of Project Settings.
#include "SUpdatableTexture.h"
#include "SlateOptMacros.h"
BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
void SUpdatableTexture::Construct(const FArguments& InArgs)
{
Texture = InArgs._Texture;
}
int32 SUpdatableTexture::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const
{
if (!Texture.IsValid())
return LayerId;
FSlateDrawElement::MakeViewport(OutDrawElements, ++LayerId, AllottedGeometry.ToPaintGeometry(), Texture, ESlateDrawEffect::None, FLinearColor::White);
return LayerId;
}
END_SLATE_FUNCTION_BUILD_OPTIMIZATION