Struct Point

D struct that wraps SDL_Point containing 2D integer coordinate pair

struct Point ;

dsdl2.Point stores signed integer x and y coordinate points. This wrapper also implements vector-like operator overloading.

Constructors

NameDescription
this (sdlPoint) Constructs a dsdl2.Point from a vanilla SDL_Point from bindbc-sdl
this (x, y) Constructs a dsdl2.Point by feeding in an x and y pair
this (xy) Constructs a dsdl2.Point by feeding in an array of x and y
this (fpoint) Constructs a dsdl2.Point from a dsdl2.FPoint (from SDL 2.0.10)

Fields

NameTypeDescription
sdlPoint sdl.rect.SDL_PointInternal SDL_Point struct

Properties

NameTypeDescription
array[get] inout(int[2])Static array proxy of the dsdl2.Point
x[get] inout(int)Proxy to the X value of the dsdl2.Point
y[get] inout(int)Proxy to the Y value of the dsdl2.Point

Methods

NameDescription
opBinary (other) Binary element-wise operation overload template
opBinary (scalar) Binary operation overload template with scalars
opOpAssign (other) Element-wise operator assignment overload
opOpAssign (scalar) Operator assignment overload with scalars
opUnary () Unary element-wise operation overload template
toString () Formats the dsdl2.Point into its construction representation: "dsdl2.Point(<x>, <y>)"

Example

auto a = dsdl2.Point(1, 2);
auto b = a + a;
assert(b == dsdl2.Point(2, 4));

auto c = a * 2;
assert(b == c);