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
Inherited Members
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 SourceCoord(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 SourceNONE
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.
X
X-value of the coordinate.
Declaration
public readonly int X
Field Value
| Type | Description |
|---|---|
| System.Int32 |
Y
Y-value of the coordinate.
Declaration
public readonly int Y
Field Value
| Type | Description |
|---|---|
| System.Int32 |
Methods
| Improve this Doc View SourceBearingOfLine(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. |
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. |
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. |
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. |
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 |
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. |
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 |
Overrides
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. |
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. |
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. |
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. |
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. |
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
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).
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 |
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. |
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. |
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. |
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. |
ToString()
Returns representation (X, Y).
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String | String (X, Y) |
Overrides
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. |
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. |
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 |
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 |
Operators
| Improve this Doc View SourceAddition(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) |
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) |
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). |
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). |
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). |
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 + |
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). |
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). |
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). |
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). |
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). |
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). |
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). |
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 / |
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 / |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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 |
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 |
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 |
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 |
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 |
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> |
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 |
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 |
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 |
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 |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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 * |
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 * |
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( |
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) |
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). |
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). |
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). |
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 - |
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). |
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). |
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). |
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). |
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). |
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). |
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). |