76 lines
1.6 KiB
C++
76 lines
1.6 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
|
|
#include "SpellOverlay.h"
|
|
|
|
#include "Blueprint/WidgetBlueprintLibrary.h"
|
|
#include "Rendering/DrawElements.h"
|
|
|
|
int32
|
|
USpellOverlay::NativePaint(const FPaintArgs& Args,
|
|
const FGeometry& AllottedGeometry,
|
|
const FSlateRect& MyCullingRect,
|
|
FSlateWindowElementList& OutDrawElements,
|
|
const int32 LayerId,
|
|
const FWidgetStyle& InWidgetStyle,
|
|
const bool bParentEnabled) const
|
|
{
|
|
Super::NativePaint(
|
|
Args,
|
|
AllottedGeometry,
|
|
MyCullingRect,
|
|
OutDrawElements,
|
|
LayerId,
|
|
InWidgetStyle,
|
|
bParentEnabled
|
|
);
|
|
|
|
FPaintContext Context(
|
|
AllottedGeometry,
|
|
MyCullingRect,
|
|
OutDrawElements,
|
|
LayerId,
|
|
InWidgetStyle,
|
|
bParentEnabled
|
|
);
|
|
|
|
UWidgetBlueprintLibrary::DrawLines(
|
|
Context, SpellPoints,
|
|
this->SpellLineColor,
|
|
this->bAntiAlias,
|
|
this->SpellLineThickness
|
|
);
|
|
|
|
return LayerId + 1;
|
|
}
|
|
|
|
SIZE_T USpellOverlay::GetNumPoints() const
|
|
{
|
|
return this->SpellPoints.Num();
|
|
}
|
|
|
|
const FVector2D& USpellOverlay::GetLastPoint()
|
|
{
|
|
return this->SpellPoints.Last();
|
|
}
|
|
|
|
const TArray<FVector2D>* USpellOverlay::GetSpellPoints() const
|
|
{
|
|
return &this->SpellPoints;
|
|
}
|
|
|
|
const FVector2D& USpellOverlay::GetLastPoint(const FVector2D& CurrPoint)
|
|
{
|
|
return this->SpellPoints.Num() > 0 ? this->SpellPoints.Last() : CurrPoint;
|
|
}
|
|
|
|
void USpellOverlay::AddPoint(const FVector2D& Point)
|
|
{
|
|
this->SpellPoints.Add(Point);
|
|
}
|
|
|
|
void USpellOverlay::Clear()
|
|
{
|
|
this->SpellPoints.Empty();
|
|
}
|