Class: Metro::UI::TileLayer

Inherits:
Model
  • Object
show all
Defined in:
lib/metro/models/ui/tmx/tile_layer.rb

Constant Summary

Constants included from Metro::Units

Metro::Units::Bounds

Instance Attribute Summary collapse

Attributes inherited from Model

#scene, #window

Instance Method Summary collapse

Methods inherited from Model

#_load, #_save, #after_initialize, #bounds, #create, #draw_completed?, hierarchy, inherited, #initialize, metro_name, #model, model_name, models, #name, #notification, #saveable_to_view, #show, #to_hash, #update, #update_completed?

Methods included from HasEvents

included

Methods included from KeyValueCoding

#get, #set

Methods included from PropertyOwner

included, #properties

Constructor Details

This class inherits a constructor from Metro::Model

Instance Attribute Details

#layerObject

Returns the value of attribute layer.



7
8
9
# File 'lib/metro/models/ui/tmx/tile_layer.rb', line 7

def layer
  @layer
end

#mapObject

Returns the value of attribute map.



6
7
8
# File 'lib/metro/models/ui/tmx/tile_layer.rb', line 6

def map
  @map
end

#tilesetsObject

Returns the value of attribute tilesets.



8
9
10
# File 'lib/metro/models/ui/tmx/tile_layer.rb', line 8

def tilesets
  @tilesets
end

#viewportObject

Returns the value of attribute viewport.



9
10
11
# File 'lib/metro/models/ui/tmx/tile_layer.rb', line 9

def viewport
  @viewport
end

Instance Method Details

#dataObject



11
12
13
# File 'lib/metro/models/ui/tmx/tile_layer.rb', line 11

def data
  layer.data
end

#drawObject



27
28
29
30
31
# File 'lib/metro/models/ui/tmx/tile_layer.rb', line 27

def draw
  tiles_within_viewport.each do |bounds,image|
    image.draw_rot(bounds.left - x,bounds.top - y,z_order,rotation)
  end
end

#xObject



15
16
17
# File 'lib/metro/models/ui/tmx/tile_layer.rb', line 15

def x
  viewport.left
end

#yObject



19
20
21
# File 'lib/metro/models/ui/tmx/tile_layer.rb', line 19

def y
  viewport.top
end

#z_orderObject



23
24
25
# File 'lib/metro/models/ui/tmx/tile_layer.rb', line 23

def z_order
  -1
end