Point

D struct that wraps SDL_Point containing 2D integer coordinate pair

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

Constructors

this
this()
Undocumented in source.
this
this(SDL_Point sdlPoint)

Constructs a dsdl2.Point from a vanilla SDL_Point from bindbc-sdl

this
this(int x, int y)

Constructs a dsdl2.Point by feeding in an x and y pair

this
this(int[2] xy)

Constructs a dsdl2.Point by feeding in an array of x and y

this
this(FPoint fpoint)

Constructs a dsdl2.Point from a dsdl2.FPoint (from SDL 2.0.10)

Members

Functions

array
inout(int[2]) array()

Static array proxy of the dsdl2.Point

opBinary
Point opBinary(Point other)

Binary element-wise operation overload template

opBinary
Point opBinary(int scalar)

Binary operation overload template with scalars

opOpAssign
inout(Point) opOpAssign(Point other)

Element-wise operator assignment overload

opOpAssign
inout(Point) opOpAssign(int scalar)

Operator assignment overload with scalars

opUnary
Point opUnary()

Unary element-wise operation overload template

toString
string toString()

Formats the dsdl2.Point into its construction representation: "dsdl2.Point(<x>, <y>)"

x
inout(int) x()

Proxy to the X value of the dsdl2.Point

y
inout(int) y()

Proxy to the Y value of the dsdl2.Point

Variables

sdlPoint
SDL_Point sdlPoint;

Internal SDL_Point struct

Examples

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

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

Meta