Esempio n. 1
0
void FntLabel::UpdateMesh()
{
	if (mString.IsEmpty())
	{
		if (mFont->HasSinglePage() && mFont->IsFixed())
		{
			SetMesh(nullptr);
			SetMaterial(nullptr);
		}

		if (!mManagedNodes.IsEmpty())
		{
			DeleteAllChilds(NodeRemoveFlags::OnlyManaged);
		}
		SetSize(Size2F::Zero);
		mInternalMeshes.Clear();
		return;
	}
	else if (mRenderingObject.Mesh() ==nullptr)
	{
		CreateMesh();
	}


	Size2F outSize;

	if (mIsMultipleLine)
	{
		TextLayouter::LayoutMultipleLineText(mInternalMeshes, mInternalPages, outSize, *mFont, mString, mAlignment, mRestrictSize, this, mIsStatic);
	}
	else
	{
		TextLayouter::LayoutSingleLineText(mInternalMeshes, mInternalPages, outSize, *mFont, mString, mAlignment, mRestrictSize, this, mIsStatic);
	}

	SetSize(outSize);

	//check if there are some mesh has no char after layout,this is rarely hit
	size_t meshCount = mInternalMeshes.Count();
	if (meshCount>1)
	{
		List<size_t> unusedIndices;
		List<INode*> unusedSprites;
		FOR_EACH_SIZE(i, meshCount)
		{
			BaseFontMesh* mesh = mInternalMeshes[i];
			if (!mesh->HasChars())
			{
				unusedIndices.Add(i);
				unusedSprites.Add(mManagedNodes[i]);
			}
		}
Esempio n. 2
0
void INode::Clear(NodeRemoveFlags flags /*= NodeRemoveFlags::OnlyChildren*/)
{
	DeleteAllChilds(flags);
}
Esempio n. 3
0
//----------------------------------------------------------------------------------------------------------------
UIObject::~UIObject()
  {
  --mg_objects_count;
  DeleteAllChilds();
  }