Popcorning Guinea Pig
Search Results for

    Show / Hide Table of Contents

    Class Tileset

    Represents a tileset containing tiles from a texture atlas. Manages texture coordinates and tile properties.

    Inheritance
    object
    Tileset
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: PopcorningGuineaPig.Engine.Gameplay
    Assembly: PopcorningGuineaPig.Engine.dll
    Syntax
    public class Tileset

    Constructors

    | Edit this page View Source

    Tileset(string, int, int, int, int, int)

    Creates a new tileset with the specified properties.

    Declaration
    public Tileset(string name, int firstGid, int tileWidth, int tileHeight, int tileCount, int columns)
    Parameters
    Type Name Description
    string name

    Tileset name

    int firstGid

    First global ID

    int tileWidth

    Width of each tile

    int tileHeight

    Height of each tile

    int tileCount

    Total number of tiles

    int columns

    Number of columns in the texture

    Properties

    | Edit this page View Source

    Columns

    Declaration
    public int Columns { get; set; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    FirstGid

    Declaration
    public int FirstGid { get; set; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    ImagePath

    Declaration
    public string ImagePath { get; set; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    IsTextureLoaded

    Declaration
    public bool IsTextureLoaded { get; set; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    Name

    Declaration
    public string Name { get; set; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    Properties

    Declaration
    public Dictionary<string, string> Properties { get; set; }
    Property Value
    Type Description
    Dictionary<string, string>
    | Edit this page View Source

    Texture

    Declaration
    public Texture2D Texture { get; set; }
    Property Value
    Type Description
    Texture2D
    | Edit this page View Source

    TileCount

    Declaration
    public int TileCount { get; set; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    TileHeight

    Declaration
    public int TileHeight { get; set; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    TileProperties

    Declaration
    public Dictionary<int, TileProperties> TileProperties { get; set; }
    Property Value
    Type Description
    Dictionary<int, TileProperties>
    | Edit this page View Source

    TileWidth

    Declaration
    public int TileWidth { get; set; }
    Property Value
    Type Description
    int

    Methods

    | Edit this page View Source

    ContainsTile(int)

    Checks if a global tile ID belongs to this tileset.

    Declaration
    public bool ContainsTile(int globalTileId)
    Parameters
    Type Name Description
    int globalTileId

    Global tile ID

    Returns
    Type Description
    bool

    True if the tile belongs to this tileset

    | Edit this page View Source

    GetTileProperties(int)

    Gets the tile properties for a specific local tile ID.

    Declaration
    public TileProperties? GetTileProperties(int localTileId)
    Parameters
    Type Name Description
    int localTileId

    Local tile ID within this tileset

    Returns
    Type Description
    TileProperties

    Tile properties, or null if none defined

    | Edit this page View Source

    GetTileSourceRect(int)

    Gets the source rectangle for a specific tile in the tileset texture.

    Declaration
    public Rectangle GetTileSourceRect(int localTileId)
    Parameters
    Type Name Description
    int localTileId

    Local tile ID within this tileset (0-based)

    Returns
    Type Description
    Rectangle

    Rectangle defining the tile's position in the texture

    | Edit this page View Source

    GlobalToLocal(int)

    Converts a global tile ID to a local tile ID for this tileset.

    Declaration
    public int GlobalToLocal(int globalTileId)
    Parameters
    Type Name Description
    int globalTileId

    Global tile ID

    Returns
    Type Description
    int

    Local tile ID, or -1 if the tile doesn't belong to this tileset

    | Edit this page View Source

    LoadTexture(string)

    Loads the tileset texture from the specified path.

    Declaration
    public void LoadTexture(string imagePath)
    Parameters
    Type Name Description
    string imagePath

    Path to the texture file

    | Edit this page View Source

    LocalToGlobal(int)

    Converts a local tile ID to a global tile ID.

    Declaration
    public int LocalToGlobal(int localTileId)
    Parameters
    Type Name Description
    int localTileId

    Local tile ID

    Returns
    Type Description
    int

    Global tile ID

    | Edit this page View Source

    SetTileProperties(int, TileProperties)

    Sets properties for a specific tile.

    Declaration
    public void SetTileProperties(int localTileId, TileProperties properties)
    Parameters
    Type Name Description
    int localTileId

    Local tile ID within this tileset

    TileProperties properties

    Properties to set

    | Edit this page View Source

    ToString()

    Returns a string that represents the current object.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    A string that represents the current object.

    Overrides
    object.ToString()
    | Edit this page View Source

    UnloadTexture()

    Unloads the tileset texture from memory.

    Declaration
    public void UnloadTexture()
    • Edit this page
    • View Source
    In this article
    Back to top © 2024 Popcorning Guinea Pig Game Engine. A custom C# game engine for indie developers.