Show / Hide Table of Contents

Struct Coord

A structure that represents a standard 2D grid coordinate. Provides numerous static functions, operators, and implicit converstions that enable common grid/position-related math and operations, as well as enable interoperability with position representations from other libraries.

Implements
System.IEquatable<Coord>
System.IEquatable<System.ValueTuple<System.Int32, System.Int32>>
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: GoRogue
Assembly: GoRogue.dll
Syntax
[Serializable]
public struct Coord : IEquatable<Coord>, IEquatable<(int x, int y)>
Remarks

Coord instances can be created using the standard Coord c = new Coord(x, y) syntax. In addition, you may create a coord from a c# 7 tuple, like Coord c = (x, y);. As well, Coord is implicitly convertible to position-based types from a few other supported libraries (like MonoGame), so you can even do things like Coord c = new Microsoft.Xna.Point(x, y);. As well, Coord supports C# Deconstrution syntax.

In addition to implicit tuple/custom type converters, Coord provides operators and static helper functions that perform common grid math/operations, as well as interoperability with other grid-based classes like Direction Generally speaking, operators also support interoperability with supported position representations from other libraries. Functions taking a Coord also take any other type which Coord implicitly converts to. Similarly, operator overloads are defined that support things like addition of Coord and supported types from other libraries. For example, since Coord c = myCoord + myCoord2; is valid, so is Coord c = myCoord + myMicrosoftXnaPoint and Microsoft.Xna.Point point = myMicrosftXnaPoint + myCoord;.

Coord is designed to be extremely efficient and interoperable with equivalent representations in other libraries, so in general, in an environment where you have multiple point representations floating around, it is best to prefer Coord where possible, as something that accepts or works with Coord will generally work with other supported types as well.

Constructors

| Improve this Doc View Source

Coord(Int32, Int32)

Constructor.

Declaration
public Coord(int x, int y)
Parameters
Type Name Description
System.Int32 x

X-value for the coordinate.

System.Int32 y

Y-value for the coordinate.

Fields

| Improve this Doc View Source

NONE

Coord value that represents None or no position (since Coord is not a nullable type). Typically you would use this constant instead of null.

Declaration
[NonSerialized]
public static readonly Coord NONE
Field Value
Type Description
Coord
Remarks

This constant has (x, y) values (int.MinValue, int.MinValue), so a coordinate with those x/y values is not considered a valid coordinate by many GoRogue functions.

| Improve this Doc View Source

X

X-value of the coordinate.

Declaration
public readonly int X
Field Value
Type Description
System.Int32
| Improve this Doc View Source

Y

Y-value of the coordinate.

Declaration
public readonly int Y
Field Value
Type Description
System.Int32

Methods

| Improve this Doc View Source

BearingOfLine(Coord)

Calculates the degree bearing of a line with the given delta-x and delta-y values, where 0 degreees points in the direction UP.

Declaration
public static double BearingOfLine(Coord deltaChange)
Parameters
Type Name Description
Coord deltaChange

Vector, where deltaChange.X is the change in x-values across the line, and deltaChange.Y is the change in y-values across the line.

Returns
Type Description
System.Double

The degree bearing of the line with the given dx and dy values.

| Improve this Doc View Source

BearingOfLine(Coord, Coord)

Calculates degree bearing of the line (start => end), where 0 points in the direction UP.

Declaration
public static double BearingOfLine(Coord start, Coord end)
Parameters
Type Name Description
Coord start

Position of line starting point.

Coord end

Position of line ending point.

Returns
Type Description
System.Double

The degree bearing of the line specified by the two given points.

| Improve this Doc View Source

BearingOfLine(Int32, Int32)

Calculates the degree bearing of a line with the given delta-x and delta-y values, where 0 degreees points in the direction UP.

Declaration
public static double BearingOfLine(int dx, int dy)
Parameters
Type Name Description
System.Int32 dx

The change in x-values across the line.

System.Int32 dy

the change in y-values across the line

Returns
Type Description
System.Double

The degree bearing of the line with the given dx and dy values.

| Improve this Doc View Source

BearingOfLine(Int32, Int32, Int32, Int32)

Calculates degree bearing of the line ((startX, startY) => (endX, endY)), where 0 points in the direction UP.

Declaration
public static double BearingOfLine(int startX, int startY, int endX, int endY)
Parameters
Type Name Description
System.Int32 startX

X-value of the position of line starting point.

System.Int32 startY

Y-value of the position of line starting point.

System.Int32 endX

X-value of the position of line ending point.

System.Int32 endY

Y-value of the position of line ending point.

Returns
Type Description
System.Double

The degree bearing of the line specified by the two given points.

| Improve this Doc View Source

Deconstruct(out Int32, out Int32)

Adds support for C# Deconstruction syntax.

Declaration
public void Deconstruct(out int x, out int y)
Parameters
Type Name Description
System.Int32 x
System.Int32 y
| Improve this Doc View Source

Equals(Coord)

True if the given coordinate has equal x and y values to the current one.

Declaration
public bool Equals(Coord other)
Parameters
Type Name Description
Coord other

Coordinate to compare.

Returns
Type Description
System.Boolean

True if the two coordinates are equal, false if not.

| Improve this Doc View Source

Equals(Object)

Same as operator == in this case; returns false if obj is not a Coord.

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj

The object to compare the current Coord to.

Returns
Type Description
System.Boolean

True if obj is a Coord instance, and the two coordinates are equal, false otherwise.

Overrides
System.ValueType.Equals(System.Object)
| Improve this Doc View Source

Equals((Int32 x, Int32 y))

True if the given position has equal x and y values to the current one.

Declaration
public bool Equals((int x, int y) other)
Parameters
Type Name Description
System.ValueTuple<System.Int32, System.Int32> other

Point to compare.

Returns
Type Description
System.Boolean

True if the two positions are equal, false if not.

| Improve this Doc View Source

EuclideanDistanceMagnitude(Coord)

Returns the result of the euclidean distance formula, without the square root, given the dx and dy values between two points -- eg., (deltaChange.X * deltaChange.X) + (deltaChange.Y

  • deltaChange.Y). Use this if you only care about the magnitude of the distance -- eg., if you're trying to compare two distances. Omitting the square root provides a speed increase.
Declaration
public static double EuclideanDistanceMagnitude(Coord deltaChange)
Parameters
Type Name Description
Coord deltaChange

Vector, where deltaChange.X is the change in x-values between the two points, and deltaChange.Y is the change in y-values between the two points.

Returns
Type Description
System.Double

The "magnitude" of the euclidean distance of two locations with the given dx and dy values -- basically the distance formula without the square root.

| Improve this Doc View Source

EuclideanDistanceMagnitude(Coord, Coord)

Returns the result of the euclidean distance formula, without the square root -- eg., (c2.X - c1.X) * (c2.X - c1.X) + (c2.Y - c1.Y) * (c2.Y - c1.Y). Use this if you only care about the magnitude of the distance -- eg., if you're trying to compare two distances. Omitting the square root provides a speed increase.

Declaration
public static double EuclideanDistanceMagnitude(Coord c1, Coord c2)
Parameters
Type Name Description
Coord c1

The first point.

Coord c2

The second point.

Returns
Type Description
System.Double

The "magnitude" of the euclidean distance between the two points -- basically the distance formula without the square root.

| Improve this Doc View Source

EuclideanDistanceMagnitude(Int32, Int32)

Returns the result of the euclidean distance formula, without the square root, given the dx and dy values between two points -- eg., (dx * dx) + (dy * dy). Use this if you only care about the magnitude of the distance -- eg., if you're trying to compare two distances. Omitting the square root provides a speed increase.

Declaration
public static double EuclideanDistanceMagnitude(int dx, int dy)
Parameters
Type Name Description
System.Int32 dx

The change in x-values between the two points.

System.Int32 dy

The change in y-values between the two points.

Returns
Type Description
System.Double

The "magnitude" of the euclidean distance of two locations with the given dx and dy values -- basically the distance formula without the square root.

| Improve this Doc View Source

EuclideanDistanceMagnitude(Int32, Int32, Int32, Int32)

Returns the result of the euclidean distance formula, without the square root -- eg., (x2

  • x1) * (x2 - x1) + (y2 - y1) * (y2 - y1). Use this if you only care about the magnitude of the distance -- eg., if you're trying to compare two distances. Omitting the square root provides a speed increase.
Declaration
public static double EuclideanDistanceMagnitude(int x1, int y1, int x2, int y2)
Parameters
Type Name Description
System.Int32 x1

The x-value of the first location.

System.Int32 y1

The y-value of the first location.

System.Int32 x2

The x-value of the second location.

System.Int32 y2

The y-value of the second location.

Returns
Type Description
System.Double

The "magnitude" of the euclidean distance between the two points -- basically the distance formula without the square root.

| Improve this Doc View Source

GetHashCode()

Returns a hash code for the Coord. The important parts: it should be fairly fast and it does not collide often.

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32

The hash-code for the Coord.

Overrides
System.ValueType.GetHashCode()
Remarks

This hashing algorithm uses a seperate bit-mixing algorithm for X and Y, with X and Y each multiplied by a differet large integer, then xors the mixed values, does a right shift, and finally multiplies by an overflowing prime number. This hashing algorithm should produce an exceptionally low collision rate for coordinates between (0, 0) and (255, 255).

| Improve this Doc View Source

Midpoint(Coord, Coord)

Returns the midpoint between the two points.

Declaration
public static Coord Midpoint(Coord c1, Coord c2)
Parameters
Type Name Description
Coord c1

The first point.

Coord c2

The second point.

Returns
Type Description
Coord

The midpoint between c1 and c2.

| Improve this Doc View Source

Midpoint(Int32, Int32, Int32, Int32)

Returns the midpoint between the two points.

Declaration
public static Coord Midpoint(int x1, int y1, int x2, int y2)
Parameters
Type Name Description
System.Int32 x1

The x-value of the first location.

System.Int32 y1

The y-value of the first location.

System.Int32 x2

The x-value of the second location.

System.Int32 y2

The y-value of the second location.

Returns
Type Description
Coord

The midpoint between the two points.

| Improve this Doc View Source

ToCoord(Int32, Int32)

Reverses the ToIndex functions, returning the position represented by a given index.

Declaration
public static Coord ToCoord(int index, int width)
Parameters
Type Name Description
System.Int32 index

The index in 1D form.

System.Int32 width

The width of the 2D array.

Returns
Type Description
Coord

The position represented by the 1D index given.

| Improve this Doc View Source

ToIndex(Int32)

Returns a value that can be used to uniquely index this location 1D array.

Declaration
public int ToIndex(int width)
Parameters
Type Name Description
System.Int32 width

The width of the 2D map/array this location is referring to -- used to do the math to calculate index.

Returns
Type Description
System.Int32

The 1D index of this Coord.

| Improve this Doc View Source

ToIndex(Int32, Int32, Int32)

Returns y * width + x.

Declaration
public static int ToIndex(int x, int y, int width)
Parameters
Type Name Description
System.Int32 x

X-value of the coordinate.

System.Int32 y

Y-value of the coordinate.

System.Int32 width

The width of the 2D array, used to do the math to calculate index.

Returns
Type Description
System.Int32

The 1D index of this Coord.

| Improve this Doc View Source

ToString()

Returns representation (X, Y).

Declaration
public override string ToString()
Returns
Type Description
System.String

String (X, Y)

Overrides
System.ValueType.ToString()
| Improve this Doc View Source

ToXValue(Int32, Int32)

Reverses the ToIndex functions, returning only the X-value for the given index.

Declaration
public static int ToXValue(int index, int width)
Parameters
Type Name Description
System.Int32 index

The index in 1D form.

System.Int32 width

The width of the 2D array.

Returns
Type Description
System.Int32

The X-value for the location represented by the given index.

| Improve this Doc View Source

ToYValue(Int32, Int32)

Reverses the ToIndex functions, returning only the Y-value for the given index.

Declaration
public static int ToYValue(int index, int width)
Parameters
Type Name Description
System.Int32 index

The index in 1D form.

System.Int32 width

The width of the 2D array.

Returns
Type Description
System.Int32

The Y-value for the location represented by the given index.

| Improve this Doc View Source

Translate(Coord)

Returns the coordinate resulting from adding dx to the X-value of the coordinate, and dy to the Y-value of the coordinate.

Declaration
public Coord Translate(Coord deltaChange)
Parameters
Type Name Description
Coord deltaChange

Vector where deltaChange.X represents the delta-x value and deltaChange.Y represents the delta-y value.

Returns
Type Description
Coord

The coordinate (X + deltaChange.X, Y + deltaChange.Y)

| Improve this Doc View Source

Translate(Int32, Int32)

Translates the coordinate by the given dx and dy values.

Declaration
public Coord Translate(int dx, int dy)
Parameters
Type Name Description
System.Int32 dx

Delta x to add to coordinate.

System.Int32 dy

Delta y to add to coordinate.

Returns
Type Description
Coord

The coordinate (X + dx, Y + dy)

Operators

| Improve this Doc View Source

Addition(Coord, Coord)

Returns the coordinate (c1.X + c2.X, c1.Y + c2.Y).

Declaration
public static Coord operator +(Coord c1, Coord c2)
Parameters
Type Name Description
Coord c1
Coord c2
Returns
Type Description
Coord

The coordinate (c1.X + c2.X, c1.Y + c2.Y)

| Improve this Doc View Source

Addition(Coord, Direction)

Translates the given coordinate by one unit in the given direction.

Declaration
public static Coord operator +(Coord c, Direction d)
Parameters
Type Name Description
Coord c
Direction d
Returns
Type Description
Coord

Coordinate (c.X + d.DeltaX, c.Y + d.DeltaY)

| Improve this Doc View Source

Addition(Coord, Point)

Adds the x and y values of a MonoGame Point to a Coord.

Declaration
public static Coord operator +(Coord c, Point p)
Parameters
Type Name Description
Coord c
Microsoft.Xna.Framework.Point p
Returns
Type Description
Coord

A Coord (c.X + p.X, c.Y + p.Y).

| Improve this Doc View Source

Addition(Coord, Point)

Adds the x and y values of a System.Drawing.Point to a Coord.

Declaration
public static Coord operator +(Coord c, Point p)
Parameters
Type Name Description
Coord c
System.Drawing.Point p
Returns
Type Description
Coord

A Coord (c.X + p.X, c.Y + p.Y).

| Improve this Doc View Source

Addition(Coord, Size)

Adds the x and y values of a System.Drawing.Size to a Coord.

Declaration
public static Coord operator +(Coord c, Size s)
Parameters
Type Name Description
Coord c
System.Drawing.Size s
Returns
Type Description
Coord

A Coord (c.X + s.Width, c.Y + s.Height).

| Improve this Doc View Source

Addition(Coord, Int32)

Adds scalar i to the x and y values of c.

Declaration
public static Coord operator +(Coord c, int i)
Parameters
Type Name Description
Coord c
System.Int32 i
Returns
Type Description
Coord

Coordinate (c.X + i, c.Y + i.

| Improve this Doc View Source

Addition(Coord, (Int32 x, Int32 y))

Adds the x and y values of a tuple of two integers to a Coord.

Declaration
public static Coord operator +(Coord c, (int x, int y) tuple)
Parameters
Type Name Description
Coord c
System.ValueTuple<System.Int32, System.Int32> tuple
Returns
Type Description
Coord

A Coord (c.X + tuple.x, c.Y + tuple.y).

| Improve this Doc View Source

Addition(Point, Coord)

Adds the x and y values of a Coord to a MonoGame Point.

Declaration
public static Point operator +(Point p, Coord c)
Parameters
Type Name Description
Microsoft.Xna.Framework.Point p
Coord c
Returns
Type Description
Microsoft.Xna.Framework.Point

A MonoGame Point (p.X + c.X, p.Y + c.Y).

| Improve this Doc View Source

Addition(Point, Coord)

Adds the x and y values of a Coord to a System.Drawing.Point.

Declaration
public static Point operator +(Point p, Coord c)
Parameters
Type Name Description
System.Drawing.Point p
Coord c
Returns
Type Description
System.Drawing.Point

A System.Drawing.Point (p.X + c.X, p.Y + c.Y).

| Improve this Doc View Source

Addition(PointF, Coord)

Adds the x and y values of a Coord to a System.Drawing.PointF.

Declaration
public static PointF operator +(PointF p, Coord c)
Parameters
Type Name Description
System.Drawing.PointF p
Coord c
Returns
Type Description
System.Drawing.PointF

A System.Drawing.PointF (p.X + c.X, p.Y + c.Y).

| Improve this Doc View Source

Addition(Size, Coord)

Adds the x and y values of a Coord to a System.Drawing.Size.

Declaration
public static Size operator +(Size s, Coord c)
Parameters
Type Name Description
System.Drawing.Size s
Coord c
Returns
Type Description
System.Drawing.Size

A System.Drawing.Size (s.Width + c.X, s.Height + c.Y).

| Improve this Doc View Source

Addition(SizeF, Coord)

Adds the x and y values of a Coord to a System.Drawing.SizeF.

Declaration
public static SizeF operator +(SizeF s, Coord c)
Parameters
Type Name Description
System.Drawing.SizeF s
Coord c
Returns
Type Description
System.Drawing.SizeF

A System.Drawing.SizeF (s.Width + c.X, s.Height + c.Y).

| Improve this Doc View Source

Addition((Int32 x, Int32 y), Coord)

Adds the x and y values of a Coord to the corresponding values of a tuple of two integers.

Declaration
public static (int x, int y) operator +((int x, int y) tuple, Coord c)
Parameters
Type Name Description
System.ValueTuple<System.Int32, System.Int32> tuple
Coord c
Returns
Type Description
System.ValueTuple<System.Int32, System.Int32>

A tuple (tuple.x + c.X, tuple.y + c.Y).

| Improve this Doc View Source

Division(Coord, Double)

Divides the x and y of c by i, rounding resulting values to the nearest integer.

Declaration
public static Coord operator /(Coord c, double i)
Parameters
Type Name Description
Coord c
System.Double i
Returns
Type Description
Coord

(c.X / i, c.Y / i), with the resulting values rounded to the nearest integer.

| Improve this Doc View Source

Division(Coord, Int32)

Divides the x and y of c by i, rounding resulting values to the nearest integer.

Declaration
public static Coord operator /(Coord c, int i)
Parameters
Type Name Description
Coord c
System.Int32 i
Returns
Type Description
Coord

(c.X / i, c.Y / i), with the resulting values rounded to the nearest integer.

| Improve this Doc View Source

Equality(Coord, Coord)

True if c1.X == c2.X and c1.Y == c2.Y.

Declaration
public static bool operator ==(Coord c1, Coord c2)
Parameters
Type Name Description
Coord c1
Coord c2
Returns
Type Description
System.Boolean

True if the two coordinates are equal, false if not.

| Improve this Doc View Source

Equality(Coord, Point)

True if the two point's X and Y values are equal.

Declaration
public static bool operator ==(Coord c1, Point p2)
Parameters
Type Name Description
Coord c1
Microsoft.Xna.Framework.Point p2
Returns
Type Description
System.Boolean

True if the two coordinates are equal, false if not.

| Improve this Doc View Source

Equality(Coord, Point)

True if the two point's X and Y values are equal.

Declaration
public static bool operator ==(Coord c1, Point p2)
Parameters
Type Name Description
Coord c1
System.Drawing.Point p2
Returns
Type Description
System.Boolean

True if the two coordinates are equal, false if not.

| Improve this Doc View Source

Equality(Coord, PointF)

True if the two point's X and Y values are equal.

Declaration
public static bool operator ==(Coord c1, PointF p2)
Parameters
Type Name Description
Coord c1
System.Drawing.PointF p2
Returns
Type Description
System.Boolean

True if the two coordinates are equal, false if not.

| Improve this Doc View Source

Equality(Coord, Size)

True if the point's x/y values equal the size's width/height values.

Declaration
public static bool operator ==(Coord c, Size size)
Parameters
Type Name Description
Coord c
System.Drawing.Size size
Returns
Type Description
System.Boolean

True if the given Coord and Size are equivalent, false if not.

| Improve this Doc View Source

Equality(Coord, SizeF)

True if the point's x/y values equal the size's width/height values.

Declaration
public static bool operator ==(Coord c, SizeF size)
Parameters
Type Name Description
Coord c
System.Drawing.SizeF size
Returns
Type Description
System.Boolean

True if the given Coord and SizeF are equivalent, false if not.

| Improve this Doc View Source

Equality(Coord, (Int32 x, Int32 y))

True if the two point's x and y values are equal.

Declaration
public static bool operator ==(Coord c, (int x, int y) tuple)
Parameters
Type Name Description
Coord c
System.ValueTuple<System.Int32, System.Int32> tuple
Returns
Type Description
System.Boolean

True if the two positions are equal, false if not.

| Improve this Doc View Source

Equality(Point, Coord)

True if the two point's X and Y values are equal.

Declaration
public static bool operator ==(Point p1, Coord c2)
Parameters
Type Name Description
Microsoft.Xna.Framework.Point p1
Coord c2
Returns
Type Description
System.Boolean

True if the two coordinates are equal, false if not.

| Improve this Doc View Source

Equality(Point, Coord)

True if the two point's X and Y values are equal.

Declaration
public static bool operator ==(Point p1, Coord c2)
Parameters
Type Name Description
System.Drawing.Point p1
Coord c2
Returns
Type Description
System.Boolean

True if the two coordinates are equal, false if not.

| Improve this Doc View Source

Equality(PointF, Coord)

True if the two point's X and Y values are equal.

Declaration
public static bool operator ==(PointF p1, Coord c2)
Parameters
Type Name Description
System.Drawing.PointF p1
Coord c2
Returns
Type Description
System.Boolean

True if the two coordinates are equal, false if not.

| Improve this Doc View Source

Equality(Size, Coord)

True if the size's width/height values equal the point's x/y values.

Declaration
public static bool operator ==(Size size, Coord c)
Parameters
Type Name Description
System.Drawing.Size size
Coord c
Returns
Type Description
System.Boolean

True if the given Size and Coord are equivalent, false if not.

| Improve this Doc View Source

Equality(SizeF, Coord)

True if the size's width/height values equal the point's x/y values.

Declaration
public static bool operator ==(SizeF size, Coord c)
Parameters
Type Name Description
System.Drawing.SizeF size
Coord c
Returns
Type Description
System.Boolean

True if the given SizeF and Coord are equivalent, false if not.

| Improve this Doc View Source

Equality((Int32 x, Int32 y), Coord)

True if the two point's x and y values are equal.

Declaration
public static bool operator ==((int x, int y) tuple, Coord c)
Parameters
Type Name Description
System.ValueTuple<System.Int32, System.Int32> tuple
Coord c
Returns
Type Description
System.Boolean

True if the two positions are equal, false if not.

| Improve this Doc View Source

Implicit(Coord to Point)

Implicitly converts a Coord to an equivalent MonoGame point.

Declaration
public static implicit operator Point(Coord c)
Parameters
Type Name Description
Coord c
Returns
Type Description
Microsoft.Xna.Framework.Point
| Improve this Doc View Source

Implicit(Coord to Point)

Implicitly converts a Coord to an equivalent System.Drawing.Point.

Declaration
public static implicit operator Point(Coord c)
Parameters
Type Name Description
Coord c
Returns
Type Description
System.Drawing.Point
| Improve this Doc View Source

Implicit(Coord to PointF)

Implicitly converts a Coord to an equivalent System.Drawing.PointF.

Declaration
public static implicit operator PointF(Coord c)
Parameters
Type Name Description
Coord c
Returns
Type Description
System.Drawing.PointF
| Improve this Doc View Source

Implicit(Coord to Size)

Implicitly converts a Coord to an equivalent System.Drawing.Size.

Declaration
public static implicit operator Size(Coord c)
Parameters
Type Name Description
Coord c
Returns
Type Description
System.Drawing.Size
| Improve this Doc View Source

Implicit(Coord to SizeF)

Implicitly converts a Coord to an equivalent System.Drawing.SizeF.

Declaration
public static implicit operator SizeF(Coord c)
Parameters
Type Name Description
Coord c
Returns
Type Description
System.Drawing.SizeF
| Improve this Doc View Source

Implicit(Coord to (Int32 x, Int32 y))

Implicitly converts a Coord to an equivalent tuple of two integers.

Declaration
public static implicit operator (int x, int y)(Coord c)
Parameters
Type Name Description
Coord c
Returns
Type Description
System.ValueTuple<System.Int32, System.Int32>
| Improve this Doc View Source

Implicit(Point to Coord)

Implicitly converts a MonoGame Point to an equivalent Coord.

Declaration
public static implicit operator Coord(Point p)
Parameters
Type Name Description
Microsoft.Xna.Framework.Point p
Returns
Type Description
Coord
| Improve this Doc View Source

Implicit(Point to Coord)

Implicitly converts a System.Drawing.Point to an equivalent Coord.

Declaration
public static implicit operator Coord(Point p)
Parameters
Type Name Description
System.Drawing.Point p
Returns
Type Description
Coord
| Improve this Doc View Source

Implicit(Size to Coord)

Implicitly converts a System.Drawing.Size to an equivalent Coord.

Declaration
public static implicit operator Coord(Size s)
Parameters
Type Name Description
System.Drawing.Size s
Returns
Type Description
Coord
| Improve this Doc View Source

Implicit((Int32 x, Int32 y) to Coord)

Implicitly converts a tuple of two integers to an equivalent Coord.

Declaration
public static implicit operator Coord((int x, int y) tuple)
Parameters
Type Name Description
System.ValueTuple<System.Int32, System.Int32> tuple
Returns
Type Description
Coord
| Improve this Doc View Source

Inequality(Coord, Coord)

True if either the x-values or y-values are not equal.

Declaration
public static bool operator !=(Coord c1, Coord c2)
Parameters
Type Name Description
Coord c1
Coord c2
Returns
Type Description
System.Boolean

True if either the x-values or y-values are not equal, false if they are both equal.

| Improve this Doc View Source

Inequality(Coord, Point)

True if either the x-values or y-values are not equal.

Declaration
public static bool operator !=(Coord c1, Point p2)
Parameters
Type Name Description
Coord c1
Microsoft.Xna.Framework.Point p2
Returns
Type Description
System.Boolean

True if either the x-values or y-values are not equal, false if they are both equal.

| Improve this Doc View Source

Inequality(Coord, Point)

True if either the x-values or y-values are not equal.

Declaration
public static bool operator !=(Coord c1, Point p2)
Parameters
Type Name Description
Coord c1
System.Drawing.Point p2
Returns
Type Description
System.Boolean

True if either the x-values or y-values are not equal, false if they are both equal.

| Improve this Doc View Source

Inequality(Coord, PointF)

True if either the x-values or y-values are not equal.

Declaration
public static bool operator !=(Coord c1, PointF p2)
Parameters
Type Name Description
Coord c1
System.Drawing.PointF p2
Returns
Type Description
System.Boolean

True if either the x-values or y-values are not equal, false if they are both equal.

| Improve this Doc View Source

Inequality(Coord, Size)

True if either the x/Width values or the y/Height values do not match.

Declaration
public static bool operator !=(Coord c, Size size)
Parameters
Type Name Description
Coord c
System.Drawing.Size size
Returns
Type Description
System.Boolean

True if either the x/Width values or the y/Height values are not equal, false if they are both equal.

| Improve this Doc View Source

Inequality(Coord, SizeF)

True if either the x/Width values or the y/Height values do not match.

Declaration
public static bool operator !=(Coord c, SizeF size)
Parameters
Type Name Description
Coord c
System.Drawing.SizeF size
Returns
Type Description
System.Boolean

True if either the x/Width values or the y/Height values are not equal, false if they are both equal.

| Improve this Doc View Source

Inequality(Coord, (Int32 x, Int32 y))

True if either the x-values or y-values are not equal.

Declaration
public static bool operator !=(Coord c, (int x, int y) tuple)
Parameters
Type Name Description
Coord c
System.ValueTuple<System.Int32, System.Int32> tuple
Returns
Type Description
System.Boolean

True if either the x-values or y-values are not equal, false if they are both equal.

| Improve this Doc View Source

Inequality(Point, Coord)

True if either the x-values or y-values are not equal.

Declaration
public static bool operator !=(Point p1, Coord c2)
Parameters
Type Name Description
Microsoft.Xna.Framework.Point p1
Coord c2
Returns
Type Description
System.Boolean

True if either the x-values or y-values are not equal, false if they are both equal.

| Improve this Doc View Source

Inequality(Point, Coord)

True if either the x-values or y-values are not equal.

Declaration
public static bool operator !=(Point p1, Coord c2)
Parameters
Type Name Description
System.Drawing.Point p1
Coord c2
Returns
Type Description
System.Boolean

True if either the x-values or y-values are not equal, false if they are both equal.

| Improve this Doc View Source

Inequality(PointF, Coord)

True if either the x-values or y-values are not equal.

Declaration
public static bool operator !=(PointF p1, Coord c2)
Parameters
Type Name Description
System.Drawing.PointF p1
Coord c2
Returns
Type Description
System.Boolean

True if either the x-values or y-values are not equal, false if they are both equal.

| Improve this Doc View Source

Inequality(Size, Coord)

True if either the Width/x values or the Height/y values do not match.

Declaration
public static bool operator !=(Size size, Coord c)
Parameters
Type Name Description
System.Drawing.Size size
Coord c
Returns
Type Description
System.Boolean

True if either the Width/x values or the Height/y values are not equal, false if they are both equal.

| Improve this Doc View Source

Inequality(SizeF, Coord)

True if either the Width/x values or the Height/y values do not match.

Declaration
public static bool operator !=(SizeF size, Coord c)
Parameters
Type Name Description
System.Drawing.SizeF size
Coord c
Returns
Type Description
System.Boolean

True if either the Width/x values or the Height/y values are not equal, false if they are both equal.

| Improve this Doc View Source

Inequality((Int32 x, Int32 y), Coord)

True if either the x-values or y-values are not equal.

Declaration
public static bool operator !=((int x, int y) tuple, Coord c)
Parameters
Type Name Description
System.ValueTuple<System.Int32, System.Int32> tuple
Coord c
Returns
Type Description
System.Boolean

True if either the x-values or y-values are not equal, false if they are both equal.

| Improve this Doc View Source

Multiply(Coord, Double)

Multiplies the x and y value of c by i, rounding the result to the nearest integer.

Declaration
public static Coord operator *(Coord c, double i)
Parameters
Type Name Description
Coord c
System.Double i
Returns
Type Description
Coord

Coordinate (c.X * i, c.Y * i), with the resulting values rounded to nearest integer.

| Improve this Doc View Source

Multiply(Coord, Int32)

Multiplies the x and y of c by i.

Declaration
public static Coord operator *(Coord c, int i)
Parameters
Type Name Description
Coord c
System.Int32 i
Returns
Type Description
Coord

Coordinate (c.X * i, c.Y * i)

| Improve this Doc View Source

Subtraction(Coord, Coord)

Returns the coordinate (c1.X - c2.X, c1.Y - c2.Y)

Declaration
public static Coord operator -(Coord c1, Coord c2)
Parameters
Type Name Description
Coord c1
Coord c2
Returns
Type Description
Coord

The coordinate(c1 - c2).

| Improve this Doc View Source

Subtraction(Coord, Direction)

Translates the given coordinate one unit in the opposite of the direction given.

Declaration
public static Coord operator -(Coord c, Direction d)
Parameters
Type Name Description
Coord c
Direction d
Returns
Type Description
Coord

Coordinate (c.X - d.DeltaX, c.Y - d.DeltaY)

| Improve this Doc View Source

Subtraction(Coord, Point)

Subtracts the x and y values of a MonoGame Point from a Coord.

Declaration
public static Coord operator -(Coord c, Point p)
Parameters
Type Name Description
Coord c
Microsoft.Xna.Framework.Point p
Returns
Type Description
Coord

A Coord (c.X - p.X, c.Y - p.Y).

| Improve this Doc View Source

Subtraction(Coord, Point)

Subtracts the x and y values of a System.Drawing.Point from a Coord.

Declaration
public static Coord operator -(Coord c, Point p)
Parameters
Type Name Description
Coord c
System.Drawing.Point p
Returns
Type Description
Coord

A Coord (c.X - p.X, c.Y - p.Y).

| Improve this Doc View Source

Subtraction(Coord, Size)

Subtracts the x and y values of a System.Drawing.Size from a Coord.

Declaration
public static Coord operator -(Coord c, Size s)
Parameters
Type Name Description
Coord c
System.Drawing.Size s
Returns
Type Description
Coord

A Coord (c.X - s.Width, c.Y - s.Height).

| Improve this Doc View Source

Subtraction(Coord, Int32)

Subtracts scalar i from the x and y values of c.

Declaration
public static Coord operator -(Coord c, int i)
Parameters
Type Name Description
Coord c
System.Int32 i
Returns
Type Description
Coord

The coordinate (c.X - i, c.Y - i)

| Improve this Doc View Source

Subtraction(Coord, (Int32 x, Int32 y))

Subtracts the x and y values of a tuple of two integers from a Coord.

Declaration
public static Coord operator -(Coord c, (int x, int y) tuple)
Parameters
Type Name Description
Coord c
System.ValueTuple<System.Int32, System.Int32> tuple
Returns
Type Description
Coord

A Coord (c.X - tuple.x, c.Y - tuple.y).

| Improve this Doc View Source

Subtraction(Point, Coord)

Subtracts the x and y values of a Coord from a MonoGame Point.

Declaration
public static Point operator -(Point p, Coord c)
Parameters
Type Name Description
Microsoft.Xna.Framework.Point p
Coord c
Returns
Type Description
Microsoft.Xna.Framework.Point

A MonoGame Point (p.X - c.X, p.Y - c.Y).

| Improve this Doc View Source

Subtraction(Point, Coord)

Subtracts the x and y values of a Coord from a System.Drawing.Point.

Declaration
public static Point operator -(Point p, Coord c)
Parameters
Type Name Description
System.Drawing.Point p
Coord c
Returns
Type Description
System.Drawing.Point

A System.Drawing.Point (p.X - c.X, p.Y - c.Y).

| Improve this Doc View Source

Subtraction(PointF, Coord)

Subtracts the x and y values of a Coord from a System.Drawing.PointF.

Declaration
public static PointF operator -(PointF p, Coord c)
Parameters
Type Name Description
System.Drawing.PointF p
Coord c
Returns
Type Description
System.Drawing.PointF

A System.Drawing.PointF (p.X - c.X, p.Y - c.Y).

| Improve this Doc View Source

Subtraction(Size, Coord)

Subtracts the x and y values of a Coord from a System.Drawing.Size.

Declaration
public static Size operator -(Size s, Coord c)
Parameters
Type Name Description
System.Drawing.Size s
Coord c
Returns
Type Description
System.Drawing.Size

A System.Drawing.Size (s.Width - c.X, s.Height - c.Y).

| Improve this Doc View Source

Subtraction(SizeF, Coord)

Subtracts the x and y values of a Coord from a System.Drawing.SizeF.

Declaration
public static SizeF operator -(SizeF s, Coord c)
Parameters
Type Name Description
System.Drawing.SizeF s
Coord c
Returns
Type Description
System.Drawing.SizeF

A System.Drawing.SizeF (s.Width - c.X, s.Height - c.Y).

| Improve this Doc View Source

Subtraction((Int32 x, Int32 y), Coord)

Subtracts the x and y values of a Coord from a tuple of two integers.

Declaration
public static (int x, int y) operator -((int x, int y) tuple, Coord c)
Parameters
Type Name Description
System.ValueTuple<System.Int32, System.Int32> tuple
Coord c
Returns
Type Description
System.ValueTuple<System.Int32, System.Int32>

A tuple (tuple.x - c.X, tuple.y - c.Y).

Implements

System.IEquatable<T>
System.IEquatable<T>

Extension Methods

Utility.Yield<T>(T)
  • Improve this Doc
  • View Source
Back to top Generated by DocFX