当前位置: 首页>>代码示例>>C++>>正文


C++ FSlateRect::OffsetBy方法代码示例

本文整理汇总了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;

}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:54,代码来源:HittestGrid.cpp


注:本文中的FSlateRect::OffsetBy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。