/**
 * Renders stats using groups
 *
 * @param ViewData data from the stats thread
 * @param RI the render interface to draw with
 * @param X the X location to start rendering at
 * @param Y the Y location to start rendering at
 */
static void RenderGroupedWithHierarchy(const FGameThreadHudData& ViewData, class FCanvas* Canvas,int32 X,int32& Y)
{
	// Grab texture for rendering text background.
	UTexture2D* BackgroundTexture = UCanvas::StaticClass()->GetDefaultObject<UCanvas>()->DefaultTexture;

	// Render all groups.
	for( int32 GroupIndex = 0; GroupIndex < ViewData.HudGroups.Num(); ++GroupIndex )
	{
		const FHudGroup& HudGroup = ViewData.HudGroups[GroupIndex];

		// Render header.
		const FString& GroupDesc = ViewData.GroupDescriptions[GroupIndex];
		const FName& GroupName = ViewData.GroupNames[GroupIndex];
		const FString GroupLongName = FString::Printf( TEXT("%s [%s]"), *GroupDesc, *GroupName.GetPlainNameString() );
		Canvas->DrawShadowedString( X, Y, *GroupLongName, STAT_FONT, StatGlobals.GroupColor );
		Y += FONT_HEIGHT;

		const bool bHasHierarchy = !!HudGroup.HierAggregate.Num();
		const bool bHasFlat = !!HudGroup.FlatAggregate.Num();

		if (bHasHierarchy || bHasFlat)
		{
		// Render grouped headings.
		Y += RenderGroupedHeadings( Canvas, X, Y, bHasHierarchy );
		}

		// Render hierarchy.
		if( bHasHierarchy )
		{
			RenderHierCycles( Canvas, X, Y, HudGroup );
			Y += FONT_HEIGHT;
		}

		// Render flat.
		if( bHasFlat )
		{
			RenderArrayOfStats(Canvas,X,Y,HudGroup.FlatAggregate, ViewData, RenderFlatCycle);
			Y += FONT_HEIGHT;
		}

		// Render memory counters.
		if( HudGroup.MemoryAggregate.Num() )
		{
			Y += RenderMemoryHeadings(Canvas,X,Y);
			RenderArrayOfStats(Canvas,X,Y,HudGroup.MemoryAggregate, ViewData, RenderMemoryCounter);
			Y += FONT_HEIGHT;
		}

		// Render remaining counters.
		if( HudGroup.CountersAggregate.Num() )
		{
			Y += RenderCounterHeadings(Canvas,X,Y);
			RenderArrayOfStats(Canvas,X,Y,HudGroup.CountersAggregate, ViewData, RenderCounter);
			Y += FONT_HEIGHT;
		}
	}
}
Exemple #2
0
/**
 * Renders stats using groups
 *
 * @param ViewData data from the stats thread
 * @param RI the render interface to draw with
 * @param X the X location to start rendering at
 * @param Y the Y location to start rendering at
 */
static void RenderGroupedWithHierarchy(const FGameThreadHudData& ViewData, FViewport* Viewport, class FCanvas* Canvas, int32 X, int32& Y)
{
	// Grab texture for rendering text background.
	UTexture2D* BackgroundTexture = UCanvas::StaticClass()->GetDefaultObject<UCanvas>()->DefaultTexture;

	// Render all groups.
	for( int32 GroupIndex = 0; GroupIndex < ViewData.HudGroups.Num(); ++GroupIndex )
	{
		// If the stat isn't enabled for this particular viewport, skip
		FString StatGroupName = ViewData.GroupNames[GroupIndex].ToString();
		StatGroupName.RemoveFromStart(TEXT("STATGROUP_"));
		if (!Viewport->GetClient() || !Viewport->GetClient()->IsStatEnabled(StatGroupName))
		{
			continue;
		}

		// Render header.
		const FName& GroupName = ViewData.GroupNames[GroupIndex];
		const FString& GroupDesc = ViewData.GroupDescriptions[GroupIndex];
		const FString GroupLongName = FString::Printf( TEXT("%s [%s]"), *GroupDesc, *GroupName.GetPlainNameString() );
		Canvas->DrawShadowedString( X, Y, *GroupLongName, GetStatRenderGlobals().StatFont, GetStatRenderGlobals().GroupColor );
		Y += GetStatRenderGlobals().GetFontHeight();

		const FHudGroup& HudGroup = ViewData.HudGroups[GroupIndex];
		const bool bHasHierarchy = !!HudGroup.HierAggregate.Num();
		const bool bHasFlat = !!HudGroup.FlatAggregate.Num();

		if (bHasHierarchy || bHasFlat)
		{
			// Render grouped headings.
			Y += RenderGroupedHeadings( Canvas, X, Y, bHasHierarchy );
		}

		// Render hierarchy.
		if( bHasHierarchy )
		{
			RenderHierCycles( Canvas, X, Y, HudGroup );
			Y += GetStatRenderGlobals().GetFontHeight();
		}

		// Render flat.
		if( bHasFlat )
		{
			RenderArrayOfStats(Canvas,X,Y,HudGroup.FlatAggregate, ViewData, RenderFlatCycle);
			Y += GetStatRenderGlobals().GetFontHeight();
		}

		// Render memory counters.
		if( HudGroup.MemoryAggregate.Num() )
		{
			Y += RenderMemoryHeadings(Canvas,X,Y);
			RenderArrayOfStats(Canvas,X,Y,HudGroup.MemoryAggregate, ViewData, RenderMemoryCounter);
			Y += GetStatRenderGlobals().GetFontHeight();
		}

		// Render remaining counters.
		if( HudGroup.CountersAggregate.Num() )
		{
			Y += RenderCounterHeadings(Canvas,X,Y);
			RenderArrayOfStats(Canvas,X,Y,HudGroup.CountersAggregate, ViewData, RenderCounter);
			Y += GetStatRenderGlobals().GetFontHeight();
		}
	}
}