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

32 lines
949 B
C++

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "SLeafWidget.h"
#include "Render/UpdatableTexture.h"
/**
*
*/
class ARONA_API SUpdatableTexture : public SLeafWidget
{
public:
SLATE_BEGIN_ARGS(SUpdatableTexture)
{}
SLATE_ARGUMENT(TSharedPtr<FUpdatableTexture>, Texture)
SLATE_END_ARGS()
/** Constructs this widget with InArgs */
void Construct(const FArguments& InArgs);
virtual FVector2D ComputeDesiredSize(float LayoutScaleMultiplier) const override { return Texture->GetSize(); }
virtual int32 OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const override;
TSharedPtr<FUpdatableTexture> GetTexture() const { return Texture; }
private:
TSharedPtr<FUpdatableTexture> Texture;
};