retmx 0.0.4 → 0.0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/retmx.rb +23 -5
- metadata +2 -2
data/lib/retmx.rb
CHANGED
@@ -439,6 +439,7 @@ When the object has a gid set, then it is represented by the image of the tile w
|
|
439
439
|
#array of Recs that know how cut a image
|
440
440
|
@tiles = []
|
441
441
|
build(xml)
|
442
|
+
|
442
443
|
end
|
443
444
|
|
444
445
|
|
@@ -452,9 +453,8 @@ When the object has a gid set, then it is represented by the image of the tile w
|
|
452
453
|
def build(xml)
|
453
454
|
@image = Image.new(xml)
|
454
455
|
@property = Properties.new(xml)
|
455
|
-
xml.elements.each('tile') { |e| @tiles << Tile.new(e) }
|
456
|
-
|
457
456
|
|
457
|
+
|
458
458
|
|
459
459
|
#Rect: x, y, w, h
|
460
460
|
srect = Struct.new(:x, :y, :w, :h)
|
@@ -464,7 +464,7 @@ When the object has a gid set, then it is represented by the image of the tile w
|
|
464
464
|
#calculate how cut image
|
465
465
|
@margin.step(stop_height, @tileheight + @spacing) {|y|
|
466
466
|
@margin.step(stop_width, @tilewidth + @spacing) {|x|
|
467
|
-
@tiles[tile_num] =
|
467
|
+
@tiles[tile_num] = Tile.new(xml, tile_num, x, y, @tilewidth, @tileheight)
|
468
468
|
tile_num += 1
|
469
469
|
}
|
470
470
|
}
|
@@ -474,8 +474,26 @@ When the object has a gid set, then it is represented by the image of the tile w
|
|
474
474
|
#The local tile ID within its tileset.
|
475
475
|
attr_reader :id
|
476
476
|
|
477
|
-
|
478
|
-
|
477
|
+
#propierties for tile
|
478
|
+
attr_reader :property
|
479
|
+
|
480
|
+
#how cut from image tileset
|
481
|
+
attr_reader :x, :y, :w, :h
|
482
|
+
|
483
|
+
def initialize(xml, tile_num, x, y, w, h)
|
484
|
+
@property = {}
|
485
|
+
xml.elements.each('tile') do |e|
|
486
|
+
if e.attributes['id'].to_i == tile_num.to_i
|
487
|
+
@property = Properties.new(e)
|
488
|
+
break
|
489
|
+
end
|
490
|
+
end
|
491
|
+
|
492
|
+
@id = tile_num
|
493
|
+
@x = x
|
494
|
+
@y = y
|
495
|
+
@w = w
|
496
|
+
@h = h
|
479
497
|
end
|
480
498
|
end
|
481
499
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: retmx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.4
|
4
|
+
version: 0.0.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-12-
|
12
|
+
date: 2011-12-20 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Library for work with .tmx of mapeditor.org, generic work, see doc
|
15
15
|
email: info@manadalibre.org
|