Struct LayerPosition
A struct that represents a position on a MonoGame.Extended.Tiled.TiledMap with multiple layers, where the X and Y coordinates are 32-bit integer numbers. See LayerPositionF for a floating point position.
[DataContract]
public struct LayerPosition : IEquatable<LayerPosition>
- Implements
- Inherited Members
Constructors
LayerPosition(string, int, int)
Creates a new layer position with the given settings
public LayerPosition(string layerName, int x, int y)
Parameters
Fields
Layer
The name of the layer that this position is on
[DataMember]
public string Layer
Field Value
X
The x coordinate of this position
[DataMember]
public int X
Field Value
Y
The y coordinate of this position
[DataMember]
public int Y
Field Value
Methods
Add(LayerPosition, LayerPosition)
Adds the given layer positions together, returning a new layer position with the sum of their coordinates. If the two layer positions' Layer differ, an ArgumentException is thrown.
public static LayerPosition Add(LayerPosition left, LayerPosition right)
Parameters
leftLayerPositionThe left position.
rightLayerPositionThe right position.
Returns
- LayerPosition
The sum of the positions.
Exceptions
- ArgumentException
Thrown if the two positions' Layer are not the same.
Equals(LayerPosition)
Indicates whether this instance and a specified object are equal.
public bool Equals(LayerPosition other)
Parameters
otherLayerPosition
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
Equals(object)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
Operators
operator +(LayerPosition, LayerPosition)
Returns the sum of the two layer positions using Add(LayerPosition, LayerPosition).
public static LayerPosition operator +(LayerPosition left, LayerPosition right)
Parameters
leftLayerPositionThe left position.
rightLayerPositionThe right position.
Returns
- LayerPosition
The sum of the positions.
operator ==(LayerPosition, LayerPosition)
Indicates whether this instance and a specified object are equal.
public static bool operator ==(LayerPosition left, LayerPosition right)
Parameters
leftLayerPositionrightLayerPosition
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
implicit operator LayerPositionF(LayerPosition)
Implicitly converts a LayerPosition to a LayerPositionF.
public static implicit operator LayerPositionF(LayerPosition position)
Parameters
positionLayerPositionThe position to convert.
Returns
- LayerPositionF
The converted position.
operator !=(LayerPosition, LayerPosition)
Indicates whether this instance and a specified object are equal.
public static bool operator !=(LayerPosition left, LayerPosition right)
Parameters
leftLayerPositionrightLayerPosition
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
operator -(LayerPosition, LayerPosition)
Subtracts the second from the first position using Add(LayerPosition, LayerPosition).
public static LayerPosition operator -(LayerPosition left, LayerPosition right)
Parameters
leftLayerPositionThe left position.
rightLayerPositionThe right position.
Returns
- LayerPosition
The difference of the positions.
operator -(LayerPosition)
Returns the negative of the given layer position.
public static LayerPosition operator -(LayerPosition position)
Parameters
positionLayerPositionThe position to negate.
Returns
- LayerPosition
The negative position.