Function Rect.intersectLine

Wraps SDL_IntersectRectAndLine which attempts to clip a line segment in the boundaries of the dsdl2.Rect

std.typecons.Nullable!(dsdl2.rect.Point[2]) intersectLine (
  Point[2] line
) @trusted const;

Parameters

NameDescription
line set of two dsdl2.Points denoting the start and end coordinates of the line to clip from its intersection with the dsdl2.Rect

Returns

non-null Nullable!(Point[2]) as the clipped line if there is an intersection, otherwise a null one