Thread.new {
@cache[img] = Gosu::Image.new(img, tileable: true)
}
def access img
@cache[img] ||= Gosu::Image.new(img, tileable: true)
end
Image.async_new
method that returned a 'placeholder' object. You could ask this object whether it was ready?
and then call get
to extract the Image on the main thread. (I'm not sure if it is a Future or a Promise in computer science terms…I always get them wrong.)async_new
interface was that I'd also have to add Image.async_from_text
, Image.async_load_tiles
, Sample.async_new
etc. to be consistent. My client ended up not using it anyway, so I've silently removed async_new
.Image.async_new
back as an experimental feature. I miss it as well. I've opened an issue on GitHub that you can subscribe to: https://github.com/gosu/gosu/issues/294
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill