better sorting of images coming into sprites, fixes one rbx error
This commit is contained in:
parent
88ee68de5d
commit
c9593794bd
@ -10,7 +10,13 @@ module Compass
|
||||
def_delegators :rows, :[]
|
||||
|
||||
def initialize(images)
|
||||
@images = images.sort {|a,b| a.height <=> b.height }
|
||||
@images = images.sort do |a,b|
|
||||
if a.height == b.height
|
||||
b.width <=> a.width
|
||||
else
|
||||
a.height <=> b.height
|
||||
end
|
||||
end
|
||||
@rows = []
|
||||
end
|
||||
|
||||
|
@ -111,7 +111,7 @@ class SpriteMapTest < Test::Unit::TestCase
|
||||
base.generate
|
||||
assert_equal 400, base.width
|
||||
assert_equal 60, base.height
|
||||
assert_equal [[0, 0], [20, 120], [20, 20], [20, 0], [20, 160]], base.images.map {|i| [i.top, i.left]}
|
||||
assert_equal [[0, 0], [20, 120], [20, 0], [20, 100], [20, 160]], base.images.map {|i| [i.top, i.left]}
|
||||
assert File.exists?(base.filename)
|
||||
FileUtils.rm base.filename
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user