Merge branch 'Better_Graphics_Handling' into develop

Conflicts:
	Vocaluxe/Base/CBackgroundMusic.cs
	Vocaluxe/Base/CCover.cs
	Vocaluxe/Base/CDataBase.cs
	Vocaluxe/Base/CDraw.cs
	Vocaluxe/Base/CMain.cs
	Vocaluxe/Base/CProfiles.cs
	Vocaluxe/Base/CTheme.cs
	Vocaluxe/Base/CVideo.cs
	Vocaluxe/Base/CWebcam.cs
	Vocaluxe/Base/Fonts/CFont.cs
	Vocaluxe/Base/Fonts/CGlyph.cs
	Vocaluxe/Lib/Draw/CDirect3D.cs
	Vocaluxe/Lib/Draw/CDrawWinForm.cs
	Vocaluxe/Lib/Draw/COpenGL.cs
	Vocaluxe/Lib/Draw/IDraw.cs
	Vocaluxe/Lib/Video/CVideoDecoder.cs
	Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs
	Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs
	Vocaluxe/Lib/Video/IVideoDecoder.cs
	Vocaluxe/Lib/Webcam/CAForgeNet.cs
	Vocaluxe/Lib/Webcam/IWebcam.cs
	Vocaluxe/Screens/CScreenCredits.cs
	Vocaluxe/Screens/CScreenNames.cs
	Vocaluxe/Screens/CScreenOptionsVideo.cs
	Vocaluxe/Screens/CScreenProfiles.cs
	Vocaluxe/Screens/CScreenSing.cs
	VocaluxeLib/Menu/IMenu.cs
	VocaluxeLib/Songs/CCategory.cs
	VocaluxeLib/Songs/CSong.cs
	VocaluxeLib/Structs.cs
	VocaluxeLib/VocaluxeLib.csproj
This commit is contained in:
Flamefire committed 2013-05-19 17:53:46 +02:00
commit 9d13c32b93
56 files changed
+1579 -1772

No files matched your search

+18 -17
View File
@@ -20,6 +20,7 @@
using System;
using System.Drawing;
using System.Xml;
using VocaluxeLib.Draw;
namespace VocaluxeLib.Menu
{
@@ -118,7 +119,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<Color>: Background color for type \"Color\" from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName != "")
if (!String.IsNullOrEmpty(_Theme.ColorName))
writer.WriteElementString("Color", _Theme.ColorName);
else
{
@@ -139,13 +140,13 @@ namespace VocaluxeLib.Menu
public void Resume()
{
if (_Theme.Type == EBackgroundTypes.Video && _Theme.VideoName != "" && CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_ON)
if (_Theme.Type == EBackgroundTypes.Video && !String.IsNullOrEmpty(_Theme.VideoName) && CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_ON)
CBase.Theme.SkinVideoResume(_Theme.VideoName, _PartyModeID);
}
public void Pause()
{
if (_Theme.VideoName != "")
if (!String.IsNullOrEmpty(_Theme.VideoName))
CBase.Theme.SkinVideoPause(_Theme.VideoName, _PartyModeID);
}
@@ -165,7 +166,7 @@ namespace VocaluxeLib.Menu
ok = _DrawVideo();
}
if (_Theme.TextureName != "" &&
if (!String.IsNullOrEmpty(_Theme.TextureName) &&
(_Theme.Type == EBackgroundTypes.Texture ||
(_Theme.Type == EBackgroundTypes.Video && (CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_OFF || !ok))))
ok = _DrawTexture();
@@ -181,7 +182,7 @@ namespace VocaluxeLib.Menu
public void LoadTextures()
{
if (_Theme.ColorName != "")
if (!String.IsNullOrEmpty(_Theme.ColorName))
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
}
@@ -202,12 +203,12 @@ namespace VocaluxeLib.Menu
private bool _DrawTexture()
{
STexture texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
if (texture.Height > 0)
CTexture texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
if (texture != null)
{
RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
RectangleF rect = new RectangleF(0f, 0f, texture.Width, texture.Height);
CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop);
RectangleF rect;
CHelper.SetRect(bounds, out rect, texture.OrigAspect, EAspect.Crop);
CBase.Drawing.DrawTexture(texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
return true;
@@ -217,12 +218,12 @@ namespace VocaluxeLib.Menu
private bool _DrawVideo()
{
STexture videoTexture = CBase.Theme.GetSkinVideoTexture(_Theme.VideoName, _PartyModeID);
if (videoTexture.Height > 0)
CTexture videoTexture = CBase.Theme.GetSkinVideoTexture(_Theme.VideoName, _PartyModeID);
if (videoTexture != null)
{
RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
RectangleF rect = new RectangleF(0f, 0f, videoTexture.Width, videoTexture.Height);
CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop);
RectangleF rect;
CHelper.SetRect(bounds, out rect, videoTexture.OrigAspect, EAspect.Crop);
CBase.Drawing.DrawTexture(videoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
return true;
@@ -232,12 +233,12 @@ namespace VocaluxeLib.Menu
private bool _DrawBackgroundMusicVideo()
{
STexture videoTexture = CBase.BackgroundMusic.GetVideoTexture();
if (videoTexture.Height > 0)
CTexture videoTexture = CBase.BackgroundMusic.GetVideoTexture();
if (videoTexture != null)
{
RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
RectangleF rect = new RectangleF(0f, 0f, videoTexture.Width, videoTexture.Height);
CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop);
RectangleF rect;
CHelper.SetRect(bounds, out rect, videoTexture.OrigAspect, EAspect.Crop);
CBase.Drawing.DrawTexture(videoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
return true;
+13 -33
View File
@@ -19,6 +19,7 @@
using System;
using System.Xml;
using VocaluxeLib.Draw;
namespace VocaluxeLib.Menu
{
@@ -39,8 +40,8 @@ namespace VocaluxeLib.Menu
private bool _ThemeLoaded;
private readonly int _PartyModeID;
public STexture Texture;
public STexture SelTexture;
public CTexture Texture;
public CTexture SelTexture;
public SRectF Rect;
public SColorF Color;
public SColorF SelColor;
@@ -79,8 +80,8 @@ namespace VocaluxeLib.Menu
Text.Selected = value;
}
}
public bool Visible;
public bool Enabled;
public bool Visible = true;
public bool Enabled = true;
public string GetThemeName()
{
@@ -90,28 +91,10 @@ namespace VocaluxeLib.Menu
public CButton(int partyModeID)
{
_PartyModeID = partyModeID;
_Theme = new SThemeButton();
Rect = new SRectF();
Color = new SColorF();
SelColor = new SColorF();
Texture = new STexture(-1);
SelTexture = new STexture(-1);
_IsSelText = false;
Text = new CText(_PartyModeID);
_SelText = new CText(_PartyModeID);
Selected = false;
Visible = true;
EditMode = false;
Enabled = true;
_Reflection = false;
_ReflectionSpace = 0f;
_ReflectionHeight = 0f;
_SelReflection = false;
_SelReflectionSpace = 0f;
_SelReflectionHeight = 0f;
}
public CButton(CButton button)
@@ -131,13 +114,10 @@ namespace VocaluxeLib.Menu
Texture = button.Texture;
SelTexture = button.SelTexture;
_IsSelText = false;
Text = new CText(button.Text);
_SelText = new CText(button._SelText);
Selected = false;
Visible = true;
EditMode = false;
_ThemeLoaded = false;
Enabled = button.Enabled;
_Reflection = button._Reflection;
@@ -241,7 +221,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<Color>: Button color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName != "")
if (!String.IsNullOrEmpty(_Theme.ColorName))
writer.WriteElementString("Color", _Theme.ColorName);
else
{
@@ -253,7 +233,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<SColor>: Selected button color from ColorScheme (high priority)");
writer.WriteComment("or <SR>, <SG>, <SB>, <SA> (lower priority)");
if (_Theme.SelColorName != "")
if (!String.IsNullOrEmpty(_Theme.SelColorName))
writer.WriteElementString("SColor", _Theme.SelColorName);
else
{
@@ -301,11 +281,11 @@ namespace VocaluxeLib.Menu
if (!Visible && CBase.Settings.GetGameState() != EGameState.EditTheme && !forceDraw)
return;
STexture texture;
CTexture texture;
if (!Selected && !Pressed || !Enabled)
{
texture = Texture.Index != -1 ? Texture : CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
texture = Texture ?? CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
CBase.Drawing.DrawTexture(texture, Rect, Color);
@@ -319,7 +299,7 @@ namespace VocaluxeLib.Menu
}
else if (!_IsSelText)
{
texture = Texture.Index != -1 ? Texture : CBase.Theme.GetSkinTexture(_Theme.SelTextureName, _PartyModeID);
texture = Texture ?? CBase.Theme.GetSkinTexture(_Theme.SelTextureName, _PartyModeID);
CBase.Drawing.DrawTexture(texture, Rect, SelColor);
@@ -333,7 +313,7 @@ namespace VocaluxeLib.Menu
}
else if (_IsSelText)
{
texture = SelTexture.Index != -1 ? SelTexture : CBase.Theme.GetSkinTexture(_Theme.SelTextureName, _PartyModeID);
texture = SelTexture ?? CBase.Theme.GetSkinTexture(_Theme.SelTextureName, _PartyModeID);
CBase.Drawing.DrawTexture(texture, Rect, SelColor);
@@ -361,10 +341,10 @@ namespace VocaluxeLib.Menu
{
Text.LoadTextures();
if (_Theme.ColorName != "")
if (!String.IsNullOrEmpty(_Theme.ColorName))
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
if (_Theme.SelColorName != "")
if (!String.IsNullOrEmpty(_Theme.SelColorName))
SelColor = CBase.Theme.GetColor(_Theme.SelColorName, _PartyModeID);
}
+4 -4
View File
@@ -175,7 +175,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<Color>: Equalizer color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName != "")
if (!String.IsNullOrEmpty(_Theme.ColorName))
writer.WriteElementString("Color", _Theme.ColorName);
else
{
@@ -186,7 +186,7 @@ namespace VocaluxeLib.Menu
}
writer.WriteComment("<MaxColor>: Equalizer color for maximal volume from ColorScheme (high priority)");
writer.WriteComment("or <MaxR>, <MaxG>, <MaxB>, <MaxA> (lower priority)");
if (_Theme.ColorName != "")
if (!String.IsNullOrEmpty(_Theme.ColorName))
writer.WriteElementString("MaxColor", _Theme.ColorName);
else
{
@@ -274,10 +274,10 @@ namespace VocaluxeLib.Menu
public void LoadTextures()
{
if (_Theme.ColorName != "")
if (!String.IsNullOrEmpty(_Theme.ColorName))
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
if (_Theme.MaxColorName != "")
if (!String.IsNullOrEmpty(_Theme.MaxColorName))
MaxColor = CBase.Theme.GetColor(_Theme.MaxColorName, _PartyModeID);
}
+4 -4
View File
@@ -172,7 +172,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<Color>: Lyric text color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName != "")
if (!String.IsNullOrEmpty(_Theme.ColorName))
writer.WriteElementString("Color", _Theme.ColorName);
else
{
@@ -184,7 +184,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<SColor>: Highlighted lyric color from ColorScheme (high priority)");
writer.WriteComment("or <SR>, <SG>, <SB>, <SA> (lower priority)");
if (_Theme.SelColorName != "")
if (!String.IsNullOrEmpty(_Theme.SelColorName))
writer.WriteElementString("SColor", _Theme.SelColorName);
else
{
@@ -521,10 +521,10 @@ namespace VocaluxeLib.Menu
public void LoadTextures()
{
if (_Theme.ColorName != "")
if (!String.IsNullOrEmpty(_Theme.ColorName))
_Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
if (_Theme.SelColorName != "")
if (!String.IsNullOrEmpty(_Theme.SelColorName))
_ColorProcessed = CBase.Theme.GetColor(_Theme.SelColorName, _PartyModeID);
}
+3 -2
View File
@@ -24,6 +24,7 @@ using System.IO;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using VocaluxeLib.Draw;
using VocaluxeLib.Menu.SingNotes;
using VocaluxeLib.Menu.SongMenu;
@@ -478,7 +479,7 @@ namespace VocaluxeLib.Menu
return new CStatic(oldStatic);
}
public CStatic GetNewStatic(STexture texture, SColorF color, SRectF rect)
public CStatic GetNewStatic(CTexture texture, SColorF color, SRectF rect)
{
return new CStatic(_PartyModeID, texture, color, rect);
}
@@ -523,7 +524,7 @@ namespace VocaluxeLib.Menu
return new CPlaylist(_PartyModeID);
}
public CParticleEffect GetNewParticleEffect(int maxNumber, SColorF color, SRectF area, STexture texture, float size, EParticleType type)
public CParticleEffect GetNewParticleEffect(int maxNumber, SColorF color, SRectF area, CTexture texture, float size, EParticleType type)
{
return new CParticleEffect(_PartyModeID, maxNumber, color, area, texture, size, type);
}
+8 -7
View File
@@ -21,6 +21,7 @@ using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Xml;
using VocaluxeLib.Draw;
using VocaluxeLib.Profile;
@@ -71,8 +72,8 @@ namespace VocaluxeLib.Menu
public SRectF Rect;
private readonly List<CTile> _Tiles;
private STexture _TextureEmptyTile;
private STexture _TextureTileSelected;
private CTexture _TextureEmptyTile;
private CTexture _TextureTileSelected;
public SColorF ColorEmptyTile;
@@ -194,7 +195,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<ColorEmptyTile>: Static color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorEmptyTileName != "")
if (!String.IsNullOrEmpty(_Theme.ColorEmptyTileName))
writer.WriteElementString("ColorEmptyTile", _Theme.ColorEmptyTileName);
else
{
@@ -225,7 +226,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<Font>: Text font name");
writer.WriteElementString("Font", _Theme.NameFont);
writer.WriteComment("<Color>: Text color from ColorScheme (high priority)");
if (_Theme.NameColorName != "")
if (!String.IsNullOrEmpty(_Theme.NameColorName))
writer.WriteElementString("Color", _Theme.NameColorName);
else
{
@@ -350,7 +351,7 @@ namespace VocaluxeLib.Menu
public void HandleMouse(SMouseEvent mevent)
{
for (int i = 0; i < _Tiles.Count; i++ )
for (int i = 0; i < _Tiles.Count; i++)
{
if (CHelper.IsInBounds(_Tiles[i].Avatar.Rect, mevent))
{
@@ -465,10 +466,10 @@ namespace VocaluxeLib.Menu
_TextureEmptyTile = CBase.Theme.GetSkinTexture(_Theme.TextureEmptyTileName, _PartyModeID);
_TextureTileSelected = CBase.Theme.GetSkinTexture(_Theme.TextureTileSelectedName, _PartyModeID);
if (_Theme.ColorEmptyTileName != "")
if (!String.IsNullOrEmpty(_Theme.ColorEmptyTileName))
ColorEmptyTile = CBase.Theme.GetColor(_Theme.ColorEmptyTileName, _PartyModeID);
if (_Theme.NameColorName != "")
if (!String.IsNullOrEmpty(_Theme.NameColorName))
_Theme.NameColor = CBase.Theme.GetColor(_Theme.NameColorName, _PartyModeID);
}
+13 -24
View File
@@ -21,6 +21,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Xml;
using VocaluxeLib.Draw;
namespace VocaluxeLib.Menu
{
@@ -45,11 +46,11 @@ namespace VocaluxeLib.Menu
#region private vars
private readonly int _PartyModeID;
private readonly string _TextureName;
private readonly STexture _Texture;
private readonly CTexture _Texture;
private SRectF _Rect;
private float _Size;
private SColorF _Color;
private float _Alpha;
private float _Alpha = 1;
private float _Angle; //0..360°
private readonly float _MaxAge; //[s]
private float _Age; //[s]
@@ -61,7 +62,7 @@ namespace VocaluxeLib.Menu
private float _LastTime;
private readonly EParticleType _Type;
private readonly Stopwatch _Timer;
private readonly Stopwatch _Timer = new Stopwatch();
#endregion private vars
#region public vars
@@ -115,26 +116,20 @@ namespace VocaluxeLib.Menu
{
_PartyModeID = partyModeID;
_TextureName = textureName;
_Texture = new STexture(-1);
_Color = color;
_Rect = new SRectF(x, y, size, size, z);
_Size = size;
_Alpha = 1f;
_Angle = 0f;
_Vx = vx;
_Vy = vy;
_Vr = vr;
_Vsize = vsize;
_LastTime = 0f;
_Type = type;
_Timer = new Stopwatch();
_Age = 0f;
_MaxAge = maxage;
_Rotation = (float)(CBase.Game.GetRandomDouble() * 360.0);
}
public CParticle(int partyModeID, STexture texture, SColorF color, float x, float y, float size, float maxage, float z, float vx, float vy, float vr, float vsize,
public CParticle(int partyModeID, CTexture texture, SColorF color, float x, float y, float size, float maxage, float z, float vx, float vy, float vr, float vsize,
EParticleType type)
{
_PartyModeID = partyModeID;
@@ -143,17 +138,12 @@ namespace VocaluxeLib.Menu
_Color = color;
_Rect = new SRectF(x, y, size, size, z);
_Size = size;
_Alpha = 1f;
_Angle = 0f;
_Vx = vx;
_Vy = vy;
_Vr = vr;
_Vsize = vsize;
_LastTime = 0f;
_Type = type;
_Timer = new Stopwatch();
_Age = 0f;
_MaxAge = maxage;
_Rotation = (float)(CBase.Game.GetRandomDouble() * 360.0);
}
@@ -298,7 +288,7 @@ namespace VocaluxeLib.Menu
public void Draw()
{
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if (_TextureName != "")
if (!String.IsNullOrEmpty(_TextureName))
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
CBase.Drawing.DrawTexture(CBase.Theme.GetSkinTexture(_TextureName, _PartyModeID), _Rect, new SColorF(_Color.R, _Color.G, _Color.B, _Color.A * Alpha2 * _Alpha));
else
@@ -312,7 +302,7 @@ namespace VocaluxeLib.Menu
private SThemeParticleEffect _Theme;
private bool _ThemeLoaded;
public STexture Texture;
public CTexture Texture;
public SColorF Color;
public SRectF Rect;
@@ -356,7 +346,6 @@ namespace VocaluxeLib.Menu
Rect = rect;
Color = color;
_Theme.TextureName = textureName;
Texture = new STexture(-1);
_MaxNumber = maxNumber;
_Size = size;
_Type = type;
@@ -365,7 +354,7 @@ namespace VocaluxeLib.Menu
Visible = true;
}
public CParticleEffect(int partyModeID, int maxNumber, SColorF color, SRectF rect, STexture texture, float size, EParticleType type)
public CParticleEffect(int partyModeID, int maxNumber, SColorF color, SRectF rect, CTexture texture, float size, EParticleType type)
{
_PartyModeID = partyModeID;
_Theme = new SThemeParticleEffect();
@@ -435,7 +424,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<Color>: ParticleEffect color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName != "")
if (!String.IsNullOrEmpty(_Theme.ColorName))
writer.WriteElementString("Color", _Theme.ColorName);
else
{
@@ -546,7 +535,7 @@ namespace VocaluxeLib.Menu
h = 0;
CParticle star;
if (_Theme.TextureName != "")
if (!String.IsNullOrEmpty(_Theme.TextureName))
{
star = new CParticle(_PartyModeID, _Theme.TextureName, Color,
CBase.Game.GetRandom(w) + Rect.X - size / 4f,
@@ -602,14 +591,14 @@ namespace VocaluxeLib.Menu
public void UnloadTextures()
{
Texture = new STexture();
Texture = null;
}
public void LoadTextures()
{
if (_Theme.ColorName != "")
if (!String.IsNullOrEmpty(_Theme.ColorName))
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
if (_Theme.TextureName != "")
if (!String.IsNullOrEmpty(_Theme.TextureName))
Texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
}
+5 -5
View File
@@ -373,7 +373,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<ColorBackground>: Button color from ColorScheme (high priority)");
writer.WriteComment("or <BackgroundR>, <BackgroundG>, <BackgroundB>, <BackgroundA> (lower priority)");
if (_Theme.ColorBackgroundName != "")
if (!String.IsNullOrEmpty(_Theme.ColorBackgroundName))
writer.WriteElementString("ColorBackground", _Theme.ColorBackgroundName);
else
{
@@ -385,7 +385,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<SColorBackground>: Selected paylist-entry color from ColorScheme (high priority)");
writer.WriteComment("or <SBackgroundR>, <SBackgroundG>, <SBackgroundB>, <SBackgroundA> (lower priority)");
if (_Theme.SelColorBackgroundName != "")
if (!String.IsNullOrEmpty(_Theme.SelColorBackgroundName))
writer.WriteElementString("SColorBackground", _Theme.SelColorBackgroundName);
else
{
@@ -464,10 +464,10 @@ namespace VocaluxeLib.Menu
public void LoadTextures()
{
if (_Theme.ColorBackgroundName != "")
if (!String.IsNullOrEmpty(_Theme.ColorBackgroundName))
BackgroundColor = CBase.Theme.GetColor(_Theme.ColorBackgroundName, _PartyModeID);
if (_Theme.SelColorBackgroundName != "")
if (!String.IsNullOrEmpty(_Theme.SelColorBackgroundName))
BackgroundSelColor = CBase.Theme.GetColor(_Theme.SelColorBackgroundName, _PartyModeID);
_Theme.Text1.LoadTextures();
@@ -518,7 +518,7 @@ namespace VocaluxeLib.Menu
break;
case Keys.Delete:
case Keys.Back:
if (_Theme.ButtonPlaylistName.Text.Text != "")
if (!String.IsNullOrEmpty(_Theme.ButtonPlaylistName.Text.Text))
_Theme.ButtonPlaylistName.Text.Text = _Theme.ButtonPlaylistName.Text.Text.Remove(_Theme.ButtonPlaylistName.Text.Text.Length - 1);
break;
}
+2 -1
View File
@@ -19,6 +19,7 @@
using System;
using System.Xml;
using VocaluxeLib.Draw;
namespace VocaluxeLib.Menu
{
@@ -127,7 +128,7 @@ namespace VocaluxeLib.Menu
}
}
private STexture _GetTextureValue(string value)
private CTexture _GetTextureValue(string value)
{
return CBase.Theme.GetSkinTexture(value, _PartyModeID);
}
+32 -36
View File
@@ -21,6 +21,7 @@ using System;
using System.Collections.Generic;
using System.Drawing;
using System.Xml;
using VocaluxeLib.Draw;
namespace VocaluxeLib.Menu
{
@@ -110,7 +111,7 @@ namespace VocaluxeLib.Menu
private readonly List<string> _ValueNames;
private readonly List<int> _ValuePartyModeIDs;
private readonly List<STexture> _Textures;
private readonly List<CTexture> _Textures;
private readonly List<int> _ValueIndexes;
private readonly List<SRectF> _ValueBounds = new List<SRectF>();
@@ -178,7 +179,7 @@ namespace VocaluxeLib.Menu
MaxW = 0f;
_Selected = false;
_Textures = new List<STexture>();
_Textures = new List<CTexture>();
_ValueIndexes = new List<int>();
_ValueNames = new List<string>();
_ValuePartyModeIDs = new List<int>();
@@ -226,7 +227,7 @@ namespace VocaluxeLib.Menu
MaxW = slide.MaxW;
_Selected = slide._Selected;
_Textures = new List<STexture>(slide._Textures);
_Textures = new List<CTexture>(slide._Textures);
_ValueIndexes = new List<int>(slide._ValueIndexes);
_ValueNames = new List<string>(slide._ValueNames);
_ValueBounds = new List<SRectF>(slide._ValueBounds);
@@ -411,7 +412,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<Color>: SelectSlide color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName != "")
if (!String.IsNullOrEmpty(_Theme.ColorName))
writer.WriteElementString("Color", _Theme.ColorName);
else
{
@@ -423,7 +424,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<SColor>: Selected SelectSlide color from ColorScheme (high priority)");
writer.WriteComment("or <SR>, <SG>, <SB>, <SA> (lower priority)");
if (_Theme.SelColorName != "")
if (!String.IsNullOrEmpty(_Theme.SelColorName))
writer.WriteElementString("SColor", _Theme.SelColorName);
else
{
@@ -435,7 +436,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<HColor>: Highlighted SelectSlide color from ColorScheme (high priority)");
writer.WriteComment("or <HR>, <HG>, <HB>, <HA> (lower priority)");
if (_Theme.HighlightColorName != "")
if (!String.IsNullOrEmpty(_Theme.HighlightColorName))
writer.WriteElementString("HColor", _Theme.HighlightColorName);
else
{
@@ -447,7 +448,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<ArrowColor>: Arrow color from ColorScheme (high priority)");
writer.WriteComment("or <ArrowR>, <ArrowG>, <ArrowB>, <ArrowA> (lower priority)");
if (_Theme.ArrowColorName != "")
if (!String.IsNullOrEmpty(_Theme.ArrowColorName))
writer.WriteElementString("ArrowColor", _Theme.ArrowColorName);
else
{
@@ -459,7 +460,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<ArrowSColor>: Selected arrow color from ColorScheme (high priority)");
writer.WriteComment("or <ArrowSR>, <ArrowSG>, <ArrowSB>, <ArrowSA> (lower priority)");
if (_Theme.SelArrowColorName != "")
if (!String.IsNullOrEmpty(_Theme.SelArrowColorName))
writer.WriteElementString("ArrowSColor", _Theme.SelArrowColorName);
else
{
@@ -471,7 +472,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<TextColor>: Text color from ColorScheme (high priority)");
writer.WriteComment("or <TextR>, <TextG>, <TextB>, <TextA> (lower priority)");
if (_Theme.TextColorName != "")
if (!String.IsNullOrEmpty(_Theme.TextColorName))
writer.WriteElementString("TextColor", _Theme.TextColorName);
else
{
@@ -483,7 +484,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<TextSColor>: Selected text color from ColorScheme (high priority)");
writer.WriteComment("or <TextSR>, <TextSG>, <TextSB>, <TextSA> (lower priority)");
if (_Theme.SelTextColorName != "")
if (!String.IsNullOrEmpty(_Theme.SelTextColorName))
writer.WriteElementString("TextSColor", _Theme.SelTextColorName);
else
{
@@ -530,20 +531,20 @@ namespace VocaluxeLib.Menu
public void AddValue(string value, int partyModeID)
{
AddValue(value, new STexture(-1), _ValueIndexes.Count, partyModeID);
AddValue(value, null, _ValueIndexes.Count, partyModeID);
}
public void AddValue(string value, STexture texture)
public void AddValue(string value, CTexture texture)
{
AddValue(value, texture, _ValueIndexes.Count, _PartyModeID);
}
private void _AddValue(string value, STexture texture, int valueIndex)
private void _AddValue(string value, CTexture texture, int valueIndex)
{
AddValue(value, texture, valueIndex, _PartyModeID);
}
public void AddValue(string value, STexture texture, int valueIndex, int partyModeID)
public void AddValue(string value, CTexture texture, int valueIndex, int partyModeID)
{
_ValueNames.Add(value);
_Textures.Add(texture);
@@ -559,12 +560,12 @@ namespace VocaluxeLib.Menu
public void AddValues(IEnumerable<string> values)
{
foreach (string value in values)
_AddValue(value, new STexture(-1), _PartyModeID);
_AddValue(value, null, _PartyModeID);
_ValueBounds.Clear();
}
public void AddValues(string[] values, STexture[] textures)
public void AddValues(string[] values, CTexture[] textures)
{
if (values.Length != textures.Length)
return;
@@ -588,12 +589,7 @@ namespace VocaluxeLib.Menu
RenameValue(Selection, newName);
}
public void RenameValue(int selection, string newName)
{
RenameValue(selection, newName, new STexture(-1));
}
public void RenameValue(int selection, string newName, STexture newTexture)
public void RenameValue(int selection, string newName, CTexture newTexture = null)
{
if (selection < 0 && selection >= _ValueNames.Count)
return;
@@ -696,15 +692,15 @@ namespace VocaluxeLib.Menu
if (!Visible && CBase.Settings.GetGameState() != EGameState.EditTheme)
return;
STexture texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
STexture textureArrowLeft = CBase.Theme.GetSkinTexture(_Theme.TextureArrowLeftName, _PartyModeID);
STexture textureArrowRight = CBase.Theme.GetSkinTexture(_Theme.TextureArrowRightName, _PartyModeID);
CTexture texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
CTexture textureArrowLeft = CBase.Theme.GetSkinTexture(_Theme.TextureArrowLeftName, _PartyModeID);
CTexture textureArrowRight = CBase.Theme.GetSkinTexture(_Theme.TextureArrowRightName, _PartyModeID);
STexture selTexture = CBase.Theme.GetSkinTexture(_Theme.SelTextureName, _PartyModeID);
STexture selTextureArrowLeft = CBase.Theme.GetSkinTexture(_Theme.SelTextureArrowLeftName, _PartyModeID);
STexture selTextureArrowRight = CBase.Theme.GetSkinTexture(_Theme.SelTextureArrowRightName, _PartyModeID);
CTexture selTexture = CBase.Theme.GetSkinTexture(_Theme.SelTextureName, _PartyModeID);
CTexture selTextureArrowLeft = CBase.Theme.GetSkinTexture(_Theme.SelTextureArrowLeftName, _PartyModeID);
CTexture selTextureArrowRight = CBase.Theme.GetSkinTexture(_Theme.SelTextureArrowRightName, _PartyModeID);
STexture highlightTexture = CBase.Theme.GetSkinTexture(_Theme.HighlightTextureName, _PartyModeID);
CTexture highlightTexture = CBase.Theme.GetSkinTexture(_Theme.HighlightTextureName, _PartyModeID);
if (Selected)
{
@@ -791,25 +787,25 @@ namespace VocaluxeLib.Menu
public void LoadTextures()
{
if (_Theme.ColorName != "")
if (!String.IsNullOrEmpty(_Theme.ColorName))
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
if (_Theme.SelColorName != "")
if (!String.IsNullOrEmpty(_Theme.SelColorName))
SelColor = CBase.Theme.GetColor(_Theme.SelColorName, _PartyModeID);
if (_Theme.HighlightColorName != "")
if (!String.IsNullOrEmpty(_Theme.HighlightColorName))
HighlightColor = CBase.Theme.GetColor(_Theme.HighlightColorName, _PartyModeID);
if (_Theme.ArrowColorName != "")
if (!String.IsNullOrEmpty(_Theme.ArrowColorName))
ColorArrow = CBase.Theme.GetColor(_Theme.ArrowColorName, _PartyModeID);
if (_Theme.SelArrowColorName != "")
if (!String.IsNullOrEmpty(_Theme.SelArrowColorName))
SelColorArrow = CBase.Theme.GetColor(_Theme.SelArrowColorName, _PartyModeID);
if (_Theme.TextColorName != "")
if (!String.IsNullOrEmpty(_Theme.TextColorName))
TextColor = CBase.Theme.GetColor(_Theme.TextColorName, _PartyModeID);
if (_Theme.SelColorName != "")
if (!String.IsNullOrEmpty(_Theme.SelColorName))
SelTextColor = CBase.Theme.GetColor(_Theme.SelTextColorName, _PartyModeID);
}
+12 -45
View File
@@ -20,6 +20,7 @@
using System;
using System.Drawing;
using System.Xml;
using VocaluxeLib.Draw;
namespace VocaluxeLib.Menu
{
@@ -42,10 +43,10 @@ namespace VocaluxeLib.Menu
return _Theme.Name;
}
private STexture _Texture;
public STexture Texture
private CTexture _Texture;
public CTexture Texture
{
get { return _Texture.Index != -1 ? _Texture : CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID); }
get { return _Texture ?? CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID); }
set { _Texture = value; }
}
@@ -58,35 +59,20 @@ namespace VocaluxeLib.Menu
public float ReflectionHeight;
public bool Selected;
public bool Visible;
public bool Visible = true;
public float Alpha;
public float Alpha = 1;
public EAspect Aspect = EAspect.Stretch;
public CStatic(int partyModeID)
{
_PartyModeID = partyModeID;
_Theme = new SThemeStatic();
_ThemeLoaded = false;
_Texture = new STexture(-1);
Color = new SColorF();
Rect = new SRectF();
Reflection = false;
ReflectionSpace = 0f;
ReflectionHeight = 0f;
Selected = false;
Alpha = 1f;
Visible = true;
}
public CStatic(CStatic s)
{
_PartyModeID = s._PartyModeID;
_Theme = new SThemeStatic();
_ThemeLoaded = false;
_Texture = s.Texture;
Color = new SColorF(s.Color);
@@ -100,40 +86,21 @@ namespace VocaluxeLib.Menu
Visible = s.Visible;
}
public CStatic(int partyModeID, STexture texture, SColorF color, SRectF rect)
public CStatic(int partyModeID, CTexture texture, SColorF color, SRectF rect)
{
_PartyModeID = partyModeID;
_Theme = new SThemeStatic();
_ThemeLoaded = false;
_Texture = texture;
Color = color;
Rect = rect;
Reflection = false;
ReflectionSpace = 0f;
ReflectionHeight = 0f;
Selected = false;
Alpha = 1f;
Visible = true;
}
public CStatic(int partyModeID, string textureSkinName, SColorF color, SRectF rect)
{
_PartyModeID = partyModeID;
_Theme = new SThemeStatic {TextureName = textureSkinName};
_ThemeLoaded = false;
_Texture = new STexture(-1);
_Theme.TextureName = textureSkinName;
Color = color;
Rect = rect;
Reflection = false;
ReflectionSpace = 0f;
ReflectionHeight = 0f;
Selected = false;
Alpha = 1f;
Visible = true;
}
public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex)
@@ -194,7 +161,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<Color>: Static color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName != "")
if (!String.IsNullOrEmpty(_Theme.ColorName))
writer.WriteElementString("Color", _Theme.ColorName);
else
{
@@ -238,7 +205,7 @@ namespace VocaluxeLib.Menu
public void Draw(float scale, float z, EAspect aspect, bool forceDraw = false)
{
STexture texture = _Texture.Index != -1 ? _Texture : CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
CTexture texture = Texture;
SRectF bounds = new SRectF(
Rect.X - Rect.W * (scale - 1f),
@@ -253,7 +220,7 @@ namespace VocaluxeLib.Menu
{
RectangleF bounds2 = new RectangleF(bounds.X, bounds.Y, bounds.W, bounds.H);
RectangleF rect2;
CHelper.SetRect(bounds2, out rect2, texture.Width / texture.Height, aspect);
CHelper.SetRect(bounds2, out rect2, texture.OrigAspect, aspect);
rect.X = rect2.X;
rect.Y = rect2.Y;
@@ -277,7 +244,7 @@ namespace VocaluxeLib.Menu
public void LoadTextures()
{
if (_Theme.ColorName != "")
if (!String.IsNullOrEmpty(_Theme.ColorName))
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
}
+7 -7
View File
@@ -169,7 +169,7 @@ namespace VocaluxeLib.Menu
}
/// <summary>
/// Do NOT read/write this anywhere but in _UpdateTextPosition!
/// Do NOT read/write this anywhere but in _UpdateTextPosition!
/// </summary>
private SRectF _Rect;
public SRectF Rect
@@ -396,7 +396,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<Color>: Text color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName != "")
if (!String.IsNullOrEmpty(_Theme.ColorName))
writer.WriteElementString("Color", _Theme.ColorName);
else
{
@@ -408,7 +408,7 @@ namespace VocaluxeLib.Menu
writer.WriteComment("<SColor>: Selected Text color from ColorScheme (high priority)");
writer.WriteComment("or <SR>, <SG>, <SB>, <SA> (lower priority)");
if (_Theme.SelColorName != "")
if (!String.IsNullOrEmpty(_Theme.SelColorName))
writer.WriteElementString("SColor", _Theme.SelColorName);
else
{
@@ -499,8 +499,8 @@ namespace VocaluxeLib.Menu
public void DrawRelative(float rx, float ry, float reflectionHeight = 0f, float reflectionSpace = 0f, float rectHeight = 0f)
{
var oldReflectionSpace = ReflectionSpace;
var oldReflectionHeight = ReflectionHeight;
float oldReflectionSpace = ReflectionSpace;
float oldReflectionHeight = ReflectionHeight;
if (reflectionHeight > 0)
{
ReflectionSpace = (rectHeight - Rect.Y - Rect.H) * 2 + reflectionSpace;
@@ -521,10 +521,10 @@ namespace VocaluxeLib.Menu
public void LoadTextures()
{
if (_Theme.ColorName != "")
if (!String.IsNullOrEmpty(_Theme.ColorName))
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
if (_Theme.SelColorName != "")
if (!String.IsNullOrEmpty(_Theme.SelColorName))
SelColor = CBase.Theme.GetColor(_Theme.SelColorName, _PartyModeID);
}
+1
View File
@@ -23,6 +23,7 @@ using System.Collections.ObjectModel;
using System.Drawing;
using VocaluxeLib;
using VocaluxeLib.Game;
using VocaluxeLib.Draw;
using VocaluxeLib.Menu.SongMenu;
using VocaluxeLib.PartyModes;
using VocaluxeLib.Profile;
+26 -35
View File
@@ -21,6 +21,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Xml;
using VocaluxeLib.Draw;
using VocaluxeLib.Songs;
@@ -386,9 +387,7 @@ namespace VocaluxeLib.Menu.SingNotes
_PlayerNotes[n].Rect.Z
);
float f = 0.7f;
if (!note.Hit)
f = 0.4f;
float f = (note.Hit) ? 0.7f : 0.4f;
_DrawNote(rect, color, f);
@@ -471,39 +470,31 @@ namespace VocaluxeLib.Menu.SingNotes
private void _DrawNote(SRectF rect, SColorF color, float factor = 1f)
{
const int spacing = 0;
if (factor <= 0)
return;
float d = (1f - factor) / 2 * rect.H;
float dw = d;
float dh = (1f - factor) * rect.H / 2;
float dw = Math.Min(dh, rect.W / 2);
if (2 * dw > rect.W)
dw = rect.W / 2;
SRectF noteRect = new SRectF(rect.X + dw, rect.Y + dh, rect.W - 2 * dw, rect.H - 2 * dh, rect.Z);
SRectF r = new SRectF(
rect.X + dw + spacing,
rect.Y + d + spacing,
rect.W - 2 * dw - 2 * spacing,
rect.H - 2 * d - 2 * spacing,
rect.Z
);
CTexture noteBegin = CBase.Theme.GetSkinTexture(_Theme.SkinLeftName, _PartyModeID);
CTexture noteMiddle = CBase.Theme.GetSkinTexture(_Theme.SkinMiddleName, _PartyModeID);
CTexture noteEnd = CBase.Theme.GetSkinTexture(_Theme.SkinRightName, _PartyModeID);
STexture noteBegin = CBase.Theme.GetSkinTexture(_Theme.SkinLeftName, _PartyModeID);
STexture noteMiddle = CBase.Theme.GetSkinTexture(_Theme.SkinMiddleName, _PartyModeID);
STexture noteEnd = CBase.Theme.GetSkinTexture(_Theme.SkinRightName, _PartyModeID);
//Width of each of the ends (round parts)
//Need 2 of them so use minimum
float endsW = Math.Min(noteRect.H * noteBegin.OrigAspect, noteRect.W / 2);
float dx = noteBegin.Width * r.H / noteBegin.Height;
if (2 * dx > r.W)
dx = r.W / 2;
CBase.Drawing.DrawTexture(noteBegin, new SRectF(noteRect.X, noteRect.Y, endsW, noteRect.H, noteRect.Z), color);
CBase.Drawing.DrawTexture(noteBegin, new SRectF(r.X, r.Y, dx, r.H, r.Z), color);
if (r.W - 2 * dx >= 2 * dx)
CBase.Drawing.DrawTexture(noteMiddle, new SRectF(r.X + dx, r.Y, r.W - 2 * dx, r.H, r.Z), color);
SRectF middleRect = new SRectF(noteRect.X + endsW, noteRect.Y, noteRect.W - 2 * endsW, noteRect.H, noteRect.Z);
if (noteRect.W >= 4 * endsW)
CBase.Drawing.DrawTexture(noteMiddle, middleRect, color);
else
CBase.Drawing.DrawTexture(noteMiddle, new SRectF(r.X + dx, r.Y, 2 * dx, r.H, r.Z), color, new SRectF(r.X + dx, r.Y, r.W - 2 * dx, r.H, r.Z));
CBase.Drawing.DrawTexture(noteMiddle, new SRectF(middleRect.X, middleRect.Y, 2 * endsW, middleRect.H, middleRect.Z), color, middleRect);
CBase.Drawing.DrawTexture(noteEnd, new SRectF(r.X + r.W - dx, r.Y, dx, r.H, r.Z), color);
CBase.Drawing.DrawTexture(noteEnd, new SRectF(noteRect.X + noteRect.W - endsW, noteRect.Y, endsW, noteRect.H, noteRect.Z), color);
}
private void _DrawNoteBG(SRectF rect, SColorF color, float factor, Stopwatch timer)
@@ -534,11 +525,11 @@ namespace VocaluxeLib.Menu.SingNotes
rect.Z
);
STexture noteBackgroundBegin = CBase.Theme.GetSkinTexture(_Theme.SkinBackgroundLeftName, _PartyModeID);
STexture noteBackgroundMiddle = CBase.Theme.GetSkinTexture(_Theme.SkinBackgroundMiddleName, _PartyModeID);
STexture noteBackgroundEnd = CBase.Theme.GetSkinTexture(_Theme.SkinBackgroundRightName, _PartyModeID);
CTexture noteBackgroundBegin = CBase.Theme.GetSkinTexture(_Theme.SkinBackgroundLeftName, _PartyModeID);
CTexture noteBackgroundMiddle = CBase.Theme.GetSkinTexture(_Theme.SkinBackgroundMiddleName, _PartyModeID);
CTexture noteBackgroundEnd = CBase.Theme.GetSkinTexture(_Theme.SkinBackgroundRightName, _PartyModeID);
float dx = noteBackgroundBegin.Width * r.H / noteBackgroundBegin.Height;
float dx = r.H * noteBackgroundBegin.OrigAspect;
if (2 * dx > r.W)
dx = r.W / 2;
@@ -629,8 +620,8 @@ namespace VocaluxeLib.Menu.SingNotes
rect.Z
);
STexture noteBegin = CBase.Theme.GetSkinTexture(_Theme.SkinLeftName, _PartyModeID);
float dx = noteBegin.Width * r.H / noteBegin.Height;
CTexture noteBegin = CBase.Theme.GetSkinTexture(_Theme.SkinLeftName, _PartyModeID);
float dx = r.H * noteBegin.OrigAspect;
if (2 * dx > r.W)
dx = r.W / 2;
@@ -686,7 +677,7 @@ namespace VocaluxeLib.Menu.SingNotes
_PlayerNotes[n].Color.B,
_PlayerNotes[n].Color.A * _PlayerNotes[n].Alpha);
STexture toneHelper = CBase.Theme.GetSkinTexture(_Theme.SkinToneHelperName, _PartyModeID);
CTexture toneHelper = CBase.Theme.GetSkinTexture(_Theme.SkinToneHelperName, _PartyModeID);
CBase.Drawing.DrawTexture(toneHelper, drawRect, color);
+17 -14
View File
@@ -22,6 +22,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Xml;
using VocaluxeLib.Draw;
using VocaluxeLib.PartyModes;
namespace VocaluxeLib.Menu.SongMenu
@@ -104,7 +105,7 @@ namespace VocaluxeLib.Menu.SongMenu
private readonly List<int> _Streams = new List<int>();
private int _Actsong = -1;
private int _Actsongstream = -1;
protected STexture _Vidtex = new STexture(-1);
protected CTexture _Vidtex;
protected bool _Initialized;
protected int _LastKnownNumSongs;
@@ -351,7 +352,7 @@ namespace VocaluxeLib.Menu.SongMenu
writer.WriteComment("<Color>: Tile color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName != "")
if (!String.IsNullOrEmpty(_Theme.ColorName))
writer.WriteElementString("Color", _Theme.ColorName);
else
{
@@ -438,19 +439,21 @@ namespace VocaluxeLib.Menu.SongMenu
if (_Actsong != _PreviewSelected)
_SelectSong(_PreviewSelected);
if (_Streams.Count > 0 && _Video != -1)
if (_Streams.Count <= 0 || _Video == -1)
return;
if (CBase.Video.IsFinished(_Video) || CBase.Sound.IsFinished(_Actsongstream))
{
if (CBase.Video.IsFinished(_Video) || CBase.Sound.IsFinished(_Actsongstream))
{
CBase.Video.Close(_Video);
_Video = -1;
return;
}
CBase.Video.Close(_Video);
_Video = -1;
return;
}
float time = CBase.Sound.GetPosition(_Actsongstream);
float time = CBase.Sound.GetPosition(_Actsongstream);
float vtime;
CBase.Video.GetFrame(_Video, ref _Vidtex, time, out vtime);
float vtime;
if (CBase.Video.GetFrame(_Video, ref _Vidtex, time, out vtime))
{
if (_VideoFadeTimer.ElapsedMilliseconds <= 3000L)
_Vidtex.Color.A = _VideoFadeTimer.ElapsedMilliseconds / 3000f;
else
@@ -464,7 +467,7 @@ namespace VocaluxeLib.Menu.SongMenu
public virtual void OnShow()
{
_Actsongstream = -1;
_Vidtex = new STexture(-1);
_Vidtex = null;
}
public virtual void OnHide()
@@ -546,7 +549,7 @@ namespace VocaluxeLib.Menu.SongMenu
{
Init();
if (_Theme.ColorName != "")
if (!String.IsNullOrEmpty(_Theme.ColorName))
_Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
}
+10 -10
View File
@@ -22,6 +22,7 @@ using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using VocaluxeLib.Draw;
using VocaluxeLib.PartyModes;
using VocaluxeLib.Songs;
@@ -38,8 +39,8 @@ namespace VocaluxeLib.Menu.SongMenu
private CStatic _MedleyCalcIcon;
private CStatic _MedleyTagIcon;
private STexture _CoverBigTexture;
private STexture _CoverTexture;
private CTexture _CoverBigTexture;
private CTexture _CoverTexture;
private CText _Artist;
private CText _Title;
@@ -323,7 +324,7 @@ namespace VocaluxeLib.Menu.SongMenu
{
foreach (CStatic tile in _Tiles)
{
if ((tile.Texture.Index != _CoverTexture.Index) && CHelper.IsInBounds(tile.Rect, mouseEvent) && !sel)
if (tile.Texture != _CoverTexture && CHelper.IsInBounds(tile.Rect, mouseEvent) && !sel)
{
if (mouseEvent.LB || !CBase.Songs.IsInCategory())
{
@@ -371,7 +372,7 @@ namespace VocaluxeLib.Menu.SongMenu
{
foreach (CStatic tile in _Tiles)
{
if ((tile.Texture.Index != _CoverTexture.Index) && CHelper.IsInBounds(tile.Rect, mouseEvent))
if (tile.Texture != _CoverTexture && CHelper.IsInBounds(tile.Rect, mouseEvent))
{
_EnterCategory(_PreviewSelected);
mouseEvent.Handled = true;
@@ -394,7 +395,7 @@ namespace VocaluxeLib.Menu.SongMenu
else
{
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if (tile.Texture.Index != _CoverTexture.Index)
if (tile.Texture != _CoverTexture)
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
tile.Draw(1f, tile.Rect.Z, EAspect.Crop);
else
@@ -453,18 +454,17 @@ namespace VocaluxeLib.Menu.SongMenu
_TextBG.Draw();
if (_Vidtex.Index != -1 && _Video != -1)
if (_Vidtex != null && _Video != -1)
{
if (_Vidtex.Color.A < 1)
_CoverBig.Draw(1f, EAspect.Crop);
RectangleF bounds = new RectangleF(_CoverBig.Rect.X, _CoverBig.Rect.Y, _CoverBig.Rect.W, _CoverBig.Rect.H);
RectangleF rect = new RectangleF(0f, 0f, _Vidtex.Width, _Vidtex.Height);
CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop);
RectangleF rect;
CHelper.SetRect(bounds, out rect, _Vidtex.OrigAspect, EAspect.Crop);
SRectF vidRect = new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z);
SRectF vidRectBounds = new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f);
CBase.Drawing.DrawTexture(_Vidtex, vidRect, _Vidtex.Color, vidRectBounds, false);
CBase.Drawing.DrawTexture(_Vidtex, vidRect, _Vidtex.Color, vidRectBounds);
CBase.Drawing.DrawTextureReflection(_Vidtex, vidRect, _Vidtex.Color, vidRectBounds, _CoverBig.ReflectionSpace, _CoverBig.ReflectionHeight);
}
else