lib/dedalus/elements/image_grid.rb in dedalus-0.2.17 vs lib/dedalus/elements/image_grid.rb in dedalus-0.2.18
- old
+ new
@@ -1,9 +1,9 @@
module Dedalus
module Elements
class ImageGrid < Dedalus::Molecule
- attr_accessor :grid, :tiles_path, :tile_width, :tile_height
+ attr_accessor :grid, :tiles_path, :tile_width, :tile_height, :tile_class
attr_accessor :scale
def show
if grid
grid.map do |row_elements|
@@ -47,11 +47,11 @@
0
end
end
def sprite_for(frame)
- Sprite.new(
+ tile_class.constantize.new(
frame: frame,
asset_width: tile_width,
asset_height: tile_height,
path: tiles_path,
scale: scale
@@ -69,9 +69,10 @@
def self.example_data
{
tiles_path: "media/images/tiles.png",
tile_width: 64,
tile_height: 64,
+ tile_class: "Dedalus::Elements::MapTile", #Elements::Sprite",
scale: 0.2,
grid: [
[ nil, 0, 2, 0, 1 ],
[ 0, nil, 1, 0, 1 ],
[ 0, 0, nil, 0, 1 ],