Class: Metro::UI::TileMap
- Inherits:
-
Model
- Object
- Model
- Metro::UI::TileMap
show all
- Defined in:
- lib/metro/models/ui/tile_map.rb
Constant Summary
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, #completed?, #create, hierarchy, inherited, #initialize, metro_name, #model, model_name, models, #name, #notification, #saveable_to_view, #to_hash
Methods included from HasEvents
included
#get, #set
included, #properties
Constructor Details
This class inherits a constructor from Metro::Model
Instance Attribute Details
#layers ⇒ Object
Returns the value of attribute layers.
125
126
127
|
# File 'lib/metro/models/ui/tile_map.rb', line 125
def layers
@layers
end
|
#viewport ⇒ Object
Returns the value of attribute viewport.
126
127
128
|
# File 'lib/metro/models/ui/tile_map.rb', line 126
def viewport
@viewport
end
|
Instance Method Details
#draw ⇒ Object
157
158
159
|
# File 'lib/metro/models/ui/tile_map.rb', line 157
def draw
layers.each {|layer| layer.draw }
end
|
#layer_class ⇒ Object
136
137
138
139
|
# File 'lib/metro/models/ui/tile_map.rb', line 136
def layer_class
{ orthogonal: "Metro::UI::TileMapOrthogonalLayer",
isometric: "Metro::UI::TileMapIsometricLayer" }[map.orientation.to_sym].constantize
end
|
#map ⇒ Object
128
129
130
131
132
133
134
|
# File 'lib/metro/models/ui/tile_map.rb', line 128
def map
@map ||= begin
map = Tmxed.parse asset_path(file)
map.tilesets.each {|tileset| tileset.window = window }
map
end
end
|
#show ⇒ Object
141
142
143
144
145
146
147
148
149
150
151
|
# File 'lib/metro/models/ui/tile_map.rb', line 141
def show
self.layers = map.layers.collect do |layer|
tml = layer_class.new
tml.rotation = rotation
tml.viewport = viewport
tml.map = map
tml.layer = layer
tml.tilesets = map.tilesets
tml
end
end
|
#update ⇒ Object
153
154
155
|
# File 'lib/metro/models/ui/tile_map.rb', line 153
def update
end
|