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.

Methods

[]   []   force_load   force_load   force_store   force_store   load   load   load_file   load_file   load_image   load_image   load_sound   load_sound   new   new   store   store  

Public Class methods

Public Instance methods

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)

Forcibly (re)load the file, replacing the previous version in memory (if any).

Forcibly (re)load the file, replacing the previous version in memory (if any).

Forcibly store value as key, replacing the previous value (if any).

Forcibly store value as key, replacing the previous value (if any).

Load the file, but only if it has not been previously loaded.

Load the file, but only if it has not been previously loaded.

Store value as key, but only if there is no previous value.

Store value as key, but only if there is no previous value.

[Validate]