CoriEngine
Loading...
Searching...
No Matches
AssetManager.cpp
Go to the documentation of this file.
1
#include "
AssetManager.hpp
"
2
#include "
Graphics/Font.hpp
"
3
#include "
Graphics/Texture.hpp
"
4
#include "
FileSystem/PathManager.hpp
"
5
6
namespace
Cori
{
7
AssetManager::Cache* AssetManager::s_Cache =
nullptr
;
8
9
void
AssetManager::Init() {
10
s_Cache =
new
Cache();
11
RegisterPlaceholders();
12
}
13
14
void
AssetManager::Shutdown() {
15
delete
s_Cache;
16
}
17
18
void
AssetManager::RegisterPlaceholders() {
19
const
auto
fp =
Graphics::Font::Create
(
FileSystem::PathManager::GetAliasedPath
(
"ENGINE_DATA"
) /
"placeholders/unifont-16.0.04.otf"
, {
Graphics::Font::CharsetRanges::Latin
,
Graphics::Font::CharsetRanges::LatinExtendedA
,
Graphics::Font::CharsetRanges::LatinExtendedB
});
20
RegisterPlaceholder<Graphics::Font>
(fp);
21
22
const
auto
tp =
Graphics::Texture2D::Create
(
Graphics::Image::Create
(
FileSystem::PathManager::GetAliasedPath
(
"ENGINE_DATA"
) /
"placeholders/missing_texture32.png"
));
23
RegisterPlaceholder<Graphics::Texture2D>
(tp);
24
}
25
}
AssetManager.hpp
Font.hpp
PathManager.hpp
Texture.hpp
Cori::AssetManager::RegisterPlaceholder
static void RegisterPlaceholder(const std::shared_ptr< AssetType > &placeholderInstance)
This allows you to register a placeholder for a specific asset that you can later retrieve.
Definition
AssetManager.hpp:130
Cori::FileSystem::PathManager::GetAliasedPath
static std::filesystem::path GetAliasedPath(const std::string &alias)
Retries the full aliased path defined in fsgame.json.
Definition
PathManager.cpp:7
Cori::Graphics::Font::Create
static std::shared_ptr< Font > Create(const std::filesystem::path &path, const std::vector< CharsetRange > &charsets, const float minimalScale=48.0f, const float miterLimit=1.0f)
Creates a Font object.
Definition
Font.cpp:9
Cori::Graphics::Image::Create
static std::shared_ptr< Image > Create(const std::filesystem::path &path)
Creates an Image from the picture at the specified path.
Definition
Image.cpp:189
Cori::Graphics::Texture2D::Create
static std::shared_ptr< Texture2D > Create(const std::shared_ptr< Image > &image)
Creates a Texture2D from the Image.
Definition
Texture.cpp:7
Cori
Global engine namespace.
Definition
AssetLoadStatus.hpp:3
Cori::Graphics::Font::CharsetRanges::Latin
static constexpr CharsetRange Latin
Definition
Font.hpp:30
Cori::Graphics::Font::CharsetRanges::LatinExtendedA
static constexpr CharsetRange LatinExtendedA
Definition
Font.hpp:31
Cori::Graphics::Font::CharsetRanges::LatinExtendedB
static constexpr CharsetRange LatinExtendedB
Definition
Font.hpp:32
CoriEngine
Engine
src
AssetManager
AssetManager.cpp
Generated by
1.14.0