diff --git a/Vocaluxe/Base/CCover.cs b/Vocaluxe/Base/CCover.cs index 43abe8e8..36cc5fe2 100644 --- a/Vocaluxe/Base/CCover.cs +++ b/Vocaluxe/Base/CCover.cs @@ -23,6 +23,7 @@ using System.IO; using System.Linq; using System.Text; using System.Xml; +using VocaluxeLib; using VocaluxeLib.Draw; using VocaluxeLib.Menu; diff --git a/Vocaluxe/Base/CCursor.cs b/Vocaluxe/Base/CCursor.cs index 4a3b45d0..79971f57 100644 --- a/Vocaluxe/Base/CCursor.cs +++ b/Vocaluxe/Base/CCursor.cs @@ -1,5 +1,6 @@ using System; using System.Diagnostics; +using VocaluxeLib; using VocaluxeLib.Draw; using VocaluxeLib.Menu; diff --git a/Vocaluxe/Base/CDraw.cs b/Vocaluxe/Base/CDraw.cs index 2acc4d35..3969658a 100644 --- a/Vocaluxe/Base/CDraw.cs +++ b/Vocaluxe/Base/CDraw.cs @@ -20,6 +20,7 @@ using System; using System.Drawing; using Vocaluxe.Lib.Draw; +using VocaluxeLib; using VocaluxeLib.Draw; using VocaluxeLib.Menu; diff --git a/Vocaluxe/Base/CMain.cs b/Vocaluxe/Base/CMain.cs index 1d8c8a7c..2a572a0b 100644 --- a/Vocaluxe/Base/CMain.cs +++ b/Vocaluxe/Base/CMain.cs @@ -370,12 +370,12 @@ namespace Vocaluxe.Base CDraw.DrawTextureReflection(texture, rect, color, bounds, reflectionSpace, reflectionHeight); } - public STexture AddTexture(string fileName) + public CTexture AddTexture(string fileName) { return CDraw.AddTexture(fileName); } - public void RemoveTexture(ref STexture texture) + public void RemoveTexture(ref CTexture texture) { CDraw.RemoveTexture(ref texture); } diff --git a/Vocaluxe/Base/CProfiles.cs b/Vocaluxe/Base/CProfiles.cs index 232fa378..2b267cba 100644 --- a/Vocaluxe/Base/CProfiles.cs +++ b/Vocaluxe/Base/CProfiles.cs @@ -43,7 +43,7 @@ namespace Vocaluxe.Base static class CProfiles { #region enums and structs - enum EAction + private enum EAction { LoadProfiles, LoadAvatars, @@ -54,7 +54,7 @@ namespace Vocaluxe.Base EditAvatar } - struct SChange + private struct SChange { public CProfile Profile; public CAvatar Avatar; @@ -96,16 +96,12 @@ namespace Vocaluxe.Base _Avatars = new Dictionary(); _AvatarIDs = new Queue(1000); for (int i = 0; i < 1000; i++) - { _AvatarIDs.Enqueue(i); - } _Profiles = new Dictionary(); _ProfileIDs = new Queue(100); for (int i = 0; i < 100; i++) - { _ProfileIDs.Enqueue(i); - } LoadProfiles(); } @@ -319,20 +315,18 @@ namespace Vocaluxe.Base _Queue.Enqueue(change); } } - + public static CProfile[] GetProfiles() { List list = new List(); if (_Profiles.Count == 0) - return null; + return null; CProfile[] result = new CProfile[_Profiles.Count]; _Profiles.Values.CopyTo(result, 0); for (int i = 0; i < result.Length; i++) - { list.Add(result[i]); - } list.Sort(_CompareByPlayerName); return list.ToArray(); } @@ -342,13 +336,13 @@ namespace Vocaluxe.Base CAvatar[] result = null; if (_Avatars.Count == 0) return null; - + result = new CAvatar[_Avatars.Count]; _Avatars.Values.CopyTo(result, 0); return result; } - + public static int NewProfile(string fileName = "") { CProfile profile = new CProfile @@ -380,9 +374,7 @@ namespace Vocaluxe.Base public static void SaveProfiles() { foreach (int id in _Profiles.Keys) - { _Profiles[id].SaveProfile(); - } } public static bool ICProfileIDValid(int profileID) @@ -422,7 +414,7 @@ namespace Vocaluxe.Base return String.Empty; return Path.GetFileName(_Profiles[profileID].FileName); - } + } public static string AddGetPlayerName(int profileID, char chr) { @@ -475,7 +467,7 @@ namespace Vocaluxe.Base { return ICProfileIDValid(profileID) ? _Profiles[profileID].Active : EOffOn.TR_CONFIG_OFF; } - + public static void SetActive(int profileID, EOffOn option) { if (!ICProfileIDValid(profileID)) @@ -517,18 +509,18 @@ namespace Vocaluxe.Base #endregion profile properties #region avatar texture - public static STexture GetAvatarTexture(int avatarID) + public static CTexture GetAvatarTexture(int avatarID) { if (!ICAvatarIDValid(avatarID)) - return new STexture(-1); + return null; return _Avatars[avatarID].Texture; } - public static STexture GetAvatarTextureFromProfile(int profileID) + public static CTexture GetAvatarTextureFromProfile(int profileID) { if (!ICProfileIDValid(profileID)) - return new STexture(-1); + return null; return _Profiles[profileID].Avatar.Texture; } @@ -565,9 +557,9 @@ namespace Vocaluxe.Base continue; CProfile profile = new CProfile - { - FileName = Path.Combine(CSettings.FolderProfiles, file) - }; + { + FileName = Path.Combine(CSettings.FolderProfiles, file) + }; if (profile.LoadProfile()) { diff --git a/Vocaluxe/Screens/CScreenProfiles.cs b/Vocaluxe/Screens/CScreenProfiles.cs index 0642cf1b..f869d20f 100644 --- a/Vocaluxe/Screens/CScreenProfiles.cs +++ b/Vocaluxe/Screens/CScreenProfiles.cs @@ -389,7 +389,7 @@ namespace Vocaluxe.Screens private void _DeleteProfile() { _EditMode = EEditMode.None; - + CProfiles.DeleteProfile(_SelectSlides[_SelectSlideProfiles].ValueIndex); int selection = _SelectSlides[_SelectSlideProfiles].Selection; @@ -410,11 +410,13 @@ namespace Vocaluxe.Screens CProfile[] profiles = CProfiles.GetProfiles(); for (int i = 0; i < profiles.Length; i++) + { _SelectSlides[_SelectSlideProfiles].AddValue( - profiles[i].PlayerName, - new STexture(-1), - profiles[i].ID, + profiles[i].PlayerName, + null, + profiles[i].ID, -1); + } if (CProfiles.NumProfiles > 0 && CProfiles.NumAvatars > 0) { @@ -446,11 +448,13 @@ namespace Vocaluxe.Screens _SelectSlides[_SelectSlideAvatars].Clear(); CAvatar[] avatars = CProfiles.GetAvatars(); for (int i = 0; i < avatars.Length; i++) + { _SelectSlides[_SelectSlideAvatars].AddValue( Path.GetFileName(avatars[i].FileName), - new STexture(-1), + null, avatars[i].ID, -1); + } if (Keep) { @@ -461,6 +465,6 @@ namespace Vocaluxe.Screens _SelectSlides[_SelectSlideAvatars].SetSelectionByValueIndex(CProfiles.GetAvatarID(_SelectSlides[_SelectSlideProfiles].ValueIndex)); _AvatarsChanged = false; - } + } } } \ No newline at end of file diff --git a/VocaluxeLib/IBasic.cs b/VocaluxeLib/IBasic.cs index 2d71e3ae..f8e0dbbc 100644 --- a/VocaluxeLib/IBasic.cs +++ b/VocaluxeLib/IBasic.cs @@ -4,7 +4,7 @@ using System.Collections.ObjectModel; using System.Drawing; using System.Linq; using System.Text; - +using VocaluxeLib.Draw; using VocaluxeLib.Game; using VocaluxeLib.Menu; using VocaluxeLib.PartyModes; @@ -78,8 +78,8 @@ namespace VocaluxeLib { string GetThemeScreensPath(int partyModeID); int GetSkinIndex(int partyModeID); - STexture GetSkinTexture(string textureName, int partyModeID); - STexture GetSkinVideoTexture(string videoName, int partyModeID); + CTexture GetSkinTexture(string textureName, int partyModeID); + CTexture GetSkinVideoTexture(string videoName, int partyModeID); void SkinVideoResume(string videoName, int partyModeID); void SkinVideoPause(string videoName, int partyModeID); @@ -109,18 +109,18 @@ namespace VocaluxeLib void ApplyVolume(); - STexture GetVideoTexture(); + CTexture GetVideoTexture(); } public interface IDrawing { - void DrawTexture(STexture texture, SRectF rect); - void DrawTexture(STexture texture, SRectF rect, SColorF color); - void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false); - void DrawTextureReflection(STexture texture, SRectF rect, SColorF color, SRectF bounds, float reflectionSpace, float reflectionHeight); + void DrawTexture(CTexture texture, SRectF rect); + void DrawTexture(CTexture texture, SRectF rect, SColorF color); + void DrawTexture(CTexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false); + void DrawTextureReflection(CTexture texture, SRectF rect, SColorF color, SRectF bounds, float reflectionSpace, float reflectionHeight); - STexture AddTexture(string fileName); - void RemoveTexture(ref STexture texture); + CTexture AddTexture(string fileName); + void RemoveTexture(ref CTexture texture); void DrawColor(SColorF color, SRectF rect); void DrawColorReflection(SColorF color, SRectF rect, float space, float height); @@ -225,7 +225,7 @@ namespace VocaluxeLib { int Load(string videoFileName); bool Skip(int videoStream, float startPosition, float videoGap); - bool GetFrame(int videoStream, ref STexture videoTexture, float time, out float videoTime); + bool GetFrame(int videoStream, ref CTexture videoTexture, float time, out float videoTime); bool IsFinished(int videoStream); bool Close(int videoStream); } @@ -248,12 +248,12 @@ namespace VocaluxeLib public interface ICover { - STexture GetNoCover(); + CTexture GetNoCover(); } public interface IDataBase { - bool GetCover(string fileName, ref STexture texture, int coverSize); + bool GetCover(string fileName, ref CTexture texture, int coverSize); } public interface IControllers @@ -283,4 +283,4 @@ namespace VocaluxeLib int GetPlaylistSongCount(int playlistID); CPlaylistSong GetPlaylistSong(int playlistID, int songIndex); } -} +} \ No newline at end of file diff --git a/VocaluxeLib/Profile/CAvatar.cs b/VocaluxeLib/Profile/CAvatar.cs index 36567868..ebb2da02 100644 --- a/VocaluxeLib/Profile/CAvatar.cs +++ b/VocaluxeLib/Profile/CAvatar.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; - +using VocaluxeLib.Draw; using VocaluxeLib.Menu; namespace VocaluxeLib.Profile @@ -10,31 +10,26 @@ namespace VocaluxeLib.Profile public class CAvatar { public int ID; - public string FileName; - public STexture Texture; + public string FileName = ""; + public CTexture Texture; public CAvatar(int ID) { this.ID = ID; - FileName = String.Empty; - Texture = new STexture(-1); } public bool LoadFromFile(string NewFileName) { FileName = NewFileName; - CBase.Drawing.RemoveTexture(ref Texture); - Texture = CBase.Drawing.AddTexture(FileName); - return (Texture.Index != -1); + return Reload(); } public bool Reload() { - STexture oldTexture = Texture; + CBase.Drawing.RemoveTexture(ref Texture); Texture = CBase.Drawing.AddTexture(FileName); - CBase.Drawing.RemoveTexture(ref oldTexture); - return Texture.Index != -1; + return Texture != null; } public void Unload() @@ -42,4 +37,4 @@ namespace VocaluxeLib.Profile CBase.Drawing.RemoveTexture(ref Texture); } } -} +} \ No newline at end of file