本文整理汇总了C++中UPaperFlipbook::GetTotalDuration方法的典型用法代码示例。如果您正苦于以下问题:C++ UPaperFlipbook::GetTotalDuration方法的具体用法?C++ UPaperFlipbook::GetTotalDuration怎么用?C++ UPaperFlipbook::GetTotalDuration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UPaperFlipbook
的用法示例。
在下文中一共展示了UPaperFlipbook::GetTotalDuration方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnPaint
int32 SFlipbookTimeline::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const
{
LayerId = SCompoundWidget::OnPaint(Args, AllottedGeometry, MyClippingRect, OutDrawElements, LayerId, InWidgetStyle, bParentEnabled);
const float CurrentTimeSecs = PlayTime.Get();
UPaperFlipbook* Flipbook = FlipbookBeingEdited.Get();
const float TotalTimeSecs = (Flipbook != nullptr) ? Flipbook->GetTotalDuration() : 0.0f;
const int32 TotalNumFrames = (Flipbook != nullptr) ? Flipbook->GetNumFrames() : 0;
const float SlateTotalDistance = SlateUnitsPerFrame * TotalNumFrames;
const float CurrentTimeXPos = (CurrentTimeSecs / TotalTimeSecs) * SlateTotalDistance;
// Draw a line for the current scrub cursor
++LayerId;
TArray<FVector2D> LinePoints;
LinePoints.Add(FVector2D(CurrentTimeXPos, 0.f));
LinePoints.Add(FVector2D(CurrentTimeXPos, AllottedGeometry.Size.Y));
FSlateDrawElement::MakeLines(
OutDrawElements,
LayerId,
AllottedGeometry.ToPaintGeometry(),
LinePoints,
MyClippingRect,
ESlateDrawEffect::None,
FLinearColor::Red
);
return LayerId;
}