示例#1
0
ILabel* NodeFactory::CreateSingleLineLabel(const FontId& fontId, WStringRef text, Alignment alignment/*=Alignment::LeftBottom*/, Size2F restrictSize/*=Size2F::Zero*/, bool isStatic/*=false*/)
{
	IFont* font = FontFactory::Instance().Create(fontId);
	RETURN_NULL_IF_NULL(font);
	FntLabel* label = new FntLabel(StringRef::Empty, font, alignment, restrictSize, false, isStatic);
	label->Initialize();
	label->SetString(text);
	return label;
}
示例#2
0
ILabel* NodeFactory::CreateSingleLineBMPNumberLabel(const FontId& fontId, StringRef text, wchar_t firstChar /*= L'.'*/, Alignment alignment /*= Alignment::MiddleCenter*/, Size2F restrictSize /*= Size2F::Zero*/, bool isStatic /*= false*/)
{
	auto font = FontFactory::Instance().CreateFromSingleTexture(fontId, firstChar);
	RETURN_NULL_IF_NULL(font);
	FntLabel* label = new FntLabel(StringRef::Empty, font, alignment, restrictSize, true, isStatic);
	label->Initialize();
	label->SetString(text);
	return label;
}