Tramway SDK
|
Classes | |
struct | ResourceRequest |
Functions | |
void | RequestResource (EntityComponent *requester, Resource *resource) |
Adds a resource to the loading queue. More... | |
void | CancelRequest (EntityComponent *requester, Resource *resource) |
Cancels a resource load request. More... | |
void | LoadDependency (Resource *res) |
Loads a resource from disk, skipping the queue. More... | |
void | LoadResourcesFromDisk () |
Processes the first resource queue. More... | |
void | LoadResourcesFromMemory () |
Processes the second resource queue. More... | |
void | FinishResources () |
Notifies EntityComponents about finished resources. More... | |
void | Init (size_t threads) |
Starts the async resource loader thread. More... | |
void | Yeet () |
Stops the async resource loader thread. More... | |
size_t | GetWaitingResources () |
Returns number of resources in queues. More... | |
void tram::Async::CancelRequest | ( | EntityComponent * | requester, |
Resource * | resource | ||
) |
Cancels a resource load request.
Should be called if the EntityComponent that requested a Resource to be loaded will be destructed before the Resource has finished loading.
void tram::Async::FinishResources | ( | ) |
Notifies EntityComponents about finished resources.
size_t tram::Async::GetWaitingResources | ( | ) |
Returns number of resources in queues.
void tram::Async::Init | ( | size_t | threads | ) |
Starts the async resource loader thread.
Number | of threads for async loading. |
void tram::Async::LoadDependency | ( | Resource * | res | ) |
Loads a resource from disk, skipping the queue.
Shouldn't be used outside of resource LoadFromDisk() methods.
void tram::Async::LoadResourcesFromDisk | ( | ) |
Processes the first resource queue.
If you started the Async system with at least one thread, you don't need to call this function.
void tram::Async::LoadResourcesFromMemory | ( | ) |
Processes the second resource queue.
void tram::Async::RequestResource | ( | EntityComponent * | requester, |
Resource * | resource | ||
) |
Adds a resource to the loading queue.
requester | EntityComponent that will be notified when the resource is loaded. Can be set to nullptr, in which case nothing will be notified. |
requested_resource | The resource that will be loaded. |
void tram::Async::Yeet | ( | ) |
Stops the async resource loader thread.