Class: Gosu::Tiled::Layer
- Inherits:
-
Object
- Object
- Gosu::Tiled::Layer
- Defined in:
- lib/gosu_tiled/layer.rb
Instance Method Summary collapse
- #draw(x, y, tilesets) ⇒ Object
-
#initialize(window, data, options) ⇒ Layer
constructor
A new instance of Layer.
- #screen_height_in_tiles ⇒ Object
- #screen_width_in_tiles ⇒ Object
- #type ⇒ Object
- #visible? ⇒ Boolean
Constructor Details
#initialize(window, data, options) ⇒ Layer
Returns a new instance of Layer.
4 5 6 7 8 |
# File 'lib/gosu_tiled/layer.rb', line 4 def initialize(window, data, ) @window = window @data = data @options = end |
Instance Method Details
#draw(x, y, tilesets) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/gosu_tiled/layer.rb', line 18 def draw(x, y, tilesets) if type == 'tilelayer' draw_tiles(x, y, tilesets) elsif type == 'objectgroup' draw_objects(x, y, tilesets) end end |
#screen_height_in_tiles ⇒ Object
30 31 32 |
# File 'lib/gosu_tiled/layer.rb', line 30 def screen_height_in_tiles (@window.height / tile_height.to_f).ceil end |
#screen_width_in_tiles ⇒ Object
26 27 28 |
# File 'lib/gosu_tiled/layer.rb', line 26 def screen_width_in_tiles (@window.width / tile_width.to_f).ceil end |
#type ⇒ Object
14 15 16 |
# File 'lib/gosu_tiled/layer.rb', line 14 def type @data['type'] end |
#visible? ⇒ Boolean
10 11 12 |
# File 'lib/gosu_tiled/layer.rb', line 10 def visible? @data['visible'] end |