The following descriptions assume that your input file was named resources.xml and the classes were generated with
em_resource_generator resources.xml
Resources Singleton
After you have generated the classes resources.e and shared_resources.e with the EiffelMedia resource generator, you should inherit from SHARED_RESOURCES in every class you would like to access resources from. When you inherit from SHARED_RESOURCES, you will have the object "resources" available in your class.
Load resources
There are different ways to to load resources. The easiest way is to call
resources.load_allwhich will load all resources.
You can also load a section by calling
resources.load_sectionnameIf you want to have more control over loading, you can load the resources one by one. In order to do this, you call
resources.start_loading_sectionenamefollowed by several
resources.load_next_sectionname_resourceuntil all resources in a section are loaded, which can be checked with
resources.is_sectionname_loadedThe current progress of loading can be accessed with
resources.sectionname_progress
Note:
When loading music and sound resources you have to pay attention that you fulfil all requirements when loading EM_MUSIC and EM_SOUND instances. If you're using the EM_MUSIC_PLAYER and EM_SOUND_PLAYER you probably don't want to load these resources, because you just need the paths of the audio files.
See Audio Documentation for details.
See Audio Documentation for details.