Table of Contents

Struct TextureRegion

Namespace
BSGameLib.Game.Textures
Assembly
BSGameLib.Game.dll

A named rectangle within a texture, in pixels.

public readonly struct TextureRegion
Inherited Members

Constructors

TextureRegion(int, int, int, int)

Creates an unnamed region.

public TextureRegion(int x, int y, int width, int height)

Parameters

x int
y int
width int
height int

TextureRegion(int, int, Vector2)

Creates an unnamed region of size, with the size truncated to whole pixels.

public TextureRegion(int x, int y, Vector2 size)

Parameters

x int
y int
size Vector2

TextureRegion(Vector2, int, int)

Creates an unnamed region at position, with the position truncated to whole pixels.

public TextureRegion(Vector2 position, int width, int height)

Parameters

position Vector2
width int
height int

TextureRegion(Vector2, Vector2)

Creates an unnamed region at position of size, both truncated to whole pixels.

public TextureRegion(Vector2 position, Vector2 size)

Parameters

position Vector2
size Vector2

TextureRegion(string, int, int, int, int)

Creates a region named name.

public TextureRegion(string name, int x, int y, int width, int height)

Parameters

name string
x int
y int
width int
height int

TextureRegion(string, int, int, Vector2)

Creates a region named name of size, with the size truncated to whole pixels.

public TextureRegion(string name, int x, int y, Vector2 size)

Parameters

name string
x int
y int
size Vector2

TextureRegion(string, Vector2, int, int)

Creates a region named name at position, with the position truncated to whole pixels.

public TextureRegion(string name, Vector2 position, int width, int height)

Parameters

name string
position Vector2
width int
height int

TextureRegion(string, Vector2, Vector2)

Creates a region named name at position of size, both truncated to whole pixels.

public TextureRegion(string name, Vector2 position, Vector2 size)

Parameters

name string
position Vector2
size Vector2

Properties

Bounds

The region as a Rectangle.

public Rectangle Bounds { get; }

Property Value

Rectangle

Height

The height.

public int Height { get; }

Property Value

int

Name

The name of the region. Empty when the region is unnamed.

public string Name { get; }

Property Value

string

Position

The top left corner, (X, Y).

public Vector2 Position { get; }

Property Value

Vector2

Size

The width and height, as a vector.

public Vector2 Size { get; }

Property Value

Vector2

Width

The width.

public int Width { get; }

Property Value

int

X

The x coordinate of the left edge.

public int X { get; }

Property Value

int

Y

The y coordinate of the top edge.

public int Y { get; }

Property Value

int

Operators

implicit operator Rectangle(TextureRegion)

Converts the region to its Rectangle bounds.

public static implicit operator Rectangle(TextureRegion region)

Parameters

region TextureRegion

Returns

Rectangle