Added new background-option: SlideShow.
This commit is contained in:
1 parent
db8fc40050
commit
8a638d8e9a
4 files changed
+102
-1
No files matched your search
@@ -233,6 +233,16 @@ namespace Vocaluxe.Base
|
|||||||
{
|
{
|
||||||
return CSettings.DataPath;
|
return CSettings.DataPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float GetSlideShowImageTime()
|
||||||
|
{
|
||||||
|
return CSettings.SlideShowImageTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float GetSlideShowFadeTime()
|
||||||
|
{
|
||||||
|
return CSettings.SlideShowFadeTime;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class CBtheme : ITheme
|
class CBtheme : ITheme
|
||||||
|
|||||||
@@ -142,6 +142,9 @@ namespace Vocaluxe.Base
|
|||||||
public const float BackgroundMusicFadeTime = 0.5f;
|
public const float BackgroundMusicFadeTime = 0.5f;
|
||||||
public const float PauseResetTime = 1f;
|
public const float PauseResetTime = 1f;
|
||||||
|
|
||||||
|
public const float SlideShowImageTime = 3500f;
|
||||||
|
public const float SlideShowFadeTime = 500f;
|
||||||
|
|
||||||
public static readonly List<string> MusicFileTypes = new List<string>
|
public static readonly List<string> MusicFileTypes = new List<string>
|
||||||
{
|
{
|
||||||
"*.mp3",
|
"*.mp3",
|
||||||
|
|||||||
@@ -86,6 +86,9 @@ namespace VocaluxeLib
|
|||||||
|
|
||||||
string GetFolderProfiles();
|
string GetFolderProfiles();
|
||||||
string GetDataPath();
|
string GetDataPath();
|
||||||
|
|
||||||
|
float GetSlideShowImageTime();
|
||||||
|
float GetSlideShowFadeTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface ITheme
|
public interface ITheme
|
||||||
|
|||||||
@@ -18,6 +18,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Collections.Generic;
|
||||||
using VocaluxeLib.Draw;
|
using VocaluxeLib.Draw;
|
||||||
|
|
||||||
namespace VocaluxeLib.Menu
|
namespace VocaluxeLib.Menu
|
||||||
@@ -27,6 +29,7 @@ namespace VocaluxeLib.Menu
|
|||||||
None,
|
None,
|
||||||
Color,
|
Color,
|
||||||
Texture,
|
Texture,
|
||||||
|
SlideShow,
|
||||||
Video
|
Video
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,6 +39,8 @@ namespace VocaluxeLib.Menu
|
|||||||
|
|
||||||
public EBackgroundTypes Type;
|
public EBackgroundTypes Type;
|
||||||
|
|
||||||
|
public List<string> SlideShowTextures;
|
||||||
|
|
||||||
public string VideoName;
|
public string VideoName;
|
||||||
public string TextureName;
|
public string TextureName;
|
||||||
|
|
||||||
@@ -48,6 +53,10 @@ namespace VocaluxeLib.Menu
|
|||||||
private SThemeBackground _Theme;
|
private SThemeBackground _Theme;
|
||||||
private bool _ThemeLoaded;
|
private bool _ThemeLoaded;
|
||||||
|
|
||||||
|
private int _SlideShowCurrent;
|
||||||
|
private Stopwatch _SlideShowTimer = new Stopwatch();
|
||||||
|
private List<CTexture> _SlideShowTextures = new List<CTexture>();
|
||||||
|
|
||||||
public SColorF Color;
|
public SColorF Color;
|
||||||
|
|
||||||
public string GetThemeName()
|
public string GetThemeName()
|
||||||
@@ -92,6 +101,17 @@ namespace VocaluxeLib.Menu
|
|||||||
_ThemeLoaded &= success;
|
_ThemeLoaded &= success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string slideShow = "";
|
||||||
|
int i = 1;
|
||||||
|
_Theme.SlideShowTextures = new List<string>();
|
||||||
|
while (xmlReader.ItemExists(item + "/SlideShow" + i))
|
||||||
|
{
|
||||||
|
xmlReader.GetValue(item + "/SlideShow" + i, out slideShow, String.Empty);
|
||||||
|
if (slideShow != "")
|
||||||
|
_Theme.SlideShowTextures.Add(slideShow);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
if (_ThemeLoaded)
|
if (_ThemeLoaded)
|
||||||
{
|
{
|
||||||
_Theme.Name = elementName;
|
_Theme.Name = elementName;
|
||||||
@@ -115,6 +135,12 @@ namespace VocaluxeLib.Menu
|
|||||||
writer.WriteComment("<Skin>: Background Texture name");
|
writer.WriteComment("<Skin>: Background Texture name");
|
||||||
writer.WriteElementString("Skin", _Theme.TextureName);
|
writer.WriteElementString("Skin", _Theme.TextureName);
|
||||||
|
|
||||||
|
writer.WriteComment("<SlideShow%>: Texture name for slide-show");
|
||||||
|
for (int i = 0; i < _Theme.SlideShowTextures.Count; i++)
|
||||||
|
{
|
||||||
|
writer.WriteElementString("SlideShow" + (i + 1), _Theme.SlideShowTextures[i]);
|
||||||
|
}
|
||||||
|
|
||||||
writer.WriteComment("<Color>: Background color for type \"Color\" from ColorScheme (high priority)");
|
writer.WriteComment("<Color>: Background color for type \"Color\" from ColorScheme (high priority)");
|
||||||
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
|
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
|
||||||
if (!String.IsNullOrEmpty(_Theme.ColorName))
|
if (!String.IsNullOrEmpty(_Theme.ColorName))
|
||||||
@@ -164,6 +190,11 @@ namespace VocaluxeLib.Menu
|
|||||||
ok = _DrawVideo();
|
ok = _DrawVideo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_Theme.Type == EBackgroundTypes.SlideShow && _Theme.SlideShowTextures.Count > 0)
|
||||||
|
{
|
||||||
|
ok = _DrawSlideShow();
|
||||||
|
}
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(_Theme.TextureName) &&
|
if (!String.IsNullOrEmpty(_Theme.TextureName) &&
|
||||||
(_Theme.Type == EBackgroundTypes.Texture ||
|
(_Theme.Type == EBackgroundTypes.Texture ||
|
||||||
(_Theme.Type == EBackgroundTypes.Video && (CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_OFF || !ok))))
|
(_Theme.Type == EBackgroundTypes.Video && (CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_OFF || !ok))))
|
||||||
@@ -176,12 +207,15 @@ namespace VocaluxeLib.Menu
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UnloadTextures() {}
|
public void UnloadTextures() { _SlideShowTextures.Clear(); }
|
||||||
|
|
||||||
public void LoadTextures()
|
public void LoadTextures()
|
||||||
{
|
{
|
||||||
if (!String.IsNullOrEmpty(_Theme.ColorName))
|
if (!String.IsNullOrEmpty(_Theme.ColorName))
|
||||||
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
|
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
|
||||||
|
|
||||||
|
foreach (string s in _Theme.SlideShowTextures)
|
||||||
|
_SlideShowTextures.Add(CBase.Theme.GetSkinTexture(s, _PartyModeID));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReloadTextures()
|
public void ReloadTextures()
|
||||||
@@ -214,6 +248,57 @@ namespace VocaluxeLib.Menu
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool _DrawSlideShow()
|
||||||
|
{
|
||||||
|
if (_SlideShowTextures.Count > 0)
|
||||||
|
{
|
||||||
|
if (!_SlideShowTimer.IsRunning)
|
||||||
|
{
|
||||||
|
_SlideShowTimer.Start();
|
||||||
|
_SlideShowCurrent = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
CTexture texture = _SlideShowTextures[_SlideShowCurrent];
|
||||||
|
|
||||||
|
if (texture == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
var bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
|
||||||
|
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));
|
||||||
|
|
||||||
|
if (_SlideShowTimer.ElapsedMilliseconds >= (CBase.Settings.GetSlideShowFadeTime() + CBase.Settings.GetSlideShowImageTime()))
|
||||||
|
{
|
||||||
|
_SlideShowTimer.Restart();
|
||||||
|
if (_SlideShowCurrent + 1 < _SlideShowTextures.Count)
|
||||||
|
_SlideShowCurrent++;
|
||||||
|
else if (_SlideShowCurrent != 0)
|
||||||
|
_SlideShowCurrent = 0;
|
||||||
|
}
|
||||||
|
else if (_SlideShowTimer.ElapsedMilliseconds >= CBase.Settings.GetSlideShowImageTime())
|
||||||
|
{
|
||||||
|
if (_SlideShowCurrent + 1 < _SlideShowTextures.Count)
|
||||||
|
texture = _SlideShowTextures[_SlideShowCurrent + 1];
|
||||||
|
else if (_SlideShowCurrent != 0)
|
||||||
|
texture = _SlideShowTextures[0];
|
||||||
|
else
|
||||||
|
texture = null;
|
||||||
|
|
||||||
|
if (texture != null)
|
||||||
|
{
|
||||||
|
float alpha = (_SlideShowTimer.ElapsedMilliseconds - CBase.Settings.GetSlideShowImageTime()) / CBase.Settings.GetSlideShowFadeTime();
|
||||||
|
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) - 1), new SColorF(1,1,1, alpha));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private bool _DrawVideo()
|
private bool _DrawVideo()
|
||||||
{
|
{
|
||||||
CTexture videoTexture = CBase.Theme.GetSkinVideoTexture(_Theme.VideoName, _PartyModeID);
|
CTexture videoTexture = CBase.Theme.GetSkinVideoTexture(_Theme.VideoName, _PartyModeID);
|
||||||
|
|||||||
Reference in new issue
Block a user