FastTileGraphics

class FastTileGraphics(initialSize: Size, initialTileset: TilesetResource, initialTiles: Map<Position, Tile>) : BaseTileGraphics

This is a fast implementation of TileGraphics that sacrifices memory footprint for speed and uses an array behind the scenes.

Constructors

FastTileGraphics
Link copied to clipboard
common
fun FastTileGraphics(initialSize: Size, initialTileset: TilesetResource, initialTiles: Map<Position, Tile> = mapOf())

Functions

applyStyle
Link copied to clipboard
common
open override fun applyStyle(styleSet: StyleSet)
Applies the given styleSet to all currently present Tiles in this TileGraphics.
clear
Link copied to clipboard
common
open override fun clear()
Clears this Clearable.
contents
Link copied to clipboard
common
fun contents(): Sequence<Map.Entry<Position, Tile>>
createCopy
Link copied to clipboard
common
open override fun createCopy(): TileGraphics
Creates a deep copy of this object.
draw
Link copied to clipboard
common
open override fun draw(tileMap: Map<Position, Tile>)
Same as draw with 3 parameters, with the difference that size will be used for drawArea, and Position.zero as drawPosition
open override fun draw(tileComposite: TileComposite)
Same as draw with tileMap, but TileComposite.tiles will be use as the Map.
open override fun draw(tileMap: Map<Position, Tile>, drawPosition: Position)
Same as draw with 3 parameters, with the difference that size will be used for drawArea.
open override fun draw(tileComposite: TileComposite, drawPosition: Position)
Same as draw with tileMap, but TileComposite.tiles will be use as the Map.
open override fun draw(tile: Tile, drawPosition: Position)
Draws the given Tile on this TileGraphics at the given drawPosition.
open override fun draw(tileComposite: TileComposite, drawPosition: Position, drawArea: Size)
Same as draw with tileMap, but TileComposite.tiles will be use as the Map.
open override fun draw(tileMap: Map<Position, Tile>, drawPosition: Position, drawArea: Size)
Draws the given tileMap onto this TileGraphics.
equals
Link copied to clipboard
common
open operator fun equals(other: Any?): Boolean
fill
Link copied to clipboard
common
open override fun fill(filler: Tile)
Fills the empty parts of this TileGraphics with the given filler.
getTileAt
Link copied to clipboard
common
open fun getTileAt(position: Position): Maybe<Tile>
Returns the Tile stored at a particular position in this TileComposite.
getTileAtOrNull
Link copied to clipboard
common
open fun getTileAtOrNull(position: Position): Tile?
Returns the Tile stored at a particular position or null if there is no such Tile.
hashCode
Link copied to clipboard
common
open fun hashCode(): Int
toLayer
Link copied to clipboard
common
open override fun toLayer(offset: Position): Layer
Creates a newLayer from the contents of this TileGraphics.
toResized
Link copied to clipboard
common
open override fun toResized(newSize: Size): TileGraphics
Returns a copy of this TileGraphics resized to a new size and using Tile.empty if the new size is larger than the old and it needs to fill in empty areas.
open override fun toResized(newSize: Size, filler: Tile): TileGraphics
Returns a copy of this image resized to a new size and using the specified filler if the new size is larger than the old one and we need to fill in empty areas.
toString
Link copied to clipboard
common
open override fun toString(): String
toSubTileGraphics
Link copied to clipboard
common
open override fun toSubTileGraphics(rect: Rect): SubTileGraphics
This function can be used to create an editable "window" over the underlying TileGraphics.
toTileImage
Link copied to clipboard
common
open override fun toTileImage(): TileImage
Creates a newTileImage from the contents of this TileGraphics.
transform
Link copied to clipboard
common
open override fun transform(transformer: (Position, Tile) -> Tile)
Transforms all of the Tiles in this TileGraphics with the given transformer and overwrites them with the results of calling transformer.

Properties

height
Link copied to clipboard
common
open override val height: Int
size
Link copied to clipboard
common
override val size: Size
state
Link copied to clipboard
common
open override val state: TileGraphicsState
Holds a snapshot of the current state of this InternalTileGraphics.
tiles
Link copied to clipboard
common
open override var tiles: ArrayBackedTileMap
The Tiles this TileComposite contains.
tileset
Link copied to clipboard
common
open override var tileset: TilesetResource
The (mutable) tileset value.
tilesetProperty
Link copied to clipboard
common
override val tilesetProperty: Property<TilesetResource>
A Property that wraps the tileset and offers data binding and observability features.
width
Link copied to clipboard
common
open override val width: Int

Sources

(source)
Link copied to clipboard