diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index e792ba4e..50ad4ed0 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -119,6 +119,8 @@ namespace Vocaluxe.Screens private bool _Pause; private bool _Webcam; + private CBackground _SlideShow; + public override void Init() { base.Init(); @@ -474,6 +476,8 @@ namespace Vocaluxe.Screens CDraw.DrawTexture(background, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, 0f), background.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f)); } + else if (_SlideShow != null) + _SlideShow.Draw(); } _DrawBG(); @@ -557,6 +561,9 @@ namespace Vocaluxe.Screens } CDraw.RemoveTexture(ref _Background); + if(_SlideShow != null) + _SlideShow.RemoveSlideShowTextures(); + _Lyrics[_LyricMain].Clear(); _Lyrics[_LyricSub].Clear(); _Lyrics[_LyricMainDuet].Clear(); @@ -622,8 +629,18 @@ namespace Vocaluxe.Screens } CDraw.RemoveTexture(ref _Background); - if (!String.IsNullOrEmpty(song.BackgroundFileName)) - _Background = CDraw.AddTexture(Path.Combine(song.Folder, song.BackgroundFileName)); + if (song.BackgroundFileNames.Count > 1) + { + _SlideShow = GetNewBackground(); + foreach(string s in song.BackgroundFileNames) + _SlideShow.AddSlideShowTexture(Path.Combine(song.Folder, s)); + _Background = null; + } + else if (song.BackgroundFileNames.Count == 1) + { + if (!String.IsNullOrEmpty(song.BackgroundFileNames[0])) + _Background = CDraw.AddTexture(Path.Combine(song.Folder, song.BackgroundFileNames[0])); + } _SingNotes[_SingBars].Reset(); diff --git a/VocaluxeLib/Menu/CBackground.cs b/VocaluxeLib/Menu/CBackground.cs index 7d5a8e4f..3fc5616b 100644 --- a/VocaluxeLib/Menu/CBackground.cs +++ b/VocaluxeLib/Menu/CBackground.cs @@ -70,6 +70,7 @@ namespace VocaluxeLib.Menu _PartyModeID = partyModeID; _ThemeLoaded = false; _Theme = new SThemeBackground(); + _Theme.SlideShowTextures = new List(); Color = new SColorF(0f, 0f, 0f, 1f); } @@ -103,7 +104,7 @@ namespace VocaluxeLib.Menu string slideShow = ""; int i = 1; - _Theme.SlideShowTextures = new List(); + while (xmlReader.ItemExists(item + "/SlideShow" + i)) { xmlReader.GetValue(item + "/SlideShow" + i, out slideShow, String.Empty); @@ -190,7 +191,7 @@ namespace VocaluxeLib.Menu ok = _DrawVideo(); } - if (_Theme.Type == EBackgroundTypes.SlideShow && _Theme.SlideShowTextures.Count > 0) + if (_Theme.Type == EBackgroundTypes.SlideShow ) { ok = _DrawSlideShow(); } @@ -218,6 +219,27 @@ namespace VocaluxeLib.Menu _SlideShowTextures.Add(CBase.Theme.GetSkinTexture(s, _PartyModeID)); } + public void AddSlideShowTexture(string image) + { + _Theme.Type = EBackgroundTypes.SlideShow; + if (!String.IsNullOrEmpty(image)) + { + CTexture texture = CBase.Drawing.AddTexture(image); + if(texture != null) + _SlideShowTextures.Add(texture); + } + } + + public void RemoveSlideShowTextures() + { + foreach (CTexture tex in _SlideShowTextures) + { + CTexture texture = tex; + CBase.Drawing.RemoveTexture(ref texture); + } + _SlideShowTextures.Clear(); + } + public void ReloadTextures() { UnloadTextures(); diff --git a/VocaluxeLib/Songs/CSong.cs b/VocaluxeLib/Songs/CSong.cs index aa0ced4b..9eb3e5a6 100644 --- a/VocaluxeLib/Songs/CSong.cs +++ b/VocaluxeLib/Songs/CSong.cs @@ -97,7 +97,7 @@ namespace VocaluxeLib.Songs public string MP3FileName = String.Empty; public string CoverFileName = String.Empty; - public string BackgroundFileName = String.Empty; + public List BackgroundFileNames = new List(); public string VideoFileName = String.Empty; public EAspect VideoAspect = EAspect.Crop; @@ -226,7 +226,7 @@ namespace VocaluxeLib.Songs MP3FileName = song.MP3FileName; CoverFileName = song.CoverFileName; - BackgroundFileName = song.BackgroundFileName; + BackgroundFileNames = song.BackgroundFileNames; VideoFileName = song.VideoFileName; VideoAspect = song.VideoAspect; @@ -328,7 +328,7 @@ namespace VocaluxeLib.Songs } } - if (BackgroundFileName == "") + if (BackgroundFileNames.Count == 0) { List files = CHelper.ListFiles(Folder, "*.jpg"); files.AddRange(CHelper.ListFiles(Folder, "*.jpeg")); @@ -338,7 +338,7 @@ namespace VocaluxeLib.Songs { if (file.ContainsIgnoreCase("[BG]") && (file.ContainsIgnoreCase(Title) || file.ContainsIgnoreCase(Artist))) - BackgroundFileName = file; + BackgroundFileNames.Add(file); } } } diff --git a/VocaluxeLib/Songs/CSongLoader.cs b/VocaluxeLib/Songs/CSongLoader.cs index 597398d4..4556b776 100644 --- a/VocaluxeLib/Songs/CSongLoader.cs +++ b/VocaluxeLib/Songs/CSongLoader.cs @@ -243,7 +243,7 @@ namespace VocaluxeLib.Songs break; case "BACKGROUND": if (File.Exists(Path.Combine(_Song.Folder, value))) - _Song.BackgroundFileName = value; + _Song.BackgroundFileNames.Add(value); else _LogWarning("Can't find background file: " + Path.Combine(_Song.Folder, value)); break; diff --git a/VocaluxeLib/Songs/CSongWriter.cs b/VocaluxeLib/Songs/CSongWriter.cs index 906c358f..9d7328b7 100644 --- a/VocaluxeLib/Songs/CSongWriter.cs +++ b/VocaluxeLib/Songs/CSongWriter.cs @@ -74,7 +74,7 @@ namespace VocaluxeLib.Songs _WriteHeaderEntry("YEAR", _Song.Year); _WriteHeaderEntry("MP3", _Song.MP3FileName); _WriteHeaderEntry("COVER", _Song.CoverFileName); - _WriteHeaderEntry("BACKGROUND", _Song.BackgroundFileName); + _WriteHeaderEntrys("BACKGROUND", _Song.BackgroundFileNames); _WriteHeaderEntry("VIDEO", _Song.VideoFileName); _WriteHeaderEntry("VIDEOGAP", _Song.VideoGap); if (_Song.VideoAspect != EAspect.Crop)