Class AssetManager
Manages game assets such as textures and fonts.
Inherited Members
Namespace: Genesis.Core
Assembly: Genesis.dll
Syntax
public class AssetManager
Constructors
AssetManager()
Initializes a new instance of the AssetManager class.
Declaration
public AssetManager()
Properties
Fonts
List of loaded fonts.
Declaration
public List<Font> Fonts { get; set; }
Property Value
Type | Description |
---|---|
List<Font> |
Textures
List of loaded textures.
Declaration
public List<Texture> Textures { get; set; }
Property Value
Type | Description |
---|---|
List<Texture> |
Methods
AddFont(Font)
Adds an font
Declaration
public void AddFont(Font font)
Parameters
Type | Name | Description |
---|---|---|
Font | font | the font to add |
AddTexture(string, Bitmap)
Adds a texture to the asset manager.
Declaration
public Texture AddTexture(string name, Bitmap bitmap)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the texture. |
Bitmap | bitmap | The bitmap representing the texture. |
Returns
Type | Description |
---|---|
Texture | The added texture. |
DisposeTextures(Game)
Disposes of the loaded textures and fonts.
Declaration
public void DisposeTextures(Game game)
Parameters
Type | Name | Description |
---|---|---|
Game | game | The game object associated with the assets. |
GetFont(string)
Gets a font by name.
Declaration
public Font GetFont(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the font. |
Returns
Type | Description |
---|---|
Font | The font with the specified name, or null if not found. |
GetRessourcesDirectory()
Gets the resource directory path.
Declaration
public static string GetRessourcesDirectory()
Returns
Type | Description |
---|---|
string | The path to the resource directory. |
GetTexture(string)
Gets a texture by name.
Declaration
public Texture GetTexture(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the texture. |
Returns
Type | Description |
---|---|
Texture | The texture with the specified name, or null if not found. |
ImportAssetLibary(string)
Imports assets from an asset library.
Declaration
public void ImportAssetLibary(string file)
Parameters
Type | Name | Description |
---|---|---|
string | file | The file path of the asset library to import. |
Init(IRenderDevice)
Initializes the assets in the rendering device.
Declaration
public void Init(IRenderDevice renderDevice)
Parameters
Type | Name | Description |
---|---|---|
IRenderDevice | renderDevice | The rendering device to load the assets into. |
LoadFonts()
Loads fonts from the resource folder.
Declaration
public void LoadFonts()
LoadMaterial(string, string, string)
Declaration
public Material LoadMaterial(string name, string diffuseTexture, string normalTexture = "")
Parameters
Type | Name | Description |
---|---|---|
string | name | |
string | diffuseTexture | |
string | normalTexture |
Returns
Type | Description |
---|---|
Material |
LoadSystemFont(string)
Loads a system font
Declaration
public void LoadSystemFont(string font)
Parameters
Type | Name | Description |
---|---|---|
string | font |
LoadTextures()
Loads textures from the resource folder.
Declaration
public void LoadTextures()
PackAssets(string)
Packs the assets into an asset library.
Declaration
public void PackAssets(string file)
Parameters
Type | Name | Description |
---|---|---|
string | file | The file path to save the asset library. |