Class | Rubygame::MediaBag |
In: |
lib/rubygame/mediabag.rb
lib/rubygame/mediabag.rb |
Parent: | Object |
NOTE: MediaBag is DEPRECATED and will be removed in Rubygame 3.0! Use the NamedResource functionality of Music, Sound, and Surface instead.
NOTE: you must require ‘rubygame/mediabag’ manually to gain access to Rubygame::MediaBag. It is not imported with Rubygame by default!
A Hash-like class which will load and retain media files (images and sounds), so that the file can be loaded once, but used many times.
The first time a file is requested with the #[] method,that file will be loaded into memory. All subsequent requests for the same file will return a reference to the already-loaded version. Ideally, objects should not have to know whether or not the image has been loaded or not.
Return a reference to the stored value for key. If there is no value for key, automatically attempt to load key as a filename (guessing the file type based on its extension)
Return a reference to the stored value for key. If there is no value for key, automatically attempt to load key as a filename (guessing the file type based on its extension)