Table of Contents

Struct Point

Namespace
BSGameLib.Game.Drawing
Assembly
BSGameLib.Game.dll

An X and Y position, as whole numbers.

public struct Point : IEquatable<Point>
Implements
Inherited Members

Constructors

Point(Point)

Creates a copy of point.

public Point(Point point)

Parameters

point Point

Point(int, int)

Creates a point at (x, y).

public Point(int x, int y)

Parameters

x int
y int

Point((int x, int y))

Creates a point from a tuple.

public Point((int x, int y) tuple)

Parameters

tuple (int Width, int Height)

Fields

Down

The point (0, 1), one step down.

public static readonly Point Down

Field Value

Point

Empty

The point (0, 0), the same as Zero.

public static readonly Point Empty

Field Value

Point

Left

The point (-1, 0), one step left.

public static readonly Point Left

Field Value

Point

One

The point (1, 1).

public static readonly Point One

Field Value

Point

Right

The point (1, 0), one step right.

public static readonly Point Right

Field Value

Point

Up

The point (0, -1). Y grows downwards, so this is one step up.

public static readonly Point Up

Field Value

Point

Zero

The origin, (0, 0).

public static readonly Point Zero

Field Value

Point

Properties

X

The horizontal coordinate.

public int X { readonly get; set; }

Property Value

int

Y

The vertical coordinate.

public int Y { readonly get; set; }

Property Value

int

Methods

Equals(Point)

Whether other has the same coordinates.

public readonly bool Equals(Point other)

Parameters

other Point

Returns

bool

Equals(object)

Whether obj is a Point with the same coordinates.

public override readonly bool Equals(object obj)

Parameters

obj object

Returns

bool

GetHashCode()

Returns a hash code based on the coordinates, consistent with Equals(object).

public override readonly int GetHashCode()

Returns

int

ToString()

Returns the point as (X, Y).

public override string ToString()

Returns

string

Operators

operator +(Point, Point)

Adds the coordinates of the two points.

public static Point operator +(Point left, Point right)

Parameters

left Point
right Point

Returns

Point

operator ==(Point, Point)

Whether the two points have the same coordinates.

public static bool operator ==(Point left, Point right)

Parameters

left Point
right Point

Returns

bool

implicit operator Vector2(Point)

Converts to a Vector2 with the same coordinates.

public static implicit operator Vector2(Point point)

Parameters

point Point

Returns

Vector2

implicit operator (double x, double y)(Point)

Converts a point to a tuple.

public static implicit operator (double x, double y)(Point point)

Parameters

point Point

Returns

(double x, double y)

implicit operator (int x, int y)(Point)

Converts a point to a tuple.

public static implicit operator (int x, int y)(Point point)

Parameters

point Point

Returns

(int Width, int Height)

implicit operator (long x, long y)(Point)

Converts a point to a tuple.

public static implicit operator (long x, long y)(Point point)

Parameters

point Point

Returns

(long x, long y)

implicit operator (float x, float y)(Point)

Converts a point to a tuple.

public static implicit operator (float x, float y)(Point point)

Parameters

point Point

Returns

(float x, float y)

implicit operator Point(Vector2)

Converts a vector to a point, truncating each coordinate toward zero.

public static implicit operator Point(Vector2 vector)

Parameters

vector Vector2

Returns

Point

implicit operator Point((double x, double y))

Converts a tuple to a point, truncating each coordinate toward zero.

public static implicit operator Point((double x, double y) tuple)

Parameters

tuple (double x, double y)

Returns

Point

implicit operator Point((int x, int y))

Converts a tuple to a point.

public static implicit operator Point((int x, int y) tuple)

Parameters

tuple (int Width, int Height)

Returns

Point

implicit operator Point((long x, long y))

Converts a tuple to a point. Each coordinate is cast to int, so a value outside the int range wraps.

public static implicit operator Point((long x, long y) tuple)

Parameters

tuple (long x, long y)

Returns

Point

implicit operator Point((float x, float y))

Converts a tuple to a point, truncating each coordinate toward zero.

public static implicit operator Point((float x, float y) tuple)

Parameters

tuple (float x, float y)

Returns

Point

operator !=(Point, Point)

Whether the two points differ in either coordinate.

public static bool operator !=(Point left, Point right)

Parameters

left Point
right Point

Returns

bool

operator -(Point, Point)

Subtracts the coordinates of right from those of left.

public static Point operator -(Point left, Point right)

Parameters

left Point
right Point

Returns

Point

operator -(Point)

The point with both coordinates negated.

public static Point operator -(Point point)

Parameters

point Point

Returns

Point