class DXRuby::Tiled::Layer

Attributes

name[R]
offset_x[RW]
offset_y[RW]
opacity[RW]
properties[R]
visible[RW]
z_index[RW]

Public Class Methods

create(data, map) click to toggle source
# File lib/dxruby_tiled/layer.rb, line 7
def self.create(data, map)
  case data[:type]
  when "tilelayer"
    map.orientation.new(data, map)
  when "objectgroup"
    DXRuby::Tiled::ObjectGroup.new(data, map)
  when "imagelayer"
    DXRuby::Tiled::ImageLayer.new(data, map)
  when "group"
    DXRuby::Tiled::GroupLayer.new(data, map)
  end
end
new(data, map) click to toggle source
# File lib/dxruby_tiled/layer.rb, line 20
def initialize(data, map)
  @name       = data[:name]
  @opacity    = data[:opacity]    || 1.0
  @visible    = data[:visible] != false
  @offset_x   = data[:offsetx]    || 0
  @offset_y   = data[:offsety]    || 0
  @properties = data[:properties] || {}
  @z_index    = @properties[:z_index] || 0
  @fixed      = !!@properties[:fixed]
end