class Scar::Components::Tilemap
Overview
This component provides a simple way to draw a Tiled tilemap.
It only supports ungrouped TileLayers (finite or infinite)
with an embedded Tileset referencing an image whose path
is corresponds to a loaded texture asset (see Assets
)
This component does not support:
- Layer Groups
- External or multiple Tilesets
- Renderorder other than right-down
- Anything except orthogonal orientation
- Tile transformations
- Parallax effects
- Objects
This component is intended as an easy way to draw tilemaps for prototyping and as an example of how you could implement the drawing of a tilemap youself. You can use it in more mature applications as well of course.
Defined in:
scar/components/tilemap.crConstructors
-
.new(asset_id : String)
Creates a new tilemap component by loading a tilemap from
Assets
. -
.new(map : Scar::Tiled::Map)
Creates a new tilemap component with the given
Scar::Tiled::Map
Instance Method Summary
-
#drawable : SF::VertexBuffer
Returns the
SF::VertexBuffer
that is used to draw the tilemap -
#map : Scar::Tiled::Map
Returns the underlying
Scar::Tiled::Map
-
#map=(new_map : Scar::Tiled::Map)
Replaces the underlying
Scar::Tiled::Map
-
#update_buffer
Rebuilds the
SF::VertexBuffer
used to draw the tilemap
Instance methods inherited from module Scar::Drawable
blend_mode : SF::BlendMode
blend_mode,
blend_mode=(blend_mode : SF::BlendMode)
blend_mode=,
drawable : SF::Drawable
drawable,
shader : SF::Shader
shader,
shader=(shader : SF::Shader)
shader=,
texture : SF::Texture
texture,
texture=(texture : SF::Texture)
texture=,
visible=(visible)
visible=,
visible?
visible?
Constructor Detail
Creates a new tilemap component by loading a tilemap from Assets
.
This function also enables hot-reloading of the tilemap (if it is enabled in the App
of course)
Creates a new tilemap component with the given Scar::Tiled::Map