TilesetImage

Entitytracker.Modelceramic.TilesetImage (Class)

Represents the image resource used by a tileset.

TilesetImage encapsulates the texture and metadata for a tileset's graphical data. It manages the texture lifecycle, including asset retention and hot-reloading support. The image dimensions can be specified explicitly or derived from the loaded texture.

Features

  • Texture Management: Handles texture loading and lifecycle
  • Asset Retention: Properly retains/releases texture assets
  • Hot-Reload Support: Automatically updates when texture assets are replaced
  • Dimension Tracking: Stores image dimensions for layout calculations

Usage Example

var image = new TilesetImage();
image.source = "tiles/terrain.png";
image.texture = assets.texture("tiles/terrain");

// Dimensions are automatically set from texture if not specified
trace('Image size: ${image.width}x${image.height}');

// Attach to a tileset
tileset.image = image;

Instance Members

tilemap
texture: Texture

The texture used for this image, if loaded and ready to display


tilemap
width: Int

The image width in points


tilemap
height: Int

The image height in points


tilemap
source: String

The reference to the tileset image file, if any


tilemap
invalidateWidth(): Void

tilemap
invalidateHeight(): Void

tilemap
invalidateSource(): Void

tilemap
destroy(): Void

tilemap
new(): Void

Private Members

tilemap
unobservedWidth: Int

tilemap
unobservedHeight: Int

tilemap
unobservedSource: String

tilemap
emitWidthChange(current: Int, previous: Int): Void

Event when width field changes.

Name Type
current Int
previous Int

tilemap
emitHeightChange(current: Int, previous: Int): Void

Event when height field changes.

Name Type
current Int
previous Int

tilemap
emitSourceChange(current: String, previous: String): Void

Event when source field changes.

Name Type
current String
previous String

tilemap
replaceTexture(newTexture: Texture, prevTexture: Texture): Void

Internal callback for texture hot-reloading. Called when the texture asset is replaced at runtime.

Name Type Description
newTexture Texture The new texture instance
prevTexture Texture The previous texture being replaced

Metadata

Name Parameters
:build tracker.macros.EventsMacro.build()
:autoBuild tracker.macros.EventsMacro.build()
:build ceramic.macros.EntityMacro.buildForCompletion()
:autoBuild ceramic.macros.EntityMacro.buildForCompletion()
:build tracker.macros.ObservableMacro.build()
:autoBuild tracker.macros.ObservableMacro.build()
:build tracker.macros.SerializableMacro.build()
:autoBuild tracker.macros.SerializableMacro.build()