Struct FRect

D struct that wraps SDL_FRect (from SDL 2.0.10) representing a rectangle of floating point 2D coordinate and dimension

struct FRect ;

dsdl.FRect stores floating point x and y coordinate points, as well as width and height which specifies the rectangle's dimension. x and y symbolize the top-left coordinate of the rectangle, and the width and height extend to the positive plane of both axes.

Constructors

NameDescription
this (sdlFRect) Constructs a dsdl.FRect from a vanilla SDL_FRect from bindbc-sdl
this (x, y, width, height) Constructs a dsdl.FRect by feeding in the x, y, width, and height of the rectangle
this (point, width, height) Constructs a dsdl.FRect by feeding in a dsdl.FPoint as the xy, then width and height of the rectangle
this (rect) Constructs a dsdl.FRect from a dsdl.Rect

Fields

NameTypeDescription
sdlFRect sdl.rect.SDL_FRectInternal SDL_FRect struct

Properties

NameTypeDescription
height[get] inout(float)Proxy to the height of the dsdl.FRect
point[get] inout(FPoint)Proxy to the dsdl.FPoint containing the x and y value of the dsdl.FRect
size[get] inout(float[2])Proxy to the size array containing the width and height of the dsdl.FRect
width[get] inout(float)Proxy to the width of the dsdl.FRect
x[get] inout(float)Proxy to the X value of the dsdl.FRect
y[get] inout(float)Proxy to the Y value of the dsdl.FRect

Methods

NameDescription
empty () Wraps SDL_FRectEmpty (from SDL 2.0.22) which checks if the dsdl.FRect is an empty rectangle
hasIntersection (rect) Wraps SDL_HasIntersectionF (from SDL 2.0.22) which sees whether two dsdl.FRects intersect each other
hasLineIntersection (line) Wraps SDL_IntersectFRectAndLine (from SDL 2.0.22) which sees whether a line intersects with the dsdl.FRect
intersectLine (line) Wraps SDL_IntersectFRectAndLine (from SDL 2.0.22) which attempts to clip a line segment in the boundaries of the dsdl.FRect
intersectRect (other) Wraps SDL_IntersectFRect (from SDL 2.0.22) which attempts to get the rectangle of intersection between two dsdl.FRects
opBinary (offset) Binary operation overload template to move rectangle's position by an offset as a dsdl.FPoint
opOpAssign (offset) Operator assignment overload template to move rectangle's position in-place by an offset as a dsdl.FPoint
pointInRect (point) Wraps SDL_PointInFRect (from SDL 2.0.22) which sees whether the coordinate of a dsdl.FPoint is inside the dsdl.FRect
toString () Formats the dsdl.FRect into its construction representation: "dsdl.FRect(<x>, <y>, <w>, <h>)"
unify (other) Wraps SDL_UnionFRect which creates a dsdl.FRect (from SDL 2.0.22) of the minimum size to enclose two given dsdl.FRects