void FBehaviorTreeConnectionDrawingPolicy::Internal_DrawLineWithArrow(const FVector2D& StartAnchorPoint, const FVector2D& EndAnchorPoint, const FLinearColor& WireColor, float WireThickness, bool bDrawBubbles) { //@TODO: Should this be scaled by zoom factor? const float LineSeparationAmount = 4.5f; const FVector2D DeltaPos = EndAnchorPoint - StartAnchorPoint; const FVector2D UnitDelta = DeltaPos.SafeNormal(); const FVector2D Normal = FVector2D(DeltaPos.Y, -DeltaPos.X).SafeNormal(); // Come up with the final start/end points const FVector2D DirectionBias = Normal * LineSeparationAmount; const FVector2D LengthBias = ArrowRadius.X * UnitDelta; const FVector2D StartPoint = StartAnchorPoint + DirectionBias + LengthBias; const FVector2D EndPoint = EndAnchorPoint + DirectionBias - LengthBias; // Draw a line/spline DrawConnection(WireLayerID, StartPoint, EndPoint, WireColor, WireThickness, bDrawBubbles); // Draw the arrow const FVector2D ArrowDrawPos = EndPoint - ArrowRadius; const float AngleInRadians = FMath::Atan2(DeltaPos.Y, DeltaPos.X); FSlateDrawElement::MakeRotatedBox( DrawElementsList, ArrowLayerID, FPaintGeometry(ArrowDrawPos, ArrowImage->ImageSize * ZoomFactor, ZoomFactor), ArrowImage, ClippingRect, ESlateDrawEffect::None, AngleInRadians, TOptional<FVector2D>(), FSlateDrawElement::RelativeToElement, WireColor ); }
void FConnectionDrawingPolicy::DrawSplineWithArrow(const FVector2D& StartPoint, const FVector2D& EndPoint, const FLinearColor& WireColor, float WireThickness, bool bDrawBubbles, bool Bidirectional) { // Draw the spline DrawConnection( WireLayerID, StartPoint, EndPoint, WireColor, WireThickness, bDrawBubbles); // Draw the arrow if (ArrowImage != nullptr) { FVector2D ArrowPoint = EndPoint - ArrowRadius; FSlateDrawElement::MakeBox( DrawElementsList, ArrowLayerID, FPaintGeometry(ArrowPoint, ArrowImage->ImageSize * ZoomFactor, ZoomFactor), ArrowImage, ClippingRect, ESlateDrawEffect::None, WireColor ); } }
void FConnectionDrawingPolicy::DrawSplineWithArrow(const FVector2D& StartPoint, const FVector2D& EndPoint, const FConnectionParams& Params) { // Draw the spline DrawConnection( WireLayerID, StartPoint, EndPoint, Params); // Draw the arrow if (ArrowImage != nullptr) { FVector2D ArrowPoint = EndPoint - ArrowRadius; FSlateDrawElement::MakeBox( DrawElementsList, ArrowLayerID, FPaintGeometry(ArrowPoint, ArrowImage->ImageSize * ZoomFactor, ZoomFactor), ArrowImage, ClippingRect, ESlateDrawEffect::None, Params.WireColor ); } }
void Connection::DrawConnection(wxDC& dc) { if (InputShape && OutputShape) { float Zoom = InputShape->GetCanvas() ? InputShape->GetCanvas()->GetZoom() : 1; wxPoint pos1 = InputShape->GetInputPos(InputId); wxPoint pos2 = OutputShape->GetOutputPos(OutputId); DrawConnection(dc,pos1,pos2); } }
DrawMaze(short drawdots) { short i; DisplaySprites(FALSE); SetRast(rastport,0); #if 0 if (maxx+border >= width || maxy+border >= height) return -1; /* Error: Too big */ #endif if (maxx+border >= 1023 || maxy+border >= 1023) return -1; /* Error: Too big */ SetDrMd(rastport,JAM1); if (drawdots==DOTS_EXCLUDED) /* Called from construction set */ { if (!((mazestatus&GRAPH_LOADED)&&(mazestatus&VARS_LOADED))) return 0; SetRast(rastport,0); SetMazeColors(); } BoxScreen(); SetAPen(rastport,OUTLINECOLOR); mazedraw=1; /* Draw all of the edges */ MazeDraw1(v_head); MazeDraw1(center_box); MazeDraw1(ghost_start); for(i=0;i<4;i++) MazeDraw1(box_side[i]); MazeDraw1(top_box); SetAPen(rastport,PATHCOLOR); mazedraw=0; /* Clear the pathways */ MazeDraw1(v_head); MazeDraw1(center_box); MazeDraw1(ghost_start); for(i=0;i<4;i++) MazeDraw1(box_side[i]); MazeDraw1(top_box); SetAPen(rastport,DOTCOLOR); numdots=0; DotDraw2(v_head); if(drawdots==DOTS_EXCLUDED) { WireFrameDraw(v_head); if (linedrawn) { DrawConnection(sv,olddir); linedrawn=!linedrawn; /* Nullify the effect within DrawConn... */ } } DisplaySprites(sprites_on); #if MYDEBUG printf("View->DxOffset=%d \tScreen->LeftEdge=%d\n", curr_View->DxOffset,PlayScreen->LeftEdge); #endif return 1; /* 1 signals main module that maze was drawn successfully */ }