FPLBase
An open source project by
FPL.
|
Handles loading AsyncAsset objects. More...
#include <async_loader.h>
Handles loading AsyncAsset objects.
Public Member Functions | |
void | QueueJob (AsyncAsset *res) |
Queues AsyncResources to be loaded by StartLoading. More... | |
void | StartLoading () |
Launches the loading thread for the previously queued jobs. | |
void | PauseLoading () |
Pause the loading thread for previously queued jobs. More... | |
void | StopLoadingWhenComplete () |
Ends the loading thread when all jobs are done. More... | |
bool | TryFinalize () |
Call to Finalize any resources that have finished loading. More... | |
void | Stop () |
Shuts down the loader after completing all pending loads. | |
void fplbase::AsyncLoader::PauseLoading | ( | ) |
Pause the loading thread for previously queued jobs.
Blocks until only the current job is finished loading. You can resume loading assets by calling StartLoading().
void fplbase::AsyncLoader::QueueJob | ( | AsyncAsset * | res | ) |
Queues AsyncResources to be loaded by StartLoading.
Call this any number of times before StartLoading.
res | The resource to queue for loading. |
void fplbase::AsyncLoader::StopLoadingWhenComplete | ( | ) |
Ends the loading thread when all jobs are done.
Cleans-up the background loading thread once all jobs have been completed. You can restart with StartLoading() if you like.
bool fplbase::AsyncLoader::TryFinalize | ( | ) |
Call to Finalize any resources that have finished loading.
Call this once per frame after StartLoading. Will call Finalize on any resources that have finished loading. One it returns true, that means the queue is empty, all resources have been processed, and the loading thread has terminated.