Refactored CText constructor

This commit is contained in:
Flamefire committed 2013-04-30 16:33:20 +02:00
1 parent 5df160971d
commit dc3866975e
2 files changed
+12 -113

No files matched your search

+7 -6
View File
@@ -40,17 +40,18 @@ namespace Vocaluxe.Screens
{
base.Init();
const string test = " ÖÄÜabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPGRSTUVWGXZ1234567890";
CText text = new CText(10, 50, 1, EAlignment.Left, 32, 0, 1, 0, 0, 1, EStyle.Normal, "Normal", "Normal Text" + test);
SColorF color = new SColorF(1, 0, 0, 1);
CText text = new CText(10, 50, 1, 32, 0, EAlignment.Left, EStyle.Normal, "Normal", color, "Normal Text" + test);
_AddText(text);
text = new CText(10, 90, 1, EAlignment.Left, 32, 0, 1, 0, 0, 1, EStyle.Bold, "Normal", "Bold Text" + test);
text = new CText(10, 90, 1, 32, 0, EAlignment.Left, EStyle.Bold, "Normal", color, "Bold Text" + test);
_AddText(text);
text = new CText(10, 130, 1, EAlignment.Left, 32, 0, 1, 0, 0, 1, EStyle.Italic, "Normal", "Italic Text" + test);
text = new CText(10, 130, 1, 32, 0, EAlignment.Left, EStyle.Italic, "Normal", color, "Italic Text" + test);
_AddText(text);
text = new CText(10, 170, 1, EAlignment.Left, 32, 0, 1, 0, 0, 1, EStyle.Normal, "Outline", "Normal Text" + test);
text = new CText(10, 170, 1, 32, 0, EAlignment.Left, EStyle.Normal, "Outline", color, "Normal Text" + test);
_AddText(text);
text = new CText(10, 210, 1, EAlignment.Left, 32, 0, 1, 0, 0, 1, EStyle.Bold, "Outline", "Bold Text" + test);
text = new CText(10, 210, 1, 32, 0, EAlignment.Left, EStyle.Bold, "Outline", color, "Bold Text" + test);
_AddText(text);
text = new CText(10, 250, 1, EAlignment.Left, 32, 0, 1, 0, 0, 1, EStyle.Italic, "Outline", "Italic Text" + test);
text = new CText(10, 250, 1, 32, 0, EAlignment.Left, EStyle.Italic, "Outline", color, "Italic Text" + test);
_AddText(text);
}
+5 -107
View File
@@ -306,113 +306,8 @@ namespace VocaluxeLib.Menu
_EditMode = text._EditMode;
}
public CText(float x, float y, float z, EAlignment align, float h, float mw, float r, float g, float b, float a, EStyle style, string font, string text, float rspace,
float rheight)
{
_Theme = new SThemeText();
_ThemeLoaded = false;
_ButtonText = false;
_PartyModeID = -1;
_TranslationID = -1;
X = x;
Y = y;
Z = z;
Height = h;
MaxWidth = mw;
Align = align;
HAlign = EHAlignment.Center;
Style = style;
Font = font;
Color = new SColorF(r, g, b, a);
SelColor = new SColorF(r, g, b, a);
Text = text;
Selected = false;
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if (MaxWidth > 0)
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f);
else
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), 3f * CBase.Settings.GetRenderW(), 3f * CBase.Settings.GetRenderH(), 0f);
ReflectionSpace = rspace;
ReflectionHeight = rheight;
}
public CText(float x, float y, float z, EAlignment align, float h, float mw, float r, float g, float b, float a, EStyle style, string font, string text)
{
_Theme = new SThemeText();
_ThemeLoaded = false;
_ButtonText = false;
_PartyModeID = -1;
_TranslationID = -1;
X = x;
Y = y;
Z = z;
Height = h;
MaxWidth = mw;
Align = align;
HAlign = EHAlignment.Center;
Style = style;
Font = font;
Color = new SColorF(r, g, b, a);
SelColor = new SColorF(r, g, b, a);
Text = text;
Selected = false;
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if (MaxWidth > 0)
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f);
else
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), 3f * CBase.Settings.GetRenderW(), 3f * CBase.Settings.GetRenderH(), 0f);
}
public CText(float x, float y, float z, float h, float mw, EAlignment align, EStyle style, string font, SColorF col, string text, float rspace, float rheight)
{
_Theme = new SThemeText();
_ThemeLoaded = false;
_ButtonText = false;
_PartyModeID = -1;
_TranslationID = -1;
X = x;
Y = y;
Z = z;
Height = h;
MaxWidth = mw;
Align = align;
HAlign = EHAlignment.Center;
Style = style;
Font = font;
Color = col;
SelColor = new SColorF(col);
Text = text;
Selected = false;
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if (MaxWidth > 0)
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f);
else
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), 3f * CBase.Settings.GetRenderW(), 3f * CBase.Settings.GetRenderH(), 0f);
ReflectionSpace = rspace;
ReflectionHeight = rheight;
}
public CText(float x, float y, float z, float h, float mw, EAlignment align, EStyle style, string font, SColorF col, string text, int partyModeID = -1)
public CText(float x, float y, float z, float h, float mw, EAlignment align, EStyle style, string font, SColorF col, string text, int partyModeID = -1, float rheight = 0,
float rspace = 0)
{
_Theme = new SThemeText();
_ThemeLoaded = false;
@@ -443,6 +338,9 @@ namespace VocaluxeLib.Menu
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f);
else
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), 3f * CBase.Settings.GetRenderW(), 3f * CBase.Settings.GetRenderH(), 0f);
ReflectionSpace = rspace;
ReflectionHeight = rheight;
}
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)