MCPcopy Create free account
hub / github.com/Illation/ETEngine / LoadFromMemory

Method LoadFromMemory

Engine/source/EtRendering/GraphicsTypes/SpriteFont.cpp:125–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123// Load texture data from binary asset content, and place it on the GPU
124//
125bool FontAsset::LoadFromMemory(std::vector<uint8> const& data)
126{
127 // temp
128 std::vector<uint8> binaryContent = data;
129 std::string extension = core::FileUtil::ExtractExtension(GetName());
130
131 if (extension == "ttf")
132 {
133 m_Data = LoadTtf(binaryContent);
134 }
135 else if (extension == "fnt")
136 {
137 m_Data = LoadFnt(binaryContent);
138 }
139 else
140 {
141 LOG("FontAsset::LoadFromMemory > Cannot load audio data with this extension! Supported exensions: [.ttf/.fnt]", core::LogLevel::Warning);
142 return false;
143 }
144
145 if (m_Data == nullptr)
146 {
147 LOG("FontAsset::LoadFromMemory > Loading font failed!", core::LogLevel::Warning);
148 return false;
149 }
150
151 return true;
152}
153
154//---------------------------------
155// TextureAsset::LoadTtf

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected