当前位置: 首页>>代码示例>>C++>>正文


C++ Font::FaceSize方法代码示例

本文整理汇总了C++中sf::Font::FaceSize方法的典型用法代码示例。如果您正苦于以下问题:C++ Font::FaceSize方法的具体用法?C++ Font::FaceSize怎么用?C++ Font::FaceSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sf::Font的用法示例。


在下文中一共展示了Font::FaceSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: initFonts

/* FontManager::initFonts
 * Loads all needed fonts for rendering. Non-SFML implementation
 *******************************************************************/
int FontManager::initFonts()
{
	// --- Load general fonts ---
	int ret = 0;

	if (font_normal)		{ delete font_normal;			font_normal = NULL;			}
	if (font_condensed)		{ delete font_condensed;		font_condensed = NULL;		}
	if (font_bold)			{ delete font_bold;				font_bold = NULL;			}
	if (font_boldcondensed) { delete font_boldcondensed;	font_boldcondensed = NULL;	}
	if (font_mono)			{ delete font_mono;				font_mono = NULL;			}
	if (font_small)			{ delete font_small;			font_small = NULL;			}

	// Normal
	ArchiveEntry* entry = theArchiveManager->programResourceArchive()->entryAtPath("fonts/dejavu_sans.ttf");
	if (entry)
	{
		font_normal = new FTTextureFont(entry->getData(), entry->getSize());
		font_normal->FaceSize(gl_font_size);

		// Check it loaded ok
		if (font_normal->Error())
		{
			delete font_normal;
			font_normal = NULL;
		}
		else ++ ret;
	}

	// Condensed
	entry = theArchiveManager->programResourceArchive()->entryAtPath("fonts/dejavu_sans_c.ttf");
	if (entry)
	{
		font_condensed = new FTTextureFont(entry->getData(), entry->getSize());
		font_condensed->FaceSize(gl_font_size);

		// Check it loaded ok
		if (font_condensed->Error())
		{
			delete font_condensed;
			font_condensed = NULL;
		}
		else ++ ret;
	}

	// Bold
	entry = theArchiveManager->programResourceArchive()->entryAtPath("fonts/dejavu_sans_b.ttf");
	if (entry)
	{
		font_bold = new FTTextureFont(entry->getData(), entry->getSize());
		font_bold->FaceSize(gl_font_size);

		// Check it loaded ok
		if (font_bold->Error())
		{
			delete font_bold;
			font_bold = NULL;
		}
		else ++ ret;
	}

	// Condensed bold
	entry = theArchiveManager->programResourceArchive()->entryAtPath("fonts/dejavu_sans_cb.ttf");
	if (entry)
	{
		font_boldcondensed = new FTTextureFont(entry->getData(), entry->getSize());
		font_boldcondensed->FaceSize(gl_font_size);

		// Check it loaded ok
		if (font_boldcondensed->Error())
		{
			delete font_boldcondensed;
			font_boldcondensed = NULL;
		}
		else ++ ret;
	}

	// Monospace
	entry = theArchiveManager->programResourceArchive()->entryAtPath("fonts/dejavu_mono.ttf");
	if (entry)
	{
		font_mono = new FTTextureFont(entry->getData(), entry->getSize());
		font_mono->FaceSize(gl_font_size);

		// Check it loaded ok
		if (font_mono->Error())
		{
			delete font_mono;
			font_mono = NULL;
		}
		else ++ ret;
	}

	// Small
	entry = theArchiveManager->programResourceArchive()->entryAtPath("fonts/dejavu_sans.ttf");
	if (entry)
	{
		font_small = new FTTextureFont(entry->getData(), entry->getSize());
//.........这里部分代码省略.........
开发者ID:Monsterovich,项目名称:SLADE,代码行数:101,代码来源:Drawing.cpp


注:本文中的sf::Font::FaceSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。