bool GUIRadarLayout::Update(CommonDeclarations::RadarObjectsArray &array) { if (!Active) return false; unsigned i=0; Ogre::Quaternion players_orientation = CommonDeclarations::GetPlayer()->GetOrientation().Inverse(); for (i=0;i<array.Size && array.Data[i].x<CommonDeclarations::MaxDistForRadar;++i) { DrawPos(i, array.Data[i], players_orientation); } for (;i<array.Size;++i) { Rows.Data[i]->setVisible(false); Objects.Data[i]->setVisible(false); } if (TargetType!=CTT_NONE) { DrawCompas(players_orientation); } return true; }
int32 STrackNode::OnPaint(const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const { // We draw ourselves on all of the AllottedGeometry. The parent STrack should have arranged us FPaintGeometry MyGeometry = AllottedGeometry.ToPaintGeometry(); FVector2D DrawPos(0.f, 0.f); FVector2D DrawSize = AllottedGeometry.Size; LastSize = DrawSize; // HACK: Fixme. Need to save this off in case we are drag/dropped // Background FLinearColor DrawColor = (IsSelected() ? SelectedNodeColor.Get() : NodeColor.Get()); const FSlateBrush* StyleInfo = FEditorStyle::GetBrush("ProgressBar.Background"); // FIXME: make slate argument for STrackNode FSlateDrawElement::MakeBox( OutDrawElements, LayerId++, MyGeometry, StyleInfo, MyClippingRect, ESlateDrawEffect::None, DrawColor); // Text if (!NodeName.Get().IsEmpty()) { MyGeometry = AllottedGeometry.ToPaintGeometry( DrawPos + FVector2D(2, 2), DrawSize ); FSlateDrawElement::MakeText( OutDrawElements, LayerId++, MyGeometry, NodeName.Get(), Font, MyClippingRect, ESlateDrawEffect::None, FLinearColor::Black//FLinearColor::White// ); } return LayerId; }
void FCanvasTextItem::Draw( class FCanvas* InCanvas ) { SCOPE_CYCLE_COUNTER(STAT_Canvas_TextItemTime); if(Font == NULL || Text.IsEmpty() ) { return; } XScale = Scale.X; YScale = Scale.Y; bool bHasShadow = ShadowOffset.Size() != 0.0f; if( ( FontRenderInfo.bEnableShadow == true ) && ( bHasShadow == false ) ) { EnableShadow( FLinearColor::Black ); bHasShadow = true; } if (Font->ImportOptions.bUseDistanceFieldAlpha) { // convert blend mode to distance field type switch(BlendMode) { case SE_BLEND_Translucent: BlendMode = (FontRenderInfo.bEnableShadow) ? SE_BLEND_TranslucentDistanceFieldShadowed : SE_BLEND_TranslucentDistanceField; break; case SE_BLEND_Masked: BlendMode = (FontRenderInfo.bEnableShadow) ? SE_BLEND_MaskedDistanceFieldShadowed : SE_BLEND_MaskedDistanceField; break; } // Disable the show if the blend mode is not suitable if (BlendMode != SE_BLEND_TranslucentDistanceFieldShadowed && BlendMode != SE_BLEND_MaskedDistanceFieldShadowed) { bHasShadow = false; } } CharIncrement = ( (float)Font->Kerning + HorizSpacingAdjust ) * Scale.X; DrawnSize.Y = Font->GetMaxCharHeight() * Scale.Y; FVector2D DrawPos( Position.X , Position.Y ); // If we are centering the string or we want to fix stereoscopic rending issues we need to measure the string if( ( bCentreX || bCentreY ) || ( !bDontCorrectStereoscopic ) ) { FTextSizingParameters Parameters( Font, Scale.X ,Scale.Y ); UCanvas::CanvasStringSize( Parameters, *Text.ToString() ); // Calculate the offset if we are centering if( bCentreX || bCentreY ) { // Note we drop the fraction after the length divide or we can end up with coords on 1/2 pixel boundaries if( bCentreX ) { DrawPos.X = DrawPos.X - (int)( Parameters.DrawXL / 2 ); } if( bCentreY ) { DrawPos.Y = DrawPos.Y - (int)( Parameters.DrawYL / 2 ); } } // Check if we want to correct the stereo3d issues - if we do, render the correction now bool CorrectStereo = !bDontCorrectStereoscopic && GEngine->IsStereoscopic3D(); if( CorrectStereo ) { FVector2D StereoOutlineBoxSize( 2.0f, 2.0f ); TileItem.MaterialRenderProxy = GEngine->RemoveSurfaceMaterial->GetRenderProxy( false ); TileItem.Position = DrawPos - StereoOutlineBoxSize; FVector2D CorrectionSize = FVector2D( Parameters.DrawXL, Parameters.DrawYL ) + StereoOutlineBoxSize + StereoOutlineBoxSize; TileItem.Size= CorrectionSize; TileItem.bFreezeTime = true; TileItem.Draw( InCanvas ); } } FLinearColor DrawColor; BatchedElements = NULL; TextLen = Text.ToString().Len(); if( bOutlined ) { DrawColor = OutlineColor; DrawColor.A *= InCanvas->AlphaModulate; DrawStringInternal( InCanvas, DrawPos + FVector2D( -1.0f, -1.0f ), DrawColor ); DrawStringInternal( InCanvas, DrawPos + FVector2D( -1.0f, 1.0f ), DrawColor ); DrawStringInternal( InCanvas, DrawPos + FVector2D( 1.0f, 1.0f ), DrawColor ); DrawStringInternal( InCanvas, DrawPos + FVector2D( 1.0f, -1.0f ), DrawColor ); } // If we have a shadow - draw it now if( bHasShadow ) { DrawColor = ShadowColor; // Copy the Alpha from the shadow otherwise if we fade the text the shadow wont fade - which is almost certainly not what we will want. DrawColor.A = Color.A; DrawColor.A *= InCanvas->AlphaModulate; DrawStringInternal( InCanvas, DrawPos + ShadowOffset, DrawColor ); } DrawColor = Color; DrawColor.A *= InCanvas->AlphaModulate; DrawStringInternal( InCanvas, DrawPos, DrawColor ); return; }