Table of Contents

Class Content

Namespace
MonoEight.Core
Assembly
MonoEight.Template.dll

Provides static methods for loading content assets using the MonoGame content builder.

public static class Content
Inheritance
Content
Inherited Members

Methods

Initialize(ContentManager, string)

Initializes the static content manager.

public static void Initialize(ContentManager contentManager, string root)

Parameters

contentManager ContentManager

The Microsoft.Xna.Framework.Content.ContentManager instance from the main Game class.

root string

The root directory path (typically "Content").

LoadFromRoot<T>(string, string)

Loads an asset by temporarily switching the ContentManager's root directory to a different location.

public static T LoadFromRoot<T>(string root, string path)

Parameters

root string

The temporary root directory to load from.

path string

The path to the asset within that root.

Returns

T

Type Parameters

T

The type of asset to load.

Remarks

This restores the original root directory after loading is complete.

Load<T>(string)

Loads an asset of type T from the default content root directory.

public static T Load<T>(string path)

Parameters

path string

The path to the asset, relative to the content root.

Returns

T

The loaded asset.

Type Parameters

T

The type of asset to load.