ippa / chingu

OpenGL accelerated 2D game framework for Ruby
http://ippa.se/chingu
GNU Lesser General Public License v2.1
307 stars 66 forks source link

allow passing an Image through Animation.new instead of only a file name. #36

Closed fowlmouth closed 13 years ago

fowlmouth commented 13 years ago

allow passing an Image through Animation.new instead of only a file name. Directly to G::Image.load_tiles, and change the lookup to use the cache. The default options for :image and :file might need to be checked to see if at least one is set... Possibly @file can be removed it isn't used anywhere in this file and it's not an accessor ☮

ippa commented 13 years ago

can we get a test for this?

fowlmouth commented 13 years ago

Actually I sent a messed up version :/ should be if image || File.exists?(@file) and all the local files changed to @file What I used to test was changing example11

@animation = Chingu::Animation(:image => Gosu::Image['droid_11x15'], :size => [11,15])

I will fix and make a new request. I'll try to write a spec too, though I have no experience with this. Ah if you wonder why I would need this I'm generating a sprite sheet.