Skip to content

Tileset

namespace Griff.Scenes;
public sealed class Tileset

One of a tilemap’s tilesets (see Tilesets): Image cut into Columns by Rows tiles, numbered from First along each row, top row first. Without an image its tiles are squares of the map’s tint.

public int Columns { get; init; }
public int Count { get; }

How many tiles it has.

public int End { get; }

One past its last tile’s number.

public int First { get; init; }
public string? Image { get; init; }
public string Name { get; }

Its image’s file name without the folder or extension (“props”), or “Tiles” without an image.

public int Rows { get; init; }
public bool Contains(int tile)

True if tile is one of its own tiles.

public void Deconstruct(out string? Image, out int Columns, out int Rows, out int First)
public override bool Equals(object? obj)
public bool Equals(Tileset? other)
public override int GetHashCode()
public static Tileset? Parse(string? line, int first)

Reads a line of MoreTilesets, “Tiles/props.png 4x4”, as a tileset whose tiles start at first; null for a blank line. Without its tiles across and down, it’s one tile.

public Vector4 Rect(int tile)

The part of Image showing tile, as (u, v, width, height) in 0–1 image space. Numbers outside its tiles wrap round them.

public string ToLine()

The line Parse reads back, as MoreTilesets holds it: “Tiles/props.png 4x4”.

public override string ToString()