Function FRect.unify

Wraps SDL_UnionFRect which creates a dsdl.FRect (from SDL 2.0.22) of the minimum size to enclose two given dsdl.FRects

FRect unify (
  FRect other
) @trusted const;

Parameters

NameDescription
other other dsdl.FRect to unify with the dsdl.FRect

Returns

dsdl.FRect of the minimum size to enclose the dsdl.FRect and other

Example

auto rect1 = dsdl.FRect(-2.0, -2.0, 3.0, 3.0);
auto rect2 = dsdl.FRect(-1.0, -1.0, 3.0, 3.0);

assert(rect1.hasIntersection(rect2));
assert(rect1.intersectRect(rect2).get == dsdl.FRect(-1.0, -1.0, 2.0, 2.0));
}