本文整理汇总了C++中FSlateRect::OffsetBy方法的典型用法代码示例。如果您正苦于以下问题:C++ FSlateRect::OffsetBy方法的具体用法?C++ FSlateRect::OffsetBy怎么用?C++ FSlateRect::OffsetBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FSlateRect
的用法示例。
在下文中一共展示了FSlateRect::OffsetBy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InsertWidget
int32 FHittestGrid::InsertWidget( const int32 ParentHittestIndex, const EVisibility& Visibility, const FArrangedWidget& Widget, const FVector2D InWindowOffset, const FSlateRect& InClippingRect )
{
check( ParentHittestIndex < WidgetsCachedThisFrame->Num() );
// Update the FGeometry to transform into desktop space.
FArrangedWidget WindowAdjustedWidget(Widget);
WindowAdjustedWidget.Geometry.AppendTransform(FSlateLayoutTransform(InWindowOffset));
const FSlateRect WindowAdjustedRect = InClippingRect.OffsetBy(InWindowOffset);
// Remember this widget, its geometry, and its place in the logical hierarchy.
const int32 WidgetIndex = WidgetsCachedThisFrame->Add( FCachedWidget( ParentHittestIndex, WindowAdjustedWidget, WindowAdjustedRect ) );
check( WidgetIndex < WidgetsCachedThisFrame->Num() );
if (ParentHittestIndex != INDEX_NONE)
{
(*WidgetsCachedThisFrame)[ParentHittestIndex].AddChild( WidgetIndex );
}
if (Visibility.IsHitTestVisible())
{
// Mark any cell that is overlapped by this widget.
// Compute the render space clipping rect, and compute it's aligned bounds so we can insert conservatively into the hit test grid.
FSlateRect GridRelativeBoundingClipRect =
TransformRect(
Concatenate(
Inverse(WindowAdjustedWidget.Geometry.GetAccumulatedLayoutTransform()),
WindowAdjustedWidget.Geometry.GetAccumulatedRenderTransform()
),
FSlateRotatedRect(WindowAdjustedWidget.Geometry.GetClippingRect().IntersectionWith(WindowAdjustedRect))
)
.ToBoundingRect()
.OffsetBy(-GridOrigin);
// Starting and ending cells covered by this widget.
const FIntPoint UpperLeftCell = FIntPoint(
FMath::Max(0, FMath::FloorToInt(GridRelativeBoundingClipRect.Left / CellSize.X)),
FMath::Max(0, FMath::FloorToInt(GridRelativeBoundingClipRect.Top / CellSize.Y)));
const FIntPoint LowerRightCell = FIntPoint(
FMath::Min( NumCells.X-1, FMath::FloorToInt(GridRelativeBoundingClipRect.Right / CellSize.X)),
FMath::Min( NumCells.Y-1, FMath::FloorToInt(GridRelativeBoundingClipRect.Bottom / CellSize.Y)));
for (int32 XIndex=UpperLeftCell.X; XIndex <= LowerRightCell.X; ++ XIndex )
{
for(int32 YIndex=UpperLeftCell.Y; YIndex <= LowerRightCell.Y; ++YIndex)
{
CellAt(XIndex, YIndex).CachedWidgetIndexes.Add( WidgetIndex );
}
}
}
return WidgetIndex;
}