Overview
The resource_loading example shows how you can use the classes generated by the EiffelMedia resource generator. The example is only explained briefly, have a look at the comments in the source code for more information.
Simple loading
In RESOURCE_LOADING, we load all resources needed in our first scene, LOADING_SCENE, by calling
resources.load_loadingscene
Advanced Loading
In LOADING_SCENE, we demonstrate more advanced resource loading. We start loading the resources for MAIN_SCENE by calling
resources.start_loading_mainsceneThen we load all resources on by one with
resources.load_next_mainscene_resourceuntil all resources all loaded, which we check with:
resources.is_mainscene_loadedWe also have a progress bar showing the current progress. To know how many resources we have in our main scene, we access the attribut
resources.num_of_mainscene_resourcesTo get the current progress, we use
resources.mainscene_progress
Audio Resources
Even though we have a section "audio" in our resources.xml, we don't load it. The reason for this is that loading instances of EM_MUSIC and EM_SOUND is not that easy (see Audio Documentation for details). We use EM_MUSIC_PLAYER and EM_SOUND_PLAYER to play the music and sounds and therefore only need to access the resource's paths.