Class: DXRuby::Tiled::Layer
- Inherits:
-
Object
- Object
- DXRuby::Tiled::Layer
- Defined in:
- lib/dxruby_tiled/layer.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#offset_x ⇒ Object
Returns the value of attribute offset_x.
-
#offset_y ⇒ Object
Returns the value of attribute offset_y.
-
#opacity ⇒ Object
Returns the value of attribute opacity.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
-
#visible ⇒ Object
Returns the value of attribute visible.
-
#z_index ⇒ Object
Returns the value of attribute z_index.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data, map) ⇒ Layer
constructor
A new instance of Layer.
Constructor Details
#initialize(data, map) ⇒ Layer
Returns a new instance of Layer.
20 21 22 23 24 25 26 27 28 29 |
# 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 |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/dxruby_tiled/layer.rb', line 4 def name @name end |
#offset_x ⇒ Object
Returns the value of attribute offset_x.
5 6 7 |
# File 'lib/dxruby_tiled/layer.rb', line 5 def offset_x @offset_x end |
#offset_y ⇒ Object
Returns the value of attribute offset_y.
5 6 7 |
# File 'lib/dxruby_tiled/layer.rb', line 5 def offset_y @offset_y end |
#opacity ⇒ Object
Returns the value of attribute opacity.
5 6 7 |
# File 'lib/dxruby_tiled/layer.rb', line 5 def opacity @opacity end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
4 5 6 |
# File 'lib/dxruby_tiled/layer.rb', line 4 def properties @properties end |
#visible ⇒ Object
Returns the value of attribute visible.
5 6 7 |
# File 'lib/dxruby_tiled/layer.rb', line 5 def visible @visible end |
#z_index ⇒ Object
Returns the value of attribute z_index.
5 6 7 |
# File 'lib/dxruby_tiled/layer.rb', line 5 def z_index @z_index end |
Class Method Details
.create(data, map) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# 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 |