Using this struct you can easily load, retrieve and free from memory any BBMOD resources.
|Loading||Number of resources that are currently loading.|
|add||Adds a resource to the resource manager.|
|async_image_loaded_update||Must be executed in the "Async - Image Loaded" event!|
|async_save_load_update||Must be executed in the "Async - Save/Load" event!|
|free||Frees a reference to the resource. When there are no other no other references, the resource is destroyed.|
|get||Retrieves a reference to a resource.|
|get_or_add||Retrieves a reference to a resource. If the resource does not exist yet, then it is added.|
|has||Checks if the resource manager has a resource.|
|load||Asynchronnously loads a resource from a file or retrieves a reference to it, if it is already loaded.|
Create a resource manager in
/// @desc Create event resourceManager = new BBMOD_ResourceManager(); /// @desc Clean Up event resourceManager.destroy(); /// @desc Async - Image Loaded event resourceManager.async_image_loaded_update(async_load); /// @desc Async - Save/Load event resourceManager.async_save_load_update(async_load);
Use the resource manager in another object to load its model or just retrieve a reference to it, if it is already loaded.
/// @desc Create event model = OMain.resourceManager.load("Data/Model.bbmod"); /// @desc Clean Up event // Free the reference. This is not necessary if you do not want to unload the // model when all instances are destroyed. It will always be unloaded when the // resource manager is destroyed. model.free(); /// @desc Draw event matrix_set(matrix_world, matrix_build(x, y, z, 0, 0, 0, 1, 1, 1)); model.render();
Copyright © 2022, BlueBurn. Built on May 18, 2022 using GMDoc.