TileGrid

The TileGrid is the most fundamental interface in Zircon. It is an abstraction which lets you manage a 2D grid composed of Tiles. It also supports layering, cursor handling, character printing, event handling, simple Tile drawing operations and many more.

You can consider a TileGrid as an easy to use facade for all of your tile grid needs.

Note That all TileGrids have a Layer at index 0 which is used for implementing the DrawSurface operations and it can't be removed from the grid.

In short all TileGrids have at least oneLayer in them.

See also

Functions

addLayer
Link copied to clipboard
common
abstract fun addLayer(layer: Layer): LayerHandle
Adds a layer on top of the currently present layers.
applyStyle
Link copied to clipboard
common
abstract fun applyStyle(styleSet: StyleSet)
Applies the given styleSet to all currently present Tiles in this TileGraphics.
clear
Link copied to clipboard
common
abstract fun clear()
Clears this Clearable.
close
Link copied to clipboard
common
abstract fun close()
Closes this Closeable.
dock
Link copied to clipboard
common
abstract fun dock(view: View)
Docks a View to this ViewContainer.
draw
Link copied to clipboard
common
abstract 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
abstract fun draw(tileComposite: TileComposite)
Same as draw with tileMap, but TileComposite.tiles will be use as the Map.
abstract fun draw(tileMap: Map<Position, Tile>, drawPosition: Position)
Same as draw with 3 parameters, with the difference that size will be used for drawArea.
abstract fun draw(tile: Tile, drawPosition: Position)
Draws the given Tile on this TileGraphics at the given drawPosition.
abstract fun draw(tileComposite: TileComposite, drawPosition: Position)
Same as draw with tileMap, but TileComposite.tiles will be use as the Map.
abstract fun draw(tileMap: Map<Position, Tile>, drawPosition: Position, drawArea: Size)
Draws the given tileMap onto this TileGraphics.
abstract fun draw(tileComposite: TileComposite, drawPosition: Position, drawArea: Size)
Same as draw with tileMap, but TileComposite.tiles will be use as the Map.
equals
Link copied to clipboard
common
open operator fun equals(other: Any?): Boolean
fill
Link copied to clipboard
common
abstract fun fill(filler: Tile)
Fills the empty parts of this TileGraphics with the given filler.
getLayerAt
Link copied to clipboard
common
abstract fun getLayerAt(level: Int): Maybe<LayerHandle>
Returns the Layer at the given level (if present).
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.
handleKeyboardEvents
Link copied to clipboard
common
abstract fun handleKeyboardEvents(eventType: KeyboardEventType, handler: (event: KeyboardEvent, phase: UIEventPhase) -> UIEventResponse): Subscription
Adds the given handler for keyboard events.
handleMouseEvents
Link copied to clipboard
common
abstract fun handleMouseEvents(eventType: MouseEventType, handler: (event: MouseEvent, phase: UIEventPhase) -> UIEventResponse): Subscription
Adds the given handler for mouse events.
hashCode
Link copied to clipboard
common
open fun hashCode(): Int
insertLayerAt
Link copied to clipboard
common
abstract fun insertLayerAt(level: Int, layer: Layer): LayerHandle
Inserts the given Layer into this Layerable at the given level.
moveCursorBackward
Link copied to clipboard
common
abstract fun moveCursorBackward()
Moves the cursor one Position to the left.
moveCursorForward
Link copied to clipboard
common
abstract fun moveCursorForward()
Moves the cursor one Position to the right.
onShutdown
Link copied to clipboard
common
abstract fun onShutdown(listener: () -> Unit)
Adds a listener which will be notified when the environment shuts down.
processKeyboardEvents
Link copied to clipboard
common
abstract fun processKeyboardEvents(eventType: KeyboardEventType, handler: (event: KeyboardEvent, phase: UIEventPhase) -> Unit): Subscription
Adds the given handler for KeyboardEvents.
processMouseEvents
Link copied to clipboard
common
abstract fun processMouseEvents(eventType: MouseEventType, handler: (event: MouseEvent, phase: UIEventPhase) -> Unit): Subscription
Adds the given handler for MouseEvents.
putTile
Link copied to clipboard
common
abstract fun putTile(tile: Tile)
Adds the tile at the current cursor location.
setLayerAt
Link copied to clipboard
common
abstract fun setLayerAt(level: Int, layer: Layer): LayerHandle
Sets the given Layer in this Layerable at the given level.
start
Link copied to clipboard
common
abstract fun start(animation: Animation): AnimationHandle
Adds and starts the given Animation.
toString
Link copied to clipboard
common
open fun toString(): String
transform
Link copied to clipboard
common
abstract 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

closed
Link copied to clipboard
common
open val closed: Boolean
closedValue
Link copied to clipboard
common
open val closedValue: ObservableValue<Boolean>
cursorPosition
Link copied to clipboard
common
abstract var cursorPosition: Position
Returns the position of the cursor.
height
Link copied to clipboard
common
open override val height: Int
heightInPixels
Link copied to clipboard
common
open val heightInPixels: Int
isClosed
Link copied to clipboard
common
abstract val isClosed: ObservableValue<Boolean>
isCursorAtTheEndOfTheLine
Link copied to clipboard
common
abstract val isCursorAtTheEndOfTheLine: Boolean
Tells whether the cursor is at the end of the line.
isCursorAtTheFirstRow
Link copied to clipboard
common
abstract val isCursorAtTheFirstRow: Boolean
Tells whether the cursor is at the first (index 0) row.
isCursorAtTheLastRow
Link copied to clipboard
common
abstract val isCursorAtTheLastRow: Boolean
Tells whether the cursor is at the last row.
isCursorAtTheStartOfTheLine
Link copied to clipboard
common
abstract val isCursorAtTheStartOfTheLine: Boolean
Tells whether the cursor is at the start of the line.
isCursorVisible
Link copied to clipboard
common
abstract var isCursorVisible: Boolean
Tells whether the cursor is visible.
layers
Link copied to clipboard
common
abstract val layers: ObservableList<out Layer>
size
Link copied to clipboard
common
abstract override val size: Size
tiles
Link copied to clipboard
common
abstract val tiles: Map<Position, Tile>
The Tiles this TileComposite contains.
tileset
Link copied to clipboard
common
abstract override var tileset: TilesetResource
The (mutable) tileset value.
tilesetProperty
Link copied to clipboard
common
abstract 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
widthInPixels
Link copied to clipboard
common
open val widthInPixels: Int

Inheritors

Screen
Link copied to clipboard
InternalTileGrid
Link copied to clipboard

Extensions

toScreen
Link copied to clipboard
common
fun TileGrid.toScreen(): Screen

Sources

(source)
Link copied to clipboard