lib/cyberarm_engine/common.rb in cyberarm_engine-0.11.1 vs lib/cyberarm_engine/common.rb in cyberarm_engine-0.12.0

- old
+ new

@@ -52,29 +52,34 @@ alpha = 255 * ratio return Gosu::Color.rgba(color.red, color.green, color.blue, alpha) end - def get_asset(path, hash, klass) + def get_asset(path, hash, klass, retro = false, tileable = false) asset = nil hash.detect do |_asset, instance| if _asset == path asset = instance true end end unless asset - instance = klass.new(path) + instance = nil + if klass == Gosu::Image + instance = klass.new(path, retro: retro, tileable: tileable) + else + instance = klass.new(path) + end hash[path] = instance asset = instance end return asset end - def get_image(path) - get_asset(path, Engine::IMAGES, Gosu::Image) + def get_image(path, retro: false, tileable: false) + get_asset(path, Engine::IMAGES, Gosu::Image, retro, tileable) end def get_sample(path) get_asset(path, Engine::SAMPLES, Gosu::Sample) end