Table of Contents

Struct Point

Namespace
Microsoft.Xna.Framework
Assembly
MonoGame.Framework.dll

Describes a 2D-point.

[DataContract]
public struct Point : IEquatable<Point>
Implements
Inherited Members

Constructors

Point(int)

Constructs a point with X and Y set to the same value.

public Point(int value)

Parameters

value int

The x and y coordinates in 2d-space.

Point(int, int)

Constructs a point with X and Y from two values.

public Point(int x, int y)

Parameters

x int

The x coordinate in 2d-space.

y int

The y coordinate in 2d-space.

Fields

X

The x coordinate of this Point.

[DataMember]
public int X

Field Value

int

Y

The y coordinate of this Point.

[DataMember]
public int Y

Field Value

int

Properties

Zero

Returns a Point with coordinates 0, 0.

public static Point Zero { get; }

Property Value

Point

Methods

Deconstruct(out int, out int)

Deconstruction method for Point.

public void Deconstruct(out int x, out int y)

Parameters

x int
y int

Equals(Point)

Compares whether current instance is equal to specified Point.

public bool Equals(Point other)

Parameters

other Point

The Point to compare.

Returns

bool

true if the instances are equal; false otherwise.

Equals(object)

Compares whether current instance is equal to specified object.

public override bool Equals(object obj)

Parameters

obj object

The object to compare.

Returns

bool

true if the instances are equal; false otherwise.

GetHashCode()

Gets the hash code of this Point.

public override int GetHashCode()

Returns

int

Hash code of this Point.

ToString()

Returns a string representation of this Point in the format: {X:[X] Y:[Y]}

public override string ToString()

Returns

string

string representation of this Point.

ToVector2()

Gets a Vector2 representation for this object.

public Vector2 ToVector2()

Returns

Vector2

A Vector2 representation for this object.

Operators

operator +(Point, Point)

Adds two points.

public static Point operator +(Point value1, Point value2)

Parameters

value1 Point

Source Point on the left of the add sign.

value2 Point

Source Point on the right of the add sign.

Returns

Point

Sum of the points.

operator /(Point, Point)

Divides the components of a Point by the components of another Point.

public static Point operator /(Point source, Point divisor)

Parameters

source Point

Source Point on the left of the div sign.

divisor Point

Divisor Point on the right of the div sign.

Returns

Point

The result of dividing the points.

operator ==(Point, Point)

Compares whether two Point instances are equal.

public static bool operator ==(Point a, Point b)

Parameters

a Point

Point instance on the left of the equal sign.

b Point

Point instance on the right of the equal sign.

Returns

bool

true if the instances are equal; false otherwise.

operator !=(Point, Point)

Compares whether two Point instances are not equal.

public static bool operator !=(Point a, Point b)

Parameters

a Point

Point instance on the left of the not equal sign.

b Point

Point instance on the right of the not equal sign.

Returns

bool

true if the instances are not equal; false otherwise.

operator *(Point, Point)

Multiplies the components of two points by each other.

public static Point operator *(Point value1, Point value2)

Parameters

value1 Point

Source Point on the left of the mul sign.

value2 Point

Source Point on the right of the mul sign.

Returns

Point

Result of the multiplication.

operator -(Point, Point)

Subtracts a Point from a Point.

public static Point operator -(Point value1, Point value2)

Parameters

value1 Point

Source Point on the left of the sub sign.

value2 Point

Source Point on the right of the sub sign.

Returns

Point

Result of the subtraction.