本文整理汇总了C++中Font::Build方法的典型用法代码示例。如果您正苦于以下问题:C++ Font::Build方法的具体用法?C++ Font::Build怎么用?C++ Font::Build使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Font
的用法示例。
在下文中一共展示了Font::Build方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PostInitialize
void OpenGLFontLoader::PostInitialize(ISystem *ySys, IPluginObjectInstance *pInstance) {
Font *font;
font = FontManager::GetInstance(ySys)->GetFont(std::string(fontName->v->string), fontSize->v->int_val);
//textureFont = FontManager::GetInstance(ySys)->LoadBitmapFont(std::string("fontmap.fnt"));
//new Font(std::string(font->v->string), fontSize->v->int_val, face);
font->Build();
outputFontObject->v->userdata = font;
}
示例2: GetFromCache
Font *FontManager::LoadBitmapFont(std::string filename) {
Font *font = GetFromCache(filename, 0); // bitmap font's have no size
if (font != NULL) return font;
psys->GetLogger("FontManager")->Debug("Loading bitmap font '%s'", filename.c_str());
font = new BitmapFont(filename);
font->Build();
fonts.push_back(font);
return font;
}
示例3: LoadFont
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
void FontProvider::LoadFont(StorageLocation in_location, const std::string& in_filePath, const ResourceProvider::AsyncLoadDelegate& in_delegate, const ResourceSPtr& out_resource)
{
std::string fileName, fileExtension;
StringUtils::SplitBaseFilename(in_filePath, fileName, fileExtension);
const std::string textureFilePath(fileName + "." + k_textureFileExtension);
if(in_delegate == nullptr)
{
Font::Descriptor desc;
desc.m_texture = Application::Get()->GetResourcePool()->LoadResource<Texture>(in_location, textureFilePath);
if(desc.m_texture == nullptr)
{
out_resource->SetLoadState(Resource::LoadState::k_failed);
return;
}
if (LoadCSFont(in_location, in_filePath, desc) == false)
{
out_resource->SetLoadState(Resource::LoadState::k_failed);
return;
}
Font* font = (Font*)(out_resource.get());
font->Build(desc);
out_resource->SetLoadState(Resource::LoadState::k_loaded);
}
else
{
Application::Get()->GetResourcePool()->LoadResourceAsync<Texture>(in_location, textureFilePath, [=](const TextureCSPtr& in_texture)
{
if(in_texture != nullptr)
{
Application::Get()->GetTaskScheduler()->ScheduleTask(TaskType::k_file, [=](const TaskContext&) noexcept
{
Font::Descriptor desc;
desc.m_texture = in_texture;
if (LoadCSFont(in_location, in_filePath, desc) == true)
{
Font* font = (Font*)(out_resource.get());
font->Build(desc);
out_resource->SetLoadState(Resource::LoadState::k_loaded);
}
else
{
out_resource->SetLoadState(Resource::LoadState::k_failed);
}
Application::Get()->GetTaskScheduler()->ScheduleTask(TaskType::k_mainThread, [=](const TaskContext&) noexcept
{
in_delegate(out_resource);
});
});
}
else
{
//Already on main thread
out_resource->SetLoadState(Resource::LoadState::k_failed);
in_delegate(out_resource);
}
});
}
}