// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "CoreMinimal.h" #include "SCompoundWidget.h" #include "SlateInvalidationRoot.h" #include "SLeafWidget.h" #include "Render/UpdatableTexture.h" #include "Misc/CallRateLimiter.h" class SUpdatableImage; class FUpdatableTexture; class FSlateUpdatableTexture; /** * */ class ARONA_API SUpdatableImage : public SLeafWidget { friend class FUpdatableTexture; public: SUpdatableImage(); SLATE_BEGIN_ARGS(SUpdatableImage): _UpdateInterval(0.1f), _FixedWidth(), _FixedHeight() {} SLATE_EVENT(FUpdatableImageDataEvent, OnPostResize) SLATE_ARGUMENT(float, UpdateInterval) SLATE_ARGUMENT(TOptional, FixedWidth) SLATE_ARGUMENT(TOptional, FixedHeight) SLATE_ARGUMENT(TOptional, MaxWidth) SLATE_ARGUMENT(TOptional, MaxHeight) SLATE_END_ARGS() /** Constructs this widget with InArgs */ void Construct(const FArguments& InArgs); void NeedRedraw(); void Resize(FIntPoint NewSize, bool Immediate = false); virtual int32 OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const override; virtual FVector2D ComputeDesiredSize(float LayoutScaleMultiplier) const override { return FVector2D(LastSize); } TOptional FixedWidth; TOptional FixedHeight; TOptional MaxWidth; TOptional MaxHeight; private: void AsyncUpdate() const; mutable FVector2f LastSize; TSharedPtr Texture; mutable bool ForceRedraw = false; };