Merge remote-tracking branch 'remotes/flokuep/Font_Rewrite' into develop

Conflicts:
	Vocaluxe/Base/CBackgroundMusic.cs
	Vocaluxe/Base/CMain.cs
	Vocaluxe/Base/CTheme.cs
	Vocaluxe/Base/Font/CGlyph.cs
	Vocaluxe/Lib/Draw/CDirect3D.cs
	Vocaluxe/Lib/Draw/CDrawWinForm.cs
	Vocaluxe/Lib/Draw/COpenGL.cs
	Vocaluxe/Program.cs
	Vocaluxe/Screens/CScreenCredits.cs
	Vocaluxe/Screens/CScreenMain.cs
	Vocaluxe/Screens/CScreenOptionsTheme.cs
	Vocaluxe/Screens/CScreenSing.cs
	Vocaluxe/Vocaluxe.csproj
	VocaluxeLib/Menu/IMenu.cs
This commit is contained in:
Alexander Eckart committed 2013-05-10 19:28:20 +02:00
commit 4161652a1d
57 files changed
+1803 -2146

No files matched your search

+3 -3
View File
@@ -312,7 +312,7 @@ namespace VocaluxeLib.Menu
if (_Reflection)
{
CBase.Drawing.DrawTextureReflection(texture, Rect, Color, Rect, _ReflectionSpace, _ReflectionHeight);
Text.DrawRelative(Rect.X, Rect.Y, _ReflectionSpace, _ReflectionHeight, Rect.H);
Text.DrawRelative(Rect.X, Rect.Y, _ReflectionHeight, _ReflectionSpace, Rect.H);
}
else
Text.DrawRelative(Rect.X, Rect.Y);
@@ -326,7 +326,7 @@ namespace VocaluxeLib.Menu
if (_Reflection)
{
CBase.Drawing.DrawTextureReflection(texture, Rect, SelColor, Rect, _ReflectionSpace, _ReflectionHeight);
Text.DrawRelative(Rect.X, Rect.Y, _ReflectionSpace, _ReflectionHeight, Rect.H);
Text.DrawRelative(Rect.X, Rect.Y, _ReflectionHeight, _ReflectionSpace, Rect.H);
}
else
Text.DrawRelative(Rect.X, Rect.Y);
@@ -340,7 +340,7 @@ namespace VocaluxeLib.Menu
if (_Reflection)
{
CBase.Drawing.DrawTextureReflection(texture, Rect, SelColor, Rect, _ReflectionSpace, _ReflectionHeight);
_SelText.DrawRelative(Rect.X, Rect.Y, _ReflectionSpace, _ReflectionHeight, Rect.H);
_SelText.DrawRelative(Rect.X, Rect.Y, _ReflectionHeight, _ReflectionSpace, Rect.H);
}
else
_SelText.DrawRelative(Rect.X, Rect.Y);
+7 -7
View File
@@ -216,7 +216,7 @@ namespace VocaluxeLib.Menu
if (n.Type == ENoteType.Freestyle)
_Text.Style = EStyle.BoldItalic;
RectangleF rect = CBase.Drawing.GetTextBounds(_Text);
RectangleF rect = CBase.Fonts.GetTextBounds(_Text);
_Width += rect.Width;
_Notes.Add(n);
}
@@ -267,7 +267,7 @@ namespace VocaluxeLib.Menu
_Text.X = x;
_Text.Style = EStyle.Bold;
_Text.Text = note.Text;
RectangleF rect = CBase.Drawing.GetTextBounds(_Text);
RectangleF rect = CBase.Fonts.GetTextBounds(_Text);
if (note.Type == ENoteType.Freestyle)
_Text.Style = EStyle.BoldItalic;
@@ -326,7 +326,7 @@ namespace VocaluxeLib.Menu
_Text.X = x;
_Text.Style = EStyle.Bold;
_Text.Text = _Notes[note].Text;
RectangleF rect = CBase.Drawing.GetTextBounds(_Text);
RectangleF rect = CBase.Fonts.GetTextBounds(_Text);
if (_Notes[note].Type == ENoteType.Freestyle)
_Text.Style = EStyle.BoldItalic;
@@ -374,7 +374,7 @@ namespace VocaluxeLib.Menu
if (_Notes[zoomNote].Type == ENoteType.Freestyle)
_Text.Style = EStyle.BoldItalic;
RectangleF rect = CBase.Drawing.GetTextBounds(_Text);
RectangleF rect = CBase.Fonts.GetTextBounds(_Text);
float diff = endBeat - _Notes[zoomNote].StartBeat;
if (diff <= 0f)
@@ -392,7 +392,7 @@ namespace VocaluxeLib.Menu
float tz = _Text.Z;
_Text.Height += _Text.Height * p * 0.4f;
RectangleF rectz = CBase.Drawing.GetTextBounds(_Text);
RectangleF rectz = CBase.Fonts.GetTextBounds(_Text);
_Text.X -= (rectz.Width - rect.Width) / 2f;
_Text.Y -= (rectz.Height - rect.Height) / 2f;
_Text.Z -= 0.1f;
@@ -415,7 +415,7 @@ namespace VocaluxeLib.Menu
_Text.X = x;
_Text.Style = EStyle.Bold;
_Text.Text = note.Text;
RectangleF rect = CBase.Drawing.GetTextBounds(_Text);
RectangleF rect = CBase.Fonts.GetTextBounds(_Text);
if (note.Type == ENoteType.Freestyle)
_Text.Style = EStyle.BoldItalic;
@@ -456,7 +456,7 @@ namespace VocaluxeLib.Menu
_Text.X = x;
_Text.Style = EStyle.Bold;
_Text.Text = _Notes[note].Text;
RectangleF rect = CBase.Drawing.GetTextBounds(_Text);
RectangleF rect = CBase.Fonts.GetTextBounds(_Text);
if (_Notes[note].Type == ENoteType.Freestyle)
_Text.Style = EStyle.BoldItalic;
+23 -56
View File
@@ -999,51 +999,13 @@ namespace VocaluxeLib.Menu
private bool _IsMouseOver(int x, int y, CInteraction interact)
{
switch (interact.Type)
bool result = CHelper.IsInBounds(_GetRect(interact), x, y);
if (result)
return true;
if (interact.Type == EType.SelectSlide)
{
case EType.Button:
if (CHelper.IsInBounds(_Buttons[interact.Num].Rect, x, y))
return true;
break;
case EType.SelectSlide:
if (CHelper.IsInBounds(_SelectSlides[interact.Num].Rect, x, y) ||
CHelper.IsInBounds(_SelectSlides[interact.Num].RectArrowLeft, x, y) ||
CHelper.IsInBounds(_SelectSlides[interact.Num].RectArrowRight, x, y))
return true;
break;
case EType.Static:
if (CHelper.IsInBounds(_Statics[interact.Num].Rect, x, y))
return true;
break;
case EType.Text:
RectangleF bounds = CBase.Drawing.GetTextBounds(_Texts[interact.Num]);
if (CHelper.IsInBounds(new SRectF(_Texts[interact.Num].X, _Texts[interact.Num].Y, bounds.Width, bounds.Height, _Texts[interact.Num].Z), x, y))
return true;
break;
case EType.SongMenu:
if (CHelper.IsInBounds(_SongMenus[interact.Num].Rect, x, y))
return true;
break;
case EType.Lyric:
if (CHelper.IsInBounds(_Lyrics[interact.Num].Rect, x, y))
return true;
break;
case EType.NameSelection:
if (CHelper.IsInBounds(_NameSelections[interact.Num].Rect, x, y))
return true;
break;
case EType.Equalizer:
if (CHelper.IsInBounds(_Equalizers[interact.Num].Rect, x, y))
return true;
break;
case EType.Playlist:
if (CHelper.IsInBounds(_Playlists[interact.Num].Rect, x, y))
return true;
break;
case EType.ParticleEffect:
if (CHelper.IsInBounds(_ParticleEffects[interact.Num].Rect, x, y))
return true;
break;
return CHelper.IsInBounds(_SelectSlides[interact.Num].RectArrowLeft, x, y) ||
CHelper.IsInBounds(_SelectSlides[interact.Num].RectArrowRight, x, y);
}
return false;
}
@@ -1619,45 +1581,50 @@ namespace VocaluxeLib.Menu
return false;
}
private SRectF _GetRect(int interaction)
private SRectF _GetRect(CInteraction interaction)
{
SRectF result = new SRectF();
switch (_Interactions[interaction].Type)
switch (interaction.Type)
{
case EType.Button:
return _Buttons[_Interactions[interaction].Num].Rect;
return _Buttons[interaction.Num].Rect;
case EType.SelectSlide:
return _SelectSlides[_Interactions[interaction].Num].Rect;
return _SelectSlides[interaction.Num].Rect;
case EType.Static:
return _Statics[_Interactions[interaction].Num].Rect;
return _Statics[interaction.Num].Rect;
case EType.Text:
return _Texts[_Interactions[interaction].Num].Bounds;
return _Texts[interaction.Num].Rect;
case EType.SongMenu:
return _SongMenus[_Interactions[interaction].Num].Rect;
return _SongMenus[interaction.Num].Rect;
case EType.Lyric:
return _Lyrics[_Interactions[interaction].Num].Rect;
return _Lyrics[interaction.Num].Rect;
case EType.NameSelection:
return _NameSelections[_Interactions[interaction].Num].Rect;
return _NameSelections[interaction.Num].Rect;
case EType.Equalizer:
return _Equalizers[_Interactions[interaction].Num].Rect;
return _Equalizers[interaction.Num].Rect;
case EType.Playlist:
return _Playlists[_Interactions[interaction].Num].Rect;
return _Playlists[interaction.Num].Rect;
case EType.ParticleEffect:
return _ParticleEffects[_Interactions[interaction].Num].Rect;
return _ParticleEffects[interaction.Num].Rect;
}
return result;
}
private SRectF _GetRect(int interaction)
{
return _GetRect(_Interactions[interaction]);
}
private void _AddInteraction(int num, EType type)
{
_Interactions.Add(new CInteraction(num, type));
+1 -1
View File
@@ -764,7 +764,7 @@ namespace VocaluxeLib.Menu
alpha = new SColorF(1f, 1f, 1f, 1f);
}
RectangleF bounds = CBase.Drawing.GetTextBounds(text);
RectangleF bounds = CBase.Fonts.GetTextBounds(text);
text.X = (x + dx / 2f + dx * i) + TextRelativeX;
if (!WithTextures)
+63 -319
View File
@@ -32,24 +32,6 @@ namespace VocaluxeLib.Menu
public string SelColorName; //for Buttons
}
struct STextPosition
{
public float X;
public float Y;
public float TextHeight;
public float Width;
public float Height;
public STextPosition(float initVal)
{
X = initVal;
Y = initVal;
TextHeight = initVal;
Width = initVal;
Height = initVal;
}
}
public class CText : IMenuElement
{
private SThemeText _Theme;
@@ -65,8 +47,6 @@ namespace VocaluxeLib.Menu
private bool _ButtonText;
private bool _PositionNeedsUpdate = true;
private STextPosition _DrawPosition = new STextPosition(0);
private float _X;
public float X
{
@@ -127,28 +107,6 @@ namespace VocaluxeLib.Menu
if (Math.Abs(_MaxWidth - value) > 0.01)
{
_MaxWidth = value;
// 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);
_PositionNeedsUpdate = true;
}
}
}
private SRectF _Bounds;
public SRectF Bounds
{
get { return _Bounds; }
set
{
if (Math.Abs(_Bounds.X - value.X) > 0.01 || Math.Abs(_Bounds.Y - value.Y) > 0.01 || Math.Abs(_Bounds.W - value.W) > 0.01 || Math.Abs(_Bounds.H - value.H) > 0.01 ||
Math.Abs(_Bounds.Z - value.Z) > 0.01)
{
_Bounds = value;
_PositionNeedsUpdate = true;
}
}
@@ -168,15 +126,15 @@ namespace VocaluxeLib.Menu
}
}
private EHAlignment _HAlign = EHAlignment.Center;
public EHAlignment HAlign
private EHAlignment _ResizeAlign = EHAlignment.Center;
public EHAlignment ResizeAlign
{
get { return _HAlign; }
get { return _ResizeAlign; }
set
{
if (_HAlign != value)
if (_ResizeAlign != value)
{
_HAlign = value;
_ResizeAlign = value;
_PositionNeedsUpdate = true;
}
}
@@ -210,10 +168,23 @@ namespace VocaluxeLib.Menu
}
}
/// <summary>
/// Do NOT read/write this anywhere but in _UpdateTextPosition!
/// </summary>
private SRectF _Rect;
public SRectF Rect
{
get
{
if (_PositionNeedsUpdate)
_UpdateTextPosition();
return _Rect;
}
}
public SColorF Color; //normal Color
public SColorF SelColor; //selected Color for Buttons
public bool Reflection;
public float ReflectionSpace;
public float ReflectionHeight;
@@ -288,15 +259,13 @@ namespace VocaluxeLib.Menu
_Z = text._Z;
_Height = text._Height;
_MaxWidth = text._MaxWidth;
_Bounds = new SRectF(text._Bounds);
_Align = text._Align;
_HAlign = text._HAlign;
_ResizeAlign = text._ResizeAlign;
_Style = text._Style;
_Font = text._Font;
Color = new SColorF(text.Color);
SelColor = new SColorF(text.SelColor);
Reflection = text.Reflection;
ReflectionSpace = text.ReflectionSpace;
ReflectionHeight = text.ReflectionHeight;
@@ -308,117 +277,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);
Reflection = true;
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);
Reflection = false;
}
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);
Reflection = true;
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;
@@ -432,7 +292,7 @@ namespace VocaluxeLib.Menu
Height = h;
MaxWidth = mw;
Align = align;
HAlign = EHAlignment.Center;
ResizeAlign = EHAlignment.Center;
Style = style;
Font = font;
@@ -443,14 +303,8 @@ namespace VocaluxeLib.Menu
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);
Reflection = false;
ReflectionSpace = rspace;
ReflectionHeight = rheight;
}
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
@@ -495,7 +349,7 @@ namespace VocaluxeLib.Menu
}
_ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Align", ref _Align);
xmlReader.TryGetEnumValue(item + "/HAlign", ref _HAlign);
xmlReader.TryGetEnumValue(item + "/ResizeAlign", ref _ResizeAlign);
_ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Style", ref _Style);
_ThemeLoaded &= xmlReader.GetValue(item + "/Font", out _Font, "Normal");
@@ -503,12 +357,9 @@ namespace VocaluxeLib.Menu
if (xmlReader.ItemExists(item + "/Reflection") && !buttonText)
{
Reflection = true;
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Reflection/Space", ref ReflectionSpace);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Reflection/Height", ref ReflectionHeight);
}
else
Reflection = false;
// Set values
_Theme.Name = elementName;
@@ -516,16 +367,7 @@ namespace VocaluxeLib.Menu
_PositionNeedsUpdate = true;
if (_ThemeLoaded)
{
LoadTextures();
// 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);
}
return _ThemeLoaded;
}
@@ -579,8 +421,8 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<Align>: Text align horizontal: " + CHelper.ListStrings(Enum.GetNames(typeof(EAlignment))));
writer.WriteElementString("Align", Enum.GetName(typeof(EAlignment), Align));
writer.WriteComment("<HAlign>: Text align vertical (on downsizing): " + CHelper.ListStrings(Enum.GetNames(typeof(EHAlignment))));
writer.WriteElementString("HAlign", Enum.GetName(typeof(EHAlignment), HAlign));
writer.WriteComment("<ResizeAlign>: Text align vertical (on downsizing): " + CHelper.ListStrings(Enum.GetNames(typeof(EHAlignment))));
writer.WriteElementString("HAlign", Enum.GetName(typeof(EHAlignment), ResizeAlign));
writer.WriteComment("<Style>: Text style: " + CHelper.ListStrings(Enum.GetNames(typeof(EStyle))));
writer.WriteElementString("Style", Enum.GetName(typeof(EStyle), Style));
@@ -598,7 +440,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment(" <Height>: Reflection Height");
}
if (Reflection && !_ButtonText)
if (ReflectionHeight > 0 && !_ButtonText)
{
writer.WriteStartElement("Reflection");
writer.WriteElementString("Space", ReflectionSpace.ToString("#0"));
@@ -621,155 +463,58 @@ namespace VocaluxeLib.Menu
// Update Text
Text = Text;
if (_PositionNeedsUpdate)
_UpdateTextPosition();
CBase.Fonts.SetFont(Font);
CBase.Fonts.SetStyle(Style);
SColorF currentColor = new SColorF(Color);
if (Selected)
currentColor = new SColorF(SelColor);
SColorF currentColor = (Selected) ? SelColor : Color;
SColorF color = new SColorF(currentColor.R, currentColor.G, currentColor.B, currentColor.A * Alpha);
CBase.Fonts.DrawText(_Text, _DrawPosition.TextHeight, _DrawPosition.X, _DrawPosition.Y, Z, color);
CBase.Fonts.DrawText(_Text, Rect.H, Rect.X, Rect.Y, Z, color);
if (Reflection)
{
float factor = 0f;
switch (HAlign)
{
case EHAlignment.Top:
factor = (Height - _DrawPosition.TextHeight) * 1.5f;
break;
case EHAlignment.Center:
factor = (Height - _DrawPosition.TextHeight) * 1.0f;
break;
case EHAlignment.Bottom:
factor = (Height - _DrawPosition.TextHeight) * 0.5f;
break;
}
CBase.Fonts.DrawTextReflection(_Text, _DrawPosition.TextHeight, _DrawPosition.X, _DrawPosition.Y, Z, color, ReflectionSpace + factor, ReflectionHeight);
}
if (ReflectionHeight > 0)
CBase.Fonts.DrawTextReflection(_Text, Rect.H, Rect.X, Rect.Y, Z, color, ReflectionSpace, ReflectionHeight);
if (Selected && (CBase.Settings.GetGameState() == EGameState.EditTheme))
{
CBase.Drawing.DrawColor(
new SColorF(0.5f, 1f, 0.5f, 0.5f * CBase.Graphics.GetGlobalAlpha()),
new SRectF(_DrawPosition.X, _DrawPosition.Y, _DrawPosition.Width, _DrawPosition.Height, Z)
);
}
CBase.Drawing.DrawColor(new SColorF(0.5f, 1f, 0.5f, 0.5f), new SRectF(Rect.X, Rect.Y, Rect.W, Rect.H, Z));
}
public void Draw(float begin, float end)
{
RectangleF bounds = CBase.Fonts.GetTextBounds(this, Height);
float x = X;
switch (Align)
{
case EAlignment.Center:
x = X - bounds.Width / 2;
break;
case EAlignment.Right:
x = X - bounds.Width;
break;
}
SColorF currentColor = new SColorF(Color);
if (Selected)
currentColor = new SColorF(SelColor);
SColorF color = new SColorF(currentColor.R, currentColor.G, currentColor.B, currentColor.A * Alpha);
CBase.Fonts.SetFont(Font);
CBase.Fonts.SetStyle(Style);
CBase.Fonts.DrawText(Text, Height, x, Y, Z, color, begin, end);
SColorF currentColor = (Selected) ? SelColor : Color;
SColorF color = new SColorF(currentColor.R, currentColor.G, currentColor.B, currentColor.A * Alpha);
if (Reflection)
CBase.Fonts.DrawText(Text, Rect.H, Rect.X, Rect.Y, Z, color, begin, end);
if (ReflectionHeight > 0)
{
// TODO
}
if (Selected && (CBase.Settings.GetGameState() == EGameState.EditTheme))
CBase.Drawing.DrawColor(new SColorF(0.5f, 1f, 0.5f, 0.5f), new SRectF(x, Y, bounds.Width, bounds.Height, Z));
CBase.Drawing.DrawColor(new SColorF(0.5f, 1f, 0.5f, 0.5f), new SRectF(X, Y, Rect.W, Rect.H, Z));
}
public void DrawRelative(float x, float y, float reflectionSpace, float reflectionHeigth, float rectHeight)
public void DrawRelative(float rx, float ry, float reflectionHeight = 0f, float reflectionSpace = 0f, float rectHeight = 0f)
{
DrawRelative(x, y, true, reflectionSpace, reflectionHeigth, rectHeight);
}
public void DrawRelative(float rx, float ry, bool reflection = false, float reflectionSpace = 0f, float reflectionHeight = 0f, float rectHeight = 0f)
{
// Update Text
Text = Text;
float h = Height;
float x = X + rx;
float y = Y + ry;
CBase.Fonts.SetFont(Font);
CBase.Fonts.SetStyle(Style);
RectangleF bounds = CBase.Fonts.GetTextBounds(this, Height);
if (bounds.Width > Bounds.W && Bounds.W > 0f && bounds.Width > 0f)
var oldReflectionSpace = ReflectionSpace;
var oldReflectionHeight = ReflectionHeight;
if (reflectionHeight > 0)
{
float factor = Bounds.W / bounds.Width;
float step = h * (1 - factor);
h *= factor;
switch (HAlign)
{
case EHAlignment.Top:
y += step * 0.25f;
break;
case EHAlignment.Center:
y += step * 0.50f;
break;
case EHAlignment.Bottom:
y += step * 0.75f;
break;
}
bounds = CBase.Fonts.GetTextBounds(this, h);
ReflectionSpace = (rectHeight - Rect.Y - Rect.H) * 2 + reflectionSpace;
ReflectionHeight = reflectionHeight - (rectHeight - Rect.Y) + Rect.H;
}
switch (Align)
{
case EAlignment.Center:
x = x - bounds.Width / 2;
break;
case EAlignment.Right:
x = x - bounds.Width;
break;
}
SColorF currentColor = new SColorF(Color);
if (Selected)
currentColor = new SColorF(SelColor);
SColorF color = new SColorF(currentColor.R, currentColor.G, currentColor.B, currentColor.A * Alpha);
CBase.Fonts.SetFont(Font);
CBase.Fonts.SetStyle(Style);
CBase.Fonts.DrawText(_Text, h, x, y, Z, color);
if (reflection)
{
float space = (rectHeight - Y - bounds.Height) * 2f + reflectionSpace;
float height = reflectionHeight - (rectHeight - Y) + bounds.Height;
CBase.Fonts.DrawTextReflection(_Text, h, x, y, Z, color, space, height);
}
if (Selected && (CBase.Settings.GetGameState() == EGameState.EditTheme))
CBase.Drawing.DrawColor(new SColorF(0.5f, 1f, 0.5f, 0.5f * CBase.Graphics.GetGlobalAlpha()), new SRectF(x, y, bounds.Width, bounds.Height, Z));
else
ReflectionHeight = 0;
X += rx;
Y += ry;
Draw(true);
ReflectionSpace = oldReflectionSpace;
ReflectionHeight = oldReflectionHeight;
X -= rx;
Y -= ry;
}
public void UnloadTextures() {}
@@ -814,14 +559,14 @@ namespace VocaluxeLib.Menu
float h = Height;
float y = Y;
RectangleF bounds = CBase.Fonts.GetTextBounds(this, Height);
RectangleF bounds = CBase.Fonts.GetTextBounds(this);
if (bounds.Width > Bounds.W && Bounds.W > 0f && bounds.Width > 0f)
if (bounds.Width > MaxWidth && MaxWidth > 0f && bounds.Width > 0f)
{
float factor = Bounds.W / bounds.Width;
float factor = MaxWidth / bounds.Width;
float step = h * (1 - factor);
h *= factor;
switch (HAlign)
switch (ResizeAlign)
{
case EHAlignment.Top:
y += step * 0.25f;
@@ -848,11 +593,10 @@ namespace VocaluxeLib.Menu
break;
}
_DrawPosition.X = x;
_DrawPosition.Y = y;
_DrawPosition.TextHeight = h;
_DrawPosition.Width = bounds.Width;
_DrawPosition.Height = bounds.Height;
_Rect.X = x;
_Rect.Y = y;
_Rect.W = bounds.Width;
_Rect.H = bounds.Height;
_PositionNeedsUpdate = false;
}