ResourceLoader

Description

sealed class Tinman.Engine.Rendering.ResourceLoader

Derived from

Disposable abstract

Helper class for loading IResourceHandles in the background.

Public / Constructors

Resource​Loader


public constructor ResourceLoader → (1)

graphics in : Graphics

[not-null]
The graphics object to use.

Creates a new instance of ResourceLoader.

Public / Methods

Cancel


public method Cancel → (1)

wait opt : bool = true

Wait until all loading jobs have been cancelled?

Cancels loading of all pending resources.

Finish


public method Finish → ()

Invokes the IResourceConsumer.ConsumeLoadedResource callbacks for all resources that have finished loading.

Load


public method Load → (4)

name in : string

The resource name. Will be passed to callback in.

handle in : IResourceHandle

[not-null]
The resource handle.

callback in : IResourceConsumer

[not-null]
The callback to invoke when the resource has been loaded (see Finish).

placeholder opt : IResourceHandle = null

Optional handle to use for generating a resource that will be reported to callback in instantly, intended to be used as a placeholder resource until the actual resource has finished loading.

Loads a resource from the given handle.

Load​Texture


public method LoadTexture → (4)

name in : string

The resource name. Will be passed to callback in.

path in : Path

[not-null]
The texture file path.

callback in : IResourceConsumer

[not-null]
The callback to invoke when the resource has been loaded (see Finish).

placeholder opt : int64 = Colors.White

Optional color value to use for generating a texture (compressed sRGB) that will be reported to callback in instantly, intended to be used as a placeholder until the actual texture finished loading.

Loads a 2D texture resource.

Public / Attributes

Is​Loading


public attribute IsLoading → (get)

value : bool

true if one or more resources are being loaded,
false if the resource loader is idle.

Is this resource loader busy?

Logging

Logger


public static readonly attribute Logger → (ILogger)

The logger object of this class.