FPLBase
An open source project by FPL.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
fplbase::AsyncLoader Class Reference

Handles loading AsyncAsset objects. More...

#include <async_loader.h>

Detailed Description

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.
 

Member Function Documentation

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.

Parameters
resThe 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.

Returns
Returns true once the queue is empty.

The documentation for this class was generated from the following file: