Table of Contents

Struct LayerPosition

Namespace
MLEM.Extended.Tiled
Assembly
MLEM.Extended.dll

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

layerName string

The layer name

x int

The x coordinate

y int

The y coordinate

Fields

Layer

The name of the layer that this position is on

[DataMember]
public string Layer

Field Value

string

X

The x coordinate of this position

[DataMember]
public int X

Field Value

int

Y

The y coordinate of this position

[DataMember]
public int Y

Field Value

int

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

left LayerPosition

The left position.

right LayerPosition

The 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

other LayerPosition

Returns

bool

true if obj and 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

obj object

The object to compare with the current instance.

Returns

bool

true if obj and 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

left LayerPosition

The left position.

right LayerPosition

The 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

left LayerPosition
right LayerPosition

Returns

bool

true if obj and 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

position LayerPosition

The 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

left LayerPosition
right LayerPosition

Returns

bool

true if obj and 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

left LayerPosition

The left position.

right LayerPosition

The 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

position LayerPosition

The position to negate.

Returns

LayerPosition

The negative position.