U3D
Open-source, cross-platform 2D and 3D game engine built in C++
Loading...
Searching...
No Matches
Urho3D::BackgroundLoader Class Reference

#include </var/dev/u3d/stable/Source/Urho3D/Resource/BackgroundLoader.h>

Inheritance diagram for Urho3D::BackgroundLoader:
[legend]
Collaboration diagram for Urho3D::BackgroundLoader:
[legend]

Public Member Functions

 BackgroundLoader (ResourceCache *owner)
 Construct.
 
 ~BackgroundLoader () override
 Destruct. Forcibly clear the load queue.
 
void ThreadFunction () override
 Resource background loading loop. More...
 
bool QueueResource (StringHash type, const String &name, bool sendEventOnFailure, Resource *caller)
 Queue loading of a resource. The name must be sanitated to ensure consistent format. Return true if queued (not a duplicate and resource was a known type).
 
void WaitForResource (StringHash type, StringHash nameHash)
 Wait and finish possible loading of a resource when being requested from the cache.
 
void FinishResources (int maxMs)
 Process resources that are ready to finish.
 
unsigned GetNumQueuedResources () const
 Return amount of resources in the load queue.
 
- Public Member Functions inherited from Urho3D::RefCounted
 RefCounted ()
 Construct. Allocate the reference count structure and set an initial self weak reference.
 
virtual ~RefCounted ()
 Destruct. Mark as expired and also delete the reference count structure if no outside weak references exist.
 
 RefCounted (const RefCounted &rhs)=delete
 Prevent copy construction.
 
RefCountedoperator= (const RefCounted &rhs)=delete
 Prevent assignment.
 
void AddRef ()
 
void ReleaseRef ()
 
int Refs () const
 
int WeakRefs () const
 
RefCountRefCountPtr ()
 Return pointer to the reference count structure.
 
- Public Member Functions inherited from Urho3D::Thread
 Thread ()
 Construct. Does not start the thread yet.
 
virtual ~Thread ()
 Destruct. If running, stop and wait for thread to finish.
 
virtual void ThreadFunction ()=0
 The function to run in the thread. More...
 
bool Run ()
 Start running the thread. Return true if successful, or false if already running or if can not create the thread.
 
void Stop ()
 Set the running flag to false and wait for the thread to finish.
 
void SetPriority (int priority)
 Set thread priority. The thread must have been started first.
 
bool IsStarted () const
 Return whether thread exists.
 

Private Member Functions

void FinishBackgroundLoading (BackgroundLoadItem &item)
 Finish one background loaded resource.
 

Private Attributes

ResourceCacheowner_
 Resource cache.
 
Mutex backgroundLoadMutex_
 Mutex for thread-safe access to the background load queue.
 
HashMap< Pair< StringHash, StringHash >, BackgroundLoadItembackgroundLoadQueue_
 Resources that are queued for background loading.
 

Additional Inherited Members

- Static Public Member Functions inherited from Urho3D::Thread
static void SetMainThread ()
 Set the current thread as the main thread.
 
static ThreadID GetCurrentThreadID ()
 
static bool IsMainThread ()
 Return whether is executing in the main thread.
 
- Protected Attributes inherited from Urho3D::Thread
void * handle_
 Thread handle.
 
volatile bool shouldRun_
 Running flag.
 
- Static Protected Attributes inherited from Urho3D::Thread
static ThreadID mainThreadID
 Main thread's thread ID.
 

Detailed Description

Background loader of resources. Owned by the ResourceCache.

Member Function Documentation

◆ ThreadFunction()

void Urho3D::BackgroundLoader::ThreadFunction ( )
overridevirtual

Resource background loading loop.

Implements Urho3D::Thread.


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