Class: RETMX::Map
- Inherits:
-
Object
- Object
- RETMX::Map
- Defined in:
- lib/retmx.rb
Overview
The tilewidth
and tileheight
properties determine the general grid size of the map. The individual tiles may have different sizes. Larger tiles will extend at the top and right (anchored to the bottom left).
Defined Under Namespace
Classes: Layer, ObjectGroup, TileSet
Instance Attribute Summary collapse
-
#height ⇒ Object
readonly
The map height in tiles.
-
#layers ⇒ Object
readonly
Layers on map.
-
#objectgroups ⇒ Object
readonly
Objects groups on map.
-
#orientation ⇒ Object
readonly
Map orientation.
-
#property ⇒ Object
readonly
Properties on map.
-
#tileheight ⇒ Object
readonly
The height of a tile.
-
#tilesets ⇒ Object
readonly
Tileset on map.
-
#tilewidth ⇒ Object
readonly
The width of a tile.
-
#version ⇒ Object
readonly
The TMX format version, generally 1.0.
-
#width ⇒ Object
readonly
The map width in tiles.
-
#xml ⇒ Object
readonly
REXML internal.
Instance Method Summary collapse
-
#initialize(doc) ⇒ Map
constructor
A new instance of Map.
Constructor Details
#initialize(doc) ⇒ Map
Returns a new instance of Map.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/retmx.rb', line 81 def initialize(doc) @version = doc.attributes['version'] @orientation = doc.attributes['orientation'] @width = doc.attributes['width'].to_i @height = doc.attributes['height'].to_i @tilewidth = doc.attributes['tilewidth'].to_i @tileheight = doc.attributes['tileheight'].to_i @tilesets = {} @layers = {} @objectgroups = {} @xml = doc build(doc) end |
Instance Attribute Details
#height ⇒ Object (readonly)
The map height in tiles.
59 60 61 |
# File 'lib/retmx.rb', line 59 def height @height end |
#layers ⇒ Object (readonly)
Layers on map
68 69 70 |
# File 'lib/retmx.rb', line 68 def layers @layers end |
#objectgroups ⇒ Object (readonly)
Objects groups on map
74 75 76 |
# File 'lib/retmx.rb', line 74 def objectgroups @objectgroups end |
#orientation ⇒ Object (readonly)
Map orientation. Tiled supports “orthogonal” and “isometric” at the moment.
53 54 55 |
# File 'lib/retmx.rb', line 53 def orientation @orientation end |
#property ⇒ Object (readonly)
Properties on map
77 78 79 |
# File 'lib/retmx.rb', line 77 def property @property end |
#tileheight ⇒ Object (readonly)
The height of a tile.
65 66 67 |
# File 'lib/retmx.rb', line 65 def tileheight @tileheight end |
#tilesets ⇒ Object (readonly)
Tileset on map
71 72 73 |
# File 'lib/retmx.rb', line 71 def tilesets @tilesets end |
#tilewidth ⇒ Object (readonly)
The width of a tile.
62 63 64 |
# File 'lib/retmx.rb', line 62 def tilewidth @tilewidth end |
#version ⇒ Object (readonly)
The TMX format version, generally 1.0
50 51 52 |
# File 'lib/retmx.rb', line 50 def version @version end |
#width ⇒ Object (readonly)
The map width in tiles.
56 57 58 |
# File 'lib/retmx.rb', line 56 def width @width end |
#xml ⇒ Object (readonly)
REXML internal
80 81 82 |
# File 'lib/retmx.rb', line 80 def xml @xml end |