Struct LayerPositionF
A struct that represents a position on a MonoGame.Extended.Tiled.TiledMap with multiple layers, where the X and Y coordinates are 32-bit floating point numbers. See LayerPosition for an integer position.
[DataContract]
public struct LayerPositionF : IEquatable<LayerPositionF>
- Implements
- Inherited Members
Constructors
LayerPositionF(string, float, float)
Creates a new layer position with the given settings
public LayerPositionF(string layerName, float x, float 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 float X
Field Value
Y
The y coordinate of this position
[DataMember]
public float Y
Field Value
Methods
Add(LayerPositionF, LayerPositionF)
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 LayerPositionF Add(LayerPositionF left, LayerPositionF right)
Parameters
leftLayerPositionFThe left position.
rightLayerPositionFThe right position.
Returns
- LayerPositionF
The sum of the positions.
Exceptions
- ArgumentException
Thrown if the two positions' Layer are not the same.
Equals(LayerPositionF)
Indicates whether this instance and a specified object are equal.
public bool Equals(LayerPositionF other)
Parameters
otherLayerPositionF
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 +(LayerPositionF, LayerPositionF)
Returns the sum of the two layer positions using Add(LayerPositionF, LayerPositionF).
public static LayerPositionF operator +(LayerPositionF left, LayerPositionF right)
Parameters
leftLayerPositionFThe left position.
rightLayerPositionFThe right position.
Returns
- LayerPositionF
The sum of the positions.
operator ==(LayerPositionF, LayerPositionF)
Indicates whether this instance and a specified object are equal.
public static bool operator ==(LayerPositionF left, LayerPositionF right)
Parameters
leftLayerPositionFrightLayerPositionF
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
implicit operator LayerPosition(LayerPositionF)
Implicitly converts a LayerPositionF to a LayerPosition. The coordinates are typecast to 32-bit integers in the process.
public static implicit operator LayerPosition(LayerPositionF position)
Parameters
positionLayerPositionFThe position to convert.
Returns
- LayerPosition
The converted position.
operator !=(LayerPositionF, LayerPositionF)
Indicates whether this instance and a specified object are equal.
public static bool operator !=(LayerPositionF left, LayerPositionF right)
Parameters
leftLayerPositionFrightLayerPositionF
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
operator -(LayerPositionF, LayerPositionF)
Subtracts the second from the first position using Add(LayerPositionF, LayerPositionF).
public static LayerPositionF operator -(LayerPositionF left, LayerPositionF right)
Parameters
leftLayerPositionFThe left position.
rightLayerPositionFThe right position.
Returns
- LayerPositionF
The difference of the positions.
operator -(LayerPositionF)
Returns the negative of the given layer position.
public static LayerPositionF operator -(LayerPositionF position)
Parameters
positionLayerPositionFThe position to negate.
Returns
- LayerPositionF
The negative position.