Merge branch 'develop' of git://github.com/flokuep/Vocaluxe into Better_Graphics_Handling

Conflicts:
	Vocaluxe/COSFunctions.cs
	VocaluxeLib/CHelper.cs
	VocaluxeLib/Menu/CStatic.cs
	VocaluxeLib/Structs.cs
This commit is contained in:
Flamefire committed 2014-09-25 18:49:18 +02:00
commit c156fa69ab
550 files changed
+22434 -23687

No files matched your search

+53 -51
View File
@@ -17,15 +17,21 @@
using System;
using System.Xml;
using System.Xml.Serialization;
using VocaluxeLib.Draw;
namespace VocaluxeLib.Menu
{
struct SThemeStatic
[XmlType("Static")]
public struct SThemeStatic
{
[XmlAttributeAttribute(AttributeName = "Name")]
public string Name;
[XmlElement("Skin")]
public string TextureName;
public string ColorName;
public SThemeColor Color;
public SRectF Rect;
public SReflection Reflection;
}
public class CStatic : IMenuElement
@@ -40,6 +46,11 @@ namespace VocaluxeLib.Menu
return _Theme.Name;
}
public bool ThemeLoaded
{
get { return _ThemeLoaded; }
}
private CTextureRef _Texture;
public CTextureRef Texture
{
@@ -62,6 +73,11 @@ namespace VocaluxeLib.Menu
public EAspect Aspect = EAspect.Stretch;
public CStatic()
{
}
public CStatic(int partyModeID)
{
_PartyModeID = partyModeID;
@@ -100,6 +116,14 @@ namespace VocaluxeLib.Menu
Rect = rect;
}
public CStatic(SThemeStatic theme, int partyModeID)
{
_PartyModeID = partyModeID;
_Theme = theme;
LoadTextures();
}
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
{
string item = xmlPath + "/" + elementName;
@@ -113,8 +137,10 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H);
if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color);
_Theme.Rect = new SRectF(Rect);
if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty))
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.Color.Name, skinIndex, out Color);
else
{
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R);
@@ -123,14 +149,20 @@ namespace VocaluxeLib.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A);
}
_Theme.Color.Color = new SColorF(Color);
if (xmlReader.ItemExists(item + "/Reflection"))
{
Reflection = true;
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Reflection/Space", ref ReflectionSpace);
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Reflection/Height", ref ReflectionHeight);
_Theme.Reflection = new SReflection(true, ReflectionHeight, ReflectionSpace);
}
else
{
Reflection = false;
_Theme.Reflection = new SReflection(false, 0f, 0f);
}
if (_ThemeLoaded)
{
@@ -140,51 +172,6 @@ namespace VocaluxeLib.Menu
return _ThemeLoaded;
}
public bool SaveTheme(XmlWriter writer)
{
if (_ThemeLoaded)
{
writer.WriteStartElement(_Theme.Name);
writer.WriteComment("<Skin>: Texture name");
writer.WriteElementString("Skin", _Theme.TextureName);
writer.WriteComment("<X>, <Y>, <Z>, <W>, <H>: Static position, width and height");
writer.WriteElementString("X", Rect.X.ToString("#0"));
writer.WriteElementString("Y", Rect.Y.ToString("#0"));
writer.WriteElementString("Z", Rect.Z.ToString("#0.00"));
writer.WriteElementString("W", Rect.W.ToString("#0"));
writer.WriteElementString("H", Rect.H.ToString("#0"));
writer.WriteComment("<Color>: Static color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (!String.IsNullOrEmpty(_Theme.ColorName))
writer.WriteElementString("Color", _Theme.ColorName);
else
{
writer.WriteElementString("R", Color.R.ToString("#0.00"));
writer.WriteElementString("G", Color.G.ToString("#0.00"));
writer.WriteElementString("B", Color.B.ToString("#0.00"));
writer.WriteElementString("A", Color.A.ToString("#0.00"));
}
writer.WriteComment("<Reflection> If exists:");
writer.WriteComment(" <Space>: Reflection Space");
writer.WriteComment(" <Height>: Reflection Height");
if (Reflection)
{
writer.WriteStartElement("Reflection");
writer.WriteElementString("Space", ReflectionSpace.ToString("#0"));
writer.WriteElementString("Height", ReflectionHeight.ToString("#0"));
writer.WriteEndElement();
}
writer.WriteEndElement();
return true;
}
return false;
}
public void Draw(bool forceDraw = false)
{
Draw(Aspect, 1f, 0f, forceDraw);
@@ -219,8 +206,18 @@ namespace VocaluxeLib.Menu
public void LoadTextures()
{
if (!String.IsNullOrEmpty(_Theme.ColorName))
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
if (!String.IsNullOrEmpty(_Theme.Color.Name))
Color = CBase.Theme.GetColor(_Theme.Color.Name, _PartyModeID);
else
Color = _Theme.Color.Color;
Rect = new SRectF(_Theme.Rect);
Reflection = _Theme.Reflection.Enabled;
if (Reflection)
{
ReflectionSpace = _Theme.Reflection.Space;
ReflectionHeight = _Theme.Reflection.Height;
}
}
public void ReloadTextures()
@@ -229,6 +226,11 @@ namespace VocaluxeLib.Menu
LoadTextures();
}
public SThemeStatic GetTheme()
{
return _Theme;
}
#region ThemeEdit
public void MoveElement(int stepX, int stepY)
{