Simulant  21.12-574
A portable game engine for Windows, OSX, Linux, Dreamcast, and PSP
Public Member Functions | Friends | List of all members
smlt::AssetManager Class Reference
Inheritance diagram for smlt::AssetManager:
smlt::LocalAssetManager smlt::SharedAssetManager

Public Member Functions

 AssetManager (AssetManager *parent=nullptr)
 
ParticleScriptPtr new_particle_script_from_file (const Path &filename, GarbageCollectMethod garbage_collect=GARBAGE_COLLECT_PERIODIC)
 
void destroy_particle_script (ParticleScriptID id)
 
ParticleScriptPtr particle_script (ParticleScriptID id)
 
const ParticleScriptPtr particle_script (ParticleScriptID id) const
 
std::size_t particle_script_count () const
 
bool has_particle_script (ParticleScriptID id) const
 
ParticleScriptPtr find_particle_script (const std::string &name)
 
TexturePtr new_texture_from_file (const Path &filename, GarbageCollectMethod garbage_collect=GARBAGE_COLLECT_PERIODIC)
 
void destroy_texture (TextureID id)
 
TexturePtr texture (TextureID id)
 
const TexturePtr texture (TextureID id) const
 
std::size_t texture_count () const
 
bool has_texture (TextureID id) const
 
TexturePtr find_texture (const std::string &alias)
 
void destroy_mesh (MeshID id)
 
MeshPtr mesh (MeshID id)
 
const MeshPtr mesh (MeshID id) const
 
std::size_t mesh_count () const
 
bool has_mesh (MeshID id) const
 
MeshPtr find_mesh (const std::string &name)
 
MaterialPtr new_material_from_file (const Path &filename, GarbageCollectMethod garbage_collect=GARBAGE_COLLECT_PERIODIC)
 
void destroy_material (const MaterialID &id)
 
MaterialPtr material (const MaterialID &id)
 
const MaterialPtr material (const MaterialID &id) const
 
std::size_t material_count () const
 
bool has_material (const MaterialID &id) const
 
MaterialPtr find_material (const std::string &name)
 
SoundPtr new_sound_from_file (const Path &filename, const SoundFlags &flags=SoundFlags(), GarbageCollectMethod garbage_collect=GARBAGE_COLLECT_PERIODIC)
 
void destroy_sound (SoundID id)
 
SoundPtr sound (SoundID id)
 
const SoundPtr sound (SoundID id) const
 
std::size_t sound_count () const
 
bool has_sound (SoundID id) const
 
SoundPtr find_sound (const std::string &name)
 
BinaryPtr new_binary_from_file (const Path &filename, GarbageCollectMethod garbage_collect=GARBAGE_COLLECT_PERIODIC)
 
BinaryPtr binary (BinaryID id) const
 
std::size_t binary_count () const
 
bool has_binary (BinaryID id) const
 
BinaryPtr find_binary (const std::string &name)
 
void destroy_binary (BinaryID id)
 
FontPtr new_font_from_family (const std::string &family, const FontFlags &flags, GarbageCollectMethod garbage_collect=GARBAGE_COLLECT_PERIODIC)
 
FontPtr new_font_from_file (const Path &filename, const FontFlags &flags=FontFlags(), GarbageCollectMethod garbage_collect=GARBAGE_COLLECT_PERIODIC)
 
void destroy_font (FontID id)
 
FontPtr font (FontID id)
 
const FontPtr font (FontID id) const
 
std::size_t font_count () const
 
bool has_font (FontID id) const
 
FontPtr find_font (const std::string &alias)
 
TexturePtr new_texture (uint16_t width, uint16_t height, TextureFormat format=TEXTURE_FORMAT_RGBA_4UB_8888, GarbageCollectMethod garbage_collect=GARBAGE_COLLECT_PERIODIC)
 
TexturePtr new_texture_from_file (const Path &path, TextureFlags flags, GarbageCollectMethod garbage_collect=GARBAGE_COLLECT_PERIODIC)
 
MaterialPtr new_material (GarbageCollectMethod garbage_collect=GARBAGE_COLLECT_PERIODIC)
 
MeshPtr new_mesh (VertexSpecification vertex_specification, GarbageCollectMethod garbage_collect=GARBAGE_COLLECT_PERIODIC)
 
MeshPtr new_mesh (VertexDataPtr vertex_data, GarbageCollectMethod garbage_collect=GARBAGE_COLLECT_PERIODIC)
 
MeshPtr new_mesh_from_file (const Path &path, const VertexSpecification &desired_specification=VertexSpecification::DEFAULT, const MeshLoadOptions &options=MeshLoadOptions(), GarbageCollectMethod garbage_collect=GARBAGE_COLLECT_PERIODIC)
 
MeshPtr new_mesh_from_submesh (SubMesh *submesh, GarbageCollectMethod garbage_collect=GARBAGE_COLLECT_PERIODIC)
 
MeshPtr new_mesh_from_heightmap (const Path &image_file, const HeightmapSpecification &spec=HeightmapSpecification(), GarbageCollectMethod garbage_collect=GARBAGE_COLLECT_PERIODIC)
 
MeshPtr new_mesh_from_heightmap (const TextureID &texture, const HeightmapSpecification &spec=HeightmapSpecification(), GarbageCollectMethod garbage_collect=GARBAGE_COLLECT_PERIODIC)
 
MeshPtr new_mesh_from_vertices (VertexSpecification vertex_specification, const std::string &submesh_name, const std::vector< smlt::Vec2 > &vertices, MeshArrangement arrangement=MESH_ARRANGEMENT_TRIANGLES, GarbageCollectMethod garbage_collect=GARBAGE_COLLECT_PERIODIC)
 
MeshPtr new_mesh_from_vertices (VertexSpecification vertex_specification, const std::string &submesh_name, const std::vector< smlt::Vec3 > &vertices, MeshArrangement arrangement=MESH_ARRANGEMENT_TRIANGLES, GarbageCollectMethod garbage_collect=GARBAGE_COLLECT_PERIODIC)
 
MeshPtr new_mesh_as_cube_with_submesh_per_face (float width, GarbageCollectMethod garbage_collect=GARBAGE_COLLECT_PERIODIC)
 
MaterialPtr new_material_from_texture (TextureID texture, GarbageCollectMethod garbage_collect=GARBAGE_COLLECT_PERIODIC)
 
void update (float dt)
 
virtual MaterialPtr default_material () const
 
MaterialPtr clone_material (const MaterialID &mat_id, GarbageCollectMethod garbage_collect=GARBAGE_COLLECT_PERIODIC)
 
MaterialPtr clone_default_material (GarbageCollectMethod garbage_collect=GARBAGE_COLLECT_PERIODIC)
 
AssetManagerbase_manager () const
 
void destroy_all ()
 
void run_garbage_collection ()
 
bool is_base_manager () const
 
std::size_t child_manager_count () const
 
const AssetManagerchild_manager (std::size_t i) const
 

Friends

class Asset
 

Member Function Documentation

◆ new_font_from_family()

FontPtr smlt::AssetManager::new_font_from_family ( const std::string &  family,
const FontFlags flags,
GarbageCollectMethod  garbage_collect = GARBAGE_COLLECT_PERIODIC 
)

Loads a font by searching asset paths for a match. Searches for standard variations of the filename depending on the family, weight, style, and size. We look for the following (example) variations:

  • Kanit-Regular.ttf
  • Kanit-RegularItalic.ttf
  • Kanit-BlackItalic.ttf
  • Kanit-BlackItalic-18.fnt

and in the following example paths:

$path/$filename $path/fonts/$filename $path/fonts/family/$filename


The documentation for this class was generated from the following files: