Skip to content

ITileDataSource

Namespace: Hex1b.Data

Assembly: Hex1b.dll

Provides tile data for a . Implementations supply tile dimensions and asynchronously fetch tile content for rectangular regions of the tile grid.

csharp
public interface ITileDataSource

Properties

TileSize

Gets the size of each tile in characters at zoom level 0. For example, a Size(3, 1) means each tile is 3 characters wide and 1 character tall.

Returns: Size

csharp
Size TileSize { get; }

Methods

GetTilesAsync(int, int, int, int, CancellationToken)

Fetches tile data for a rectangular region of the tile grid.

Parameters:

  • tileX (Int32): The X coordinate of the top-left tile in the region.
  • tileY (Int32): The Y coordinate of the top-left tile in the region.
  • tilesWide (Int32): The number of tiles wide to fetch.
  • tilesTall (Int32): The number of tiles tall to fetch.
  • cancellationToken (CancellationToken): A cancellation token.

Returns: ValueTask<TileData[0:, 0:]>

A 2D array of tile data where [x, y] corresponds to tile at (tileX + x, tileY + y). The array dimensions must be [tilesWide, tilesTall].

csharp
ValueTask<TileData[,]> GetTilesAsync(int tileX, int tileY, int tilesWide, int tilesTall, CancellationToken cancellationToken = default)

Remarks

The data source represents an infinite or large tile grid. The TilePanel requests only the tiles visible in the current viewport. Tile coordinates can be any integer value (positive or negative), enabling infinite panning.

Released under the MIT License.