Skip to main content
Version: Next

Velaptor.Content.ContentManager

Velaptor

Velaptor.Content

ContentManager Class

Loads various types of content.

public sealed class ContentManager :
Velaptor.Content.IContentManager

Inheritance System.Object → ContentManager

Implements IContentManager

Methods

Create()

Creates a singleton instance of the IContentManager.

public static Velaptor.Content.IContentManager Create();

Returns

IContentManager
The singleton instance of the IContentManager.

Load<T>(string)

Loads the specified pathOrName for the given type T.

public T Load<T>(string pathOrName)
where T : Velaptor.Content.IContent;

Type parameters

T

The type of content to use.

Parameters

pathOrName System.String

The content file path or name.

Implements Load<T>(string)

Returns

T
The content object.

Remarks

When loading audio content, the default Full used will be used.
To specify a different buffer type, use the LoadAudio(string, AudioBuffer) method.

When loading font content, the default size of 12 will be used.
To specify a different size, use the LoadFont(string, uint) method.

If the pathOrName is a fully qualified file path, an attempt will be made to load the content
using the file path directly. If the pathOrName is just the name of the content item,
the content manager system will try to find and resolve the location of the content item automatically.

Only loads the following built in IContent types.

LoadAudio(string, AudioBuffer)

Loads a font with the given pathOrName and bufferType.

public Velaptor.Content.IAudio LoadAudio(string pathOrName, Velaptor.Content.AudioBuffer bufferType);

Parameters

pathOrName System.String

The font file path or name.

bufferType AudioBuffer

The buffer mode of the audio.

Implements LoadAudio(string, AudioBuffer)

Returns

IAudio
The loaded audio.

Remarks

If the pathOrName is a fully qualified file path, an attempt will be made to load the content
using the file path directly. If the pathOrName is just the name of the content item,
the content manager system will try to find and resolve the location of the content item automatically.

LoadFont(string, uint)

Loads a font with the given pathOrName and size.

public Velaptor.Content.Fonts.IFont LoadFont(string pathOrName, uint size);

Parameters

pathOrName System.String

The font file path or name.

size System.UInt32

The size of the font.

Implements LoadFont(string, uint)

Returns

IFont
The loaded font.

Remarks

If the pathOrName is a fully qualified file path, an attempt will be made to load the content
using the file path directly. If the pathOrName is just the name of the content item,
the content manager system will try to find and resolve the location of the content item automatically.

Unload<T>(T)

Unloads the given item.

public void Unload<T>(T? item)
where T : Velaptor.Content.IContent;

Type parameters

T

The type of content item to unload.

Parameters

item T

The content item.

Implements Unload<T>(T)

Remarks

Only unloads the following built in IContent types.

NOTE: Null items will simply be ignored.