Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

We want to add possibility to set atlas texture size with static meth… #413

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion cocos2d/label_nodes/CCLabel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ private struct KerningInfo
}

public static CCTexture2D m_pTexture;
private static CCSize m_pAtlasTextureSize = new CCSize(0, 0);

protected static bool m_bTextureDirty = true;

protected string m_FontName;
Expand Down Expand Up @@ -93,6 +95,14 @@ public override string Text
}
}

public static void SetTTFAtlasTextureSize(float width, float height)
{
if (width > 0 && height > 0)
{
m_pAtlasTextureSize = new CCSize(width, height);
}
}

public static void InitializeTTFAtlas(int width, int height)
{
m_nWidth = width;
Expand Down Expand Up @@ -177,7 +187,11 @@ private CCBMFontConfiguration InitializeFont(string fontName, float fontSize, st

if (m_pData == null || s_pConfigurations.Count == 0)
{
if (fontSize >= 105)
if (m_pAtlasTextureSize.Width > 0 && m_pAtlasTextureSize.Height > 0)
{
InitializeTTFAtlas((int)m_pAtlasTextureSize.Width, (int)m_pAtlasTextureSize.Height);
}
else if (fontSize >= 105)
{
InitializeTTFAtlas(2048, 2048);
}
Expand Down
Loading