Skip to main content
Version: 1.0.0-preview.38

Velaptor.ExtensionMethods.ContentExtensions

Velaptor

Velaptor.ExtensionMethods

ContentExtensions Class

Provides content related extension methods.

public static class ContentExtensions

Inheritance System.Object → ContentExtensions

Methods

Load(this ILoader<IFont>, string, uint)

Loads font content from the application's content directory or directly using a full file path.

public static Velaptor.Content.Fonts.IFont Load(this Velaptor.Content.ILoader<Velaptor.Content.Fonts.IFont> loader, string fontName, uint size);

Parameters

loader Velaptor.Content.ILoader<IFont>

The font loader.

fontName System.String

The name or full file path to the font with metadata.

size System.UInt32

The size of the font.

Returns

IFont
The loaded font.

Exceptions

System.ArgumentNullException
Occurs when the fontName argument is null or empty.

System.IO.FileNotFoundException
Occurs if the font file does not exist.

Remarks

If a path is used, it must be a fully qualified file path.

Directory paths are not valid.

Load(this ILoader<IAtlasData>, string)

Loads texture atlas data using the given atlasPathOrName.

public static Velaptor.Content.IAtlasData Load(this Velaptor.Content.ILoader<Velaptor.Content.IAtlasData> loader, string atlasPathOrName);

Parameters

loader Velaptor.Content.ILoader<IAtlasData>

The loader that loads the atlas data.

atlasPathOrName System.String

The content name or file path to the atlas data.

Returns

IAtlasData
The loaded atlas data.

Exceptions

System.ArgumentNullException
Thrown if the atlasPathOrName is null or empty.

LoadTextureException
Thrown if the resulting texture content file path is invalid.

System.IO.FileNotFoundException
Thrown if the texture file does not exist.

System.IO.IOException
The directory specified a file or the network name is not known.

System.UnauthorizedAccessException
The caller does not have the required permissions.

System.IO.PathTooLongException
The specified path, file name, or both exceed the system-defined maximum length.

System.IO.DirectoryNotFoundException
The specified path is invalid (for example, it is on an unmapped drive).

System.NotSupportedException
The path contains a colon character : that is not part of a drive label.

Remarks

Valid Values:

  • MyAtlas
  • C:/Atlas/MyAtlas.png
  • C:/Atlas/MyAtlas.json

Invalid Values:

  • C:/Atlas/MyAtlas
  • C:/Atlas/MyAtlas.txt

Load(this ILoader<IAudio>, string, AudioBuffer)

Loads the audio with the given name.

public static Velaptor.Content.IAudio Load(this Velaptor.Content.ILoader<Velaptor.Content.IAudio> loader, string audioPathOrName, Velaptor.Content.AudioBuffer bufferType);

Parameters

loader Velaptor.Content.ILoader<IAudio>

The loader that loads the texture.

audioPathOrName System.String

The full file path or name of the audio to load.

bufferType AudioBuffer

The type of buffer to use.

Returns

IAudio
The loaded audio.

Exceptions

System.ArgumentNullException
Thrown if the audioPathOrName is null or empty.

LoadTextureException
Thrown if the resulting texture content file path is invalid.

System.IO.FileNotFoundException
Thrown if the texture file does not exist.

System.IO.IOException
The directory specified a file or the network name is not known.

System.UnauthorizedAccessException
The caller does not have the required permissions.

System.IO.PathTooLongException
The specified path, file name, or both exceed the system-defined maximum length.

System.IO.DirectoryNotFoundException
The specified path is invalid (for example, it is on an unmapped drive).

System.NotSupportedException
The path contains a colon character : that is not part of a drive label.

Load(this ILoader<ITexture>, string)

Loads a texture with the given texturePathOrName.

public static Velaptor.Content.ITexture Load(this Velaptor.Content.ILoader<Velaptor.Content.ITexture> loader, string texturePathOrName);

Parameters

loader Velaptor.Content.ILoader<ITexture>

The loader that loads the texture.

texturePathOrName System.String

The full file path or name of the texture to load.

Returns

ITexture
The loaded texture.

Exceptions

System.ArgumentNullException
Thrown if the texturePathOrName is null or empty.

LoadTextureException
Thrown if the resulting texture content file path is invalid.

System.IO.FileNotFoundException
Thrown if the texture file does not exist.

System.IO.IOException
The directory specified a file or the network name is not known.

System.UnauthorizedAccessException
The caller does not have the required permissions.

System.IO.PathTooLongException
The specified path, file name, or both exceed the system-defined maximum length.

System.IO.DirectoryNotFoundException
The specified path is invalid (for example, it is on an unmapped drive).

System.NotSupportedException
The path contains a colon character : that is not part of a drive label.

Unload(this ILoader<IFont>, IFont)

Unloads the given font.

public static void Unload(this Velaptor.Content.ILoader<Velaptor.Content.Fonts.IFont> loader, Velaptor.Content.Fonts.IFont? font);

Parameters

loader Velaptor.Content.ILoader<IFont>

The loader.

font IFont

The content to unload.

Unload(this ILoader<IAtlasData>, IAtlasData)

Unloads the given atlas.

public static void Unload(this Velaptor.Content.ILoader<Velaptor.Content.IAtlasData> loader, Velaptor.Content.IAtlasData? atlas);

Parameters

loader Velaptor.Content.ILoader<IAtlasData>

The loader.

atlas IAtlasData

The content to unload.

Unload(this ILoader<IAudio>, IAudio)

Unloads the given audio.

public static void Unload(this Velaptor.Content.ILoader<Velaptor.Content.IAudio> loader, Velaptor.Content.IAudio? audio);

Parameters

loader Velaptor.Content.ILoader<IAudio>

The loader.

audio IAudio

The content to unload.

Unload(this ILoader<ITexture>, ITexture)

Unloads the given texture.

public static void Unload(this Velaptor.Content.ILoader<Velaptor.Content.ITexture> loader, Velaptor.Content.ITexture? texture);

Parameters

loader Velaptor.Content.ILoader<ITexture>

The loader.

texture ITexture

The content to unload.