Table of Contents

Class VectorPointExtensions

Namespace
MonoEight.Core
Assembly
MonoEight.Template.dll

Provides extension methods for converting between Microsoft.Xna.Framework.Vector2 and Microsoft.Xna.Framework.Point.

public static class VectorPointExtensions
Inheritance
VectorPointExtensions
Inherited Members

Methods

Cast(Vector2)

Snaps a Microsoft.Xna.Framework.Vector2 to the nearest integer coordinates while keeping it as a Microsoft.Xna.Framework.Vector2.

public static Vector2 Cast(this Vector2 vector)

Parameters

vector Vector2

The source vector.

Returns

Vector2

A Microsoft.Xna.Framework.Vector2 with integer values.

Remarks

Effectively performs new Vector2((int)x, (int)y).

Float(Point)

Converts a Microsoft.Xna.Framework.Point to a Microsoft.Xna.Framework.Vector2.

public static Vector2 Float(this Point vector)

Parameters

vector Point

The source point.

Returns

Vector2

A Microsoft.Xna.Framework.Vector2 with the same coordinates.

Int(Vector2)

Converts a Microsoft.Xna.Framework.Vector2 to a Microsoft.Xna.Framework.Point by casting the components to integers.

public static Point Int(this Vector2 vector)

Parameters

vector Vector2

The source vector.

Returns

Point

A Microsoft.Xna.Framework.Point with integer coordinates.

Remarks

This operation truncates decimal values.