Class: Gosu::Tiled::Map
- Inherits:
-
Object
- Object
- Gosu::Tiled::Map
- Defined in:
- lib/gosu_tiled/map.rb
Instance Attribute Summary collapse
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#layers ⇒ Object
readonly
Returns the value of attribute layers.
-
#tilesets ⇒ Object
readonly
Returns the value of attribute tilesets.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
- #draw(offset_x, offset_y) ⇒ Object
-
#initialize(window, data, data_dir) ⇒ Map
constructor
A new instance of Map.
Constructor Details
#initialize(window, data, data_dir) ⇒ Map
Returns a new instance of Map.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/gosu_tiled/map.rb', line 6 def initialize(window, data, data_dir) @window = window @data = data @data_dir = data_dir @width = data['width'] * data['tilewidth'] @height = data['height'] * data['tileheight'] @tilesets = Tilesets.new(window, data['tilesets'], data_dir) @layers = Layers.new(window, data['layers'], width: @width, height: @height, tile_width: data['tilewidth'], tile_height: data['tileheight']) end |
Instance Attribute Details
#height ⇒ Object (readonly)
Returns the value of attribute height.
4 5 6 |
# File 'lib/gosu_tiled/map.rb', line 4 def height @height end |
#layers ⇒ Object (readonly)
Returns the value of attribute layers.
4 5 6 |
# File 'lib/gosu_tiled/map.rb', line 4 def layers @layers end |
#tilesets ⇒ Object (readonly)
Returns the value of attribute tilesets.
4 5 6 |
# File 'lib/gosu_tiled/map.rb', line 4 def tilesets @tilesets end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
4 5 6 |
# File 'lib/gosu_tiled/map.rb', line 4 def width @width end |
Instance Method Details
#draw(offset_x, offset_y) ⇒ Object
21 22 23 24 25 |
# File 'lib/gosu_tiled/map.rb', line 21 def draw(offset_x, offset_y) @layers.each do |layer| layer.draw(offset_x, offset_y, tilesets) end end |