diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs index 40b3c014..b898514d 100644 --- a/Vocaluxe/Base/CBackgroundMusic.cs +++ b/Vocaluxe/Base/CBackgroundMusic.cs @@ -22,6 +22,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; +using VocaluxeLib.Draw; using VocaluxeLib.Menu; using VocaluxeLib.Menu.SongMenu; @@ -39,7 +40,7 @@ namespace Vocaluxe.Base private static readonly List _PreviousFileNames = new List(); private static int _Video = -1; - private static STexture _CurrentVideoTexture = new STexture(-1); + private static CTexture _CurrentVideoTexture = new CTexture(-1); private static readonly Stopwatch _FadeTimer = new Stopwatch(); private static bool _VideoEnabled; @@ -118,7 +119,7 @@ namespace Vocaluxe.Base } } - public static STexture Cover + public static CTexture Cover { get { return _CurrentPlaylistElement.Cover; } } @@ -457,7 +458,7 @@ namespace Vocaluxe.Base _LoadVideo(); } - public static STexture GetVideoTexture() + public static CTexture GetVideoTexture() { if (_Video != -1) { @@ -472,7 +473,7 @@ namespace Vocaluxe.Base } return _CurrentVideoTexture; } - return new STexture(-1); + return new CTexture(-1); } private static bool _IsBackgroundFile(CPlaylistElement element) @@ -576,7 +577,7 @@ namespace Vocaluxe.Base } } - public STexture Cover + public CTexture Cover { get { diff --git a/Vocaluxe/Base/CCover.cs b/Vocaluxe/Base/CCover.cs index 24f80d64..c39928f5 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.Draw; using VocaluxeLib.Menu; namespace Vocaluxe.Base @@ -31,7 +32,7 @@ namespace Vocaluxe.Base { public string Name; public string Value; - public STexture Texture; + public CTexture Texture; } struct SCoverTheme @@ -46,11 +47,11 @@ namespace Vocaluxe.Base private static readonly XmlWriterSettings _Settings = new XmlWriterSettings(); private static readonly List _Cover = new List(); private static readonly List _CoverThemes = new List(); - private static STexture _NoCover = new STexture(-1); + private static CTexture _NoCover = new CTexture(-1); private static readonly Object _MutexCover = new Object(); - public static STexture NoCover + public static CTexture NoCover { get { return _NoCover; } } @@ -97,9 +98,9 @@ namespace Vocaluxe.Base /// /// Returns a STexture for a given cover name. Returns "NoCover" if the cover does not exist. /// - public static STexture Cover(string name) + public static CTexture Cover(string name) { - STexture cov = _NoCover; + CTexture cov = _NoCover; lock (_MutexCover) { foreach (SCover cover in _Cover) @@ -132,7 +133,7 @@ namespace Vocaluxe.Base { foreach (SCover cover in _Cover) { - STexture texture = cover.Texture; + CTexture texture = cover.Texture; CDraw.RemoveTexture(ref texture); } _Cover.Clear(); diff --git a/Vocaluxe/Base/CDataBase.cs b/Vocaluxe/Base/CDataBase.cs index 008542ef..c59e04a3 100644 --- a/Vocaluxe/Base/CDataBase.cs +++ b/Vocaluxe/Base/CDataBase.cs @@ -35,6 +35,7 @@ using SQLiteCommand = Mono.Data.Sqlite.SqliteCommand; using SQLiteDataReader = Mono.Data.Sqlite.SqliteDataReader; #endif using Community.CsharpSqlite; +using VocaluxeLib.Draw; using VocaluxeLib.Menu; using VocaluxeLib.Menu.SongMenu; @@ -912,7 +913,7 @@ namespace Vocaluxe.Base #endregion Highscores #region Cover - public static bool GetCover(string coverPath, ref STexture tex, int maxSize) + public static bool GetCover(string coverPath, ref CTexture tex, int maxSize) { if (!File.Exists(coverPath)) { @@ -1141,7 +1142,7 @@ namespace Vocaluxe.Base #endregion Cover #region CreditsRessources - public static bool GetCreditsRessource(string fileName, ref STexture tex) + public static bool GetCreditsRessource(string fileName, ref CTexture tex) { bool result = false; diff --git a/Vocaluxe/Base/CDraw.cs b/Vocaluxe/Base/CDraw.cs index 41a323e3..921c772a 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.Draw; using VocaluxeLib.Menu; namespace Vocaluxe.Base @@ -124,12 +125,12 @@ namespace Vocaluxe.Base _Draw.ClearScreen(); } - public static STexture CopyScreen() + public static CTexture CopyScreen() { return _Draw.CopyScreen(); } - public static void CopyScreen(ref STexture texture) + public static void CopyScreen(ref CTexture texture) { _Draw.CopyScreen(ref texture); } @@ -139,62 +140,62 @@ namespace Vocaluxe.Base _Draw.MakeScreenShot(); } - public static STexture AddTexture(Bitmap bitmap) + public static CTexture AddTexture(Bitmap bitmap) { return _Draw.AddTexture(bitmap); } - public static STexture AddTexture(string texturePath) + public static CTexture AddTexture(string texturePath) { return _Draw.AddTexture(texturePath); } - public static STexture AddTexture(int w, int h, byte[] data) + public static CTexture AddTexture(int w, int h, byte[] data) { return _Draw.AddTexture(w, h, data); } - public static STexture EnqueueTexture(int w, int h, byte[] data) + public static CTexture EnqueueTexture(int w, int h, byte[] data) { return _Draw.EnqueueTexture(w, h, data); } - public static bool UpdateTexture(ref STexture texture, byte[] data) + public static bool UpdateTexture(ref CTexture texture, byte[] data) { return _Draw.UpdateTexture(ref texture, data); } - public static void RemoveTexture(ref STexture texture) + public static void RemoveTexture(ref CTexture texture) { _Draw.RemoveTexture(ref texture); } - public static void DrawTexture(STexture texture) + public static void DrawTexture(CTexture texture) { _Draw.DrawTexture(texture); } - public static void DrawTexture(STexture texture, SRectF rect) + public static void DrawTexture(CTexture texture, SRectF rect) { _Draw.DrawTexture(texture, rect); } - public static void DrawTexture(STexture texture, SRectF rect, SColorF color, bool mirrored = false) + public static void DrawTexture(CTexture texture, SRectF rect, SColorF color, bool mirrored = false) { _Draw.DrawTexture(texture, rect, color, mirrored); } - public static void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false) + public static void DrawTexture(CTexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false) { _Draw.DrawTexture(texture, rect, color, bounds, mirrored); } - public static void DrawTexture(STexture texture, SRectF rect, SColorF color, float begin, float end) + public static void DrawTexture(CTexture texture, SRectF rect, SColorF color, float begin, float end) { _Draw.DrawTexture(texture, rect, color, begin, end); } - public static void DrawTexture(CStatic staticBounds, STexture texture, EAspect aspect) + public static void DrawTexture(CStatic staticBounds, CTexture texture, EAspect aspect) { if (texture.OrigSize.Height <= 0) return; @@ -207,7 +208,7 @@ namespace Vocaluxe.Base texture.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f)); } - public static void DrawTextureReflection(STexture texture, SRectF rect, SColorF color, SRectF bounds, float space, float height) + public static void DrawTextureReflection(CTexture texture, SRectF rect, SColorF color, SRectF bounds, float space, float height) { _Draw.DrawTextureReflection(texture, rect, color, bounds, space, height); } diff --git a/Vocaluxe/Base/CGraphics.cs b/Vocaluxe/Base/CGraphics.cs index cbb268c6..efb5404a 100644 --- a/Vocaluxe/Base/CGraphics.cs +++ b/Vocaluxe/Base/CGraphics.cs @@ -24,6 +24,7 @@ using System.Drawing; using System.Windows.Forms; using Vocaluxe.Base.Fonts; using Vocaluxe.Screens; +using VocaluxeLib.Draw; using VocaluxeLib.Menu; using VocaluxeLib.PartyModes; @@ -35,7 +36,7 @@ namespace Vocaluxe.Base private float _CursorTargetAlpha; private float _CursorStartAlpha; private float _CursorFadingTime; - private STexture _Cursor; + private CTexture _Cursor; private readonly string _CursorName = String.Empty; private readonly Stopwatch _Movetimer; diff --git a/Vocaluxe/Base/CMain.cs b/Vocaluxe/Base/CMain.cs index 1a4cc94a..3f844ef5 100644 --- a/Vocaluxe/Base/CMain.cs +++ b/Vocaluxe/Base/CMain.cs @@ -22,6 +22,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Drawing; using Vocaluxe.Base.Fonts; +using VocaluxeLib.Draw; using VocaluxeLib.Menu; using VocaluxeLib.Menu.SongMenu; @@ -224,12 +225,12 @@ namespace Vocaluxe.Base return CTheme.GetSkinIndex(partyModeID); } - public STexture GetSkinTexture(string textureName, int partyModeID) + public CTexture GetSkinTexture(string textureName, int partyModeID) { return CTheme.GetSkinTexture(textureName, partyModeID); } - public STexture GetSkinVideoTexture(string videoName, int partyModeID) + public CTexture GetSkinVideoTexture(string videoName, int partyModeID) { return CTheme.GetSkinVideoTexture(videoName, partyModeID); } @@ -332,7 +333,7 @@ namespace Vocaluxe.Base CBackgroundMusic.ApplyVolume(); } - public STexture GetVideoTexture() + public CTexture GetVideoTexture() { return CBackgroundMusic.GetVideoTexture(); } @@ -340,27 +341,27 @@ namespace Vocaluxe.Base class CBdraw : IDrawing { - public void DrawTexture(STexture texture, SRectF rect) + public void DrawTexture(CTexture texture, SRectF rect) { CDraw.DrawTexture(texture, rect); } - public void DrawTexture(STexture texture, SRectF rect, SColorF color) + public void DrawTexture(CTexture texture, SRectF rect, SColorF color) { CDraw.DrawTexture(texture, rect, color); } - public void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false) + public void DrawTexture(CTexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false) { CDraw.DrawTexture(texture, rect, color, bounds, mirrored); } - public void DrawTextureReflection(STexture texture, SRectF rect, SColorF color, SRectF bounds, float reflectionSpace, float reflectionHeight) + public void DrawTextureReflection(CTexture texture, SRectF rect, SColorF color, SRectF bounds, float reflectionSpace, float reflectionHeight) { CDraw.DrawTextureReflection(texture, rect, color, bounds, reflectionSpace, reflectionHeight); } - public void RemoveTexture(ref STexture texture) + public void RemoveTexture(ref CTexture texture) { CDraw.RemoveTexture(ref texture); } @@ -680,7 +681,7 @@ namespace Vocaluxe.Base return CVideo.Skip(videoStream, startPosition, videoGap); } - public bool GetFrame(int videoStream, ref STexture videoTexture, float time, out float videoTime) + public bool GetFrame(int videoStream, ref CTexture videoTexture, float time, out float videoTime) { return CVideo.GetFrame(videoStream, ref videoTexture, time, out videoTime); } @@ -751,7 +752,7 @@ namespace Vocaluxe.Base class CBcover : ICover { - public STexture GetNoCover() + public CTexture GetNoCover() { return CCover.NoCover; } @@ -759,7 +760,7 @@ namespace Vocaluxe.Base class CBdataBase : IDataBase { - public bool GetCover(string fileName, ref STexture texture, int coverSize) + public bool GetCover(string fileName, ref CTexture texture, int coverSize) { return CDataBase.GetCover(fileName, ref texture, coverSize); } diff --git a/Vocaluxe/Base/CProfiles.cs b/Vocaluxe/Base/CProfiles.cs index 2944b0e7..12320bd2 100644 --- a/Vocaluxe/Base/CProfiles.cs +++ b/Vocaluxe/Base/CProfiles.cs @@ -22,6 +22,7 @@ using System.Collections.Generic; using System.IO; using System.Text; using System.Xml; +using VocaluxeLib.Draw; using VocaluxeLib.Menu; namespace Vocaluxe.Base @@ -114,7 +115,7 @@ namespace Vocaluxe.Base { for (int i = 0; i < _Avatars.Count; i++) { - STexture texture = _Avatars[i].Texture; + CTexture texture = _Avatars[i].Texture; CDraw.RemoveTexture(ref texture); } _Avatars.Clear(); @@ -127,7 +128,7 @@ namespace Vocaluxe.Base foreach (string file in files) { - STexture tex = CDraw.AddTexture(file); + CTexture tex = CDraw.AddTexture(file); if (tex.Index != -1) { diff --git a/Vocaluxe/Base/CTheme.cs b/Vocaluxe/Base/CTheme.cs index d26b8813..ac5a5862 100644 --- a/Vocaluxe/Base/CTheme.cs +++ b/Vocaluxe/Base/CTheme.cs @@ -24,6 +24,7 @@ using System.Text; using System.Windows.Forms; using System.Xml; using Vocaluxe.Base.Fonts; +using VocaluxeLib.Draw; using VocaluxeLib.Menu; namespace Vocaluxe.Base @@ -48,7 +49,7 @@ namespace Vocaluxe.Base public string Name; public string Value; - public STexture Texture; + public CTexture Texture; public int VideoIndex; } @@ -202,7 +203,7 @@ namespace Vocaluxe.Base sk.VideoIndex = CVideo.Load(Path.Combine(_Skins[skinIndex].Path, sk.Value)); CVideo.SetLoop(sk.VideoIndex, true); CVideo.Pause(sk.VideoIndex); - sk.Texture = new STexture(-1); + sk.Texture = new CTexture(-1); _Skins[skinIndex].VideoList[i] = sk; } catch (Exception e) @@ -224,14 +225,14 @@ namespace Vocaluxe.Base { foreach (SSkinElement sk in _Skins[i].SkinList.Values) { - STexture texture = sk.Texture; + CTexture texture = sk.Texture; CDraw.RemoveTexture(ref texture); } for (int j = 0; j < _Skins[i].VideoList.Count; j++) { CVideo.Close(_Skins[i].VideoList[j].VideoIndex); - STexture videoTexture = _Skins[i].VideoList[j].Texture; + CTexture videoTexture = _Skins[i].VideoList[j].Texture; CDraw.RemoveTexture(ref videoTexture); } @@ -579,12 +580,12 @@ namespace Vocaluxe.Base return path; } - public static STexture GetSkinTexture(string textureName, int partyModeID) + public static CTexture GetSkinTexture(string textureName, int partyModeID) { int skinIndex = GetSkinIndex(partyModeID); if (skinIndex != -1 && textureName != null && _Skins[skinIndex].SkinList.ContainsKey(textureName)) return _Skins[skinIndex].SkinList[textureName].Texture; - return new STexture(-1); + return new CTexture(-1); } public static string GetSkinFilePath(string skinName, int partyModeID) @@ -604,7 +605,7 @@ namespace Vocaluxe.Base return skinName; } - public static STexture GetSkinVideoTexture(string videoName, int partyModeID) + public static CTexture GetSkinVideoTexture(string videoName, int partyModeID) { int skinIndex = GetSkinIndex(partyModeID); if (skinIndex != -1) @@ -626,7 +627,7 @@ namespace Vocaluxe.Base } } } - return new STexture(-1); + return new CTexture(-1); } public static void SkinVideoPause(string videoName, int partyModeID) diff --git a/Vocaluxe/Base/CVideo.cs b/Vocaluxe/Base/CVideo.cs index 10c59af0..743d54d2 100644 --- a/Vocaluxe/Base/CVideo.cs +++ b/Vocaluxe/Base/CVideo.cs @@ -20,6 +20,7 @@ using System.Diagnostics; using System.Drawing; using Vocaluxe.Lib.Video; +using VocaluxeLib.Draw; using VocaluxeLib.Menu; namespace Vocaluxe.Base @@ -75,7 +76,7 @@ namespace Vocaluxe.Base return _VideoDecoder.GetLength(streamID); } - public static bool GetFrame(int streamID, ref STexture frame, float time, out float videoTime) + public static bool GetFrame(int streamID, ref CTexture frame, float time, out float videoTime) { return _VideoDecoder.GetFrame(streamID, ref frame, time, out videoTime); } @@ -116,7 +117,7 @@ namespace Vocaluxe.Base class CVideoPlayer { - private STexture _VideoTexture; + private CTexture _VideoTexture; private int _VideoStream; private readonly Stopwatch _VideoTimer; private bool _Finished; @@ -135,7 +136,7 @@ namespace Vocaluxe.Base public CVideoPlayer() { _VideoTimer = new Stopwatch(); - _VideoTexture = new STexture(-1); + _VideoTexture = new CTexture(-1); _Finished = false; _Loaded = false; } @@ -171,7 +172,7 @@ namespace Vocaluxe.Base float videoTime = _VideoTimer.ElapsedMilliseconds / 1000f; _Finished = CVideo.Finished(_VideoStream); - STexture tex = new STexture(-1); + CTexture tex = new CTexture(-1); CVideo.GetFrame(_VideoStream, ref tex, videoTime, out videoTime); if (tex.Index > 0) diff --git a/Vocaluxe/Base/CWebcam.cs b/Vocaluxe/Base/CWebcam.cs index 0a361c68..677a2e36 100644 --- a/Vocaluxe/Base/CWebcam.cs +++ b/Vocaluxe/Base/CWebcam.cs @@ -19,6 +19,7 @@ using System.Drawing; using Vocaluxe.Lib.Webcam; +using VocaluxeLib.Draw; using VocaluxeLib.Menu; namespace Vocaluxe.Base @@ -46,7 +47,7 @@ namespace Vocaluxe.Base CConfig.SaveConfig(); } - public static bool GetFrame(ref STexture tex) + public static bool GetFrame(ref CTexture tex) { _Webcam.GetFrame(ref tex); return true; diff --git a/Vocaluxe/Base/Fonts/CFont.cs b/Vocaluxe/Base/Fonts/CFont.cs index 5ac016df..e4ccefa8 100644 --- a/Vocaluxe/Base/Fonts/CFont.cs +++ b/Vocaluxe/Base/Fonts/CFont.cs @@ -21,6 +21,7 @@ using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Text; +using VocaluxeLib.Draw; using VocaluxeLib.Menu; namespace Vocaluxe.Base.Fonts @@ -86,7 +87,7 @@ namespace Vocaluxe.Base.Fonts public void DrawGlyph(char chr, float x, float y, float z, SColorF color) { - STexture texture; + CTexture texture; SRectF rect; GetOrAddGlyph(chr).GetTextureAndRect(x, y, z, out texture, out rect); CDraw.DrawTexture(texture, rect, color); @@ -94,7 +95,7 @@ namespace Vocaluxe.Base.Fonts public void DrawGlyph(char chr, float x, float y, float z, SColorF color, float begin, float end) { - STexture texture; + CTexture texture; SRectF rect; GetOrAddGlyph(chr).GetTextureAndRect(x, y, z, out texture, out rect); CDraw.DrawTexture(texture, rect, color, begin, end); @@ -102,7 +103,7 @@ namespace Vocaluxe.Base.Fonts public void DrawGlyphReflection(char chr, float x, float y, float z, SColorF color, float rspace, float rheight) { - STexture texture; + CTexture texture; SRectF rect; GetOrAddGlyph(chr).GetTextureAndRect(x, y, z, out texture, out rect); CDraw.DrawTextureReflection(texture, rect, color, rect, rspace, rheight); diff --git a/Vocaluxe/Base/Fonts/CGlyph.cs b/Vocaluxe/Base/Fonts/CGlyph.cs index af06252b..7842badc 100644 --- a/Vocaluxe/Base/Fonts/CGlyph.cs +++ b/Vocaluxe/Base/Fonts/CGlyph.cs @@ -23,13 +23,14 @@ using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.Drawing.Text; using System.Runtime.InteropServices; +using VocaluxeLib.Draw; using VocaluxeLib.Menu; namespace Vocaluxe.Base.Fonts { class CGlyph { - private STexture _Texture; + private CTexture _Texture; private readonly SizeF _BoundingBox; private readonly RectangleF _DrawBounding; public readonly float MaxHeight; @@ -147,7 +148,7 @@ namespace Vocaluxe.Base.Fonts return CFonts.Height / _BoundingBox.Height; } - public void GetTextureAndRect(float x, float y, float z, out STexture texture, out SRectF rect) + public void GetTextureAndRect(float x, float y, float z, out CTexture texture, out SRectF rect) { texture = _Texture; float factor = _GetFactor(); diff --git a/Vocaluxe/Lib/Draw/CDirect3D.cs b/Vocaluxe/Lib/Draw/CDirect3D.cs index 241a05b3..ce51146d 100644 --- a/Vocaluxe/Lib/Draw/CDirect3D.cs +++ b/Vocaluxe/Lib/Draw/CDirect3D.cs @@ -31,6 +31,7 @@ using System.Runtime.InteropServices; using System.Windows.Forms; using SlimDX.Windows; using Vocaluxe.Base; +using VocaluxeLib.Draw; using VocaluxeLib.Menu; namespace Vocaluxe.Lib.Draw @@ -50,7 +51,7 @@ namespace Vocaluxe.Lib.Draw private Size _OldSize; private Size _SizeBeforeMinimize; - private readonly Dictionary _Textures; + private readonly Dictionary _Textures; private readonly Dictionary _D3DTextures; private readonly List _Queue; private readonly Queue _IDs; @@ -65,7 +66,7 @@ namespace Vocaluxe.Lib.Draw private int _Y; private int _X; - private STexture _BlankTexture; + private CTexture _BlankTexture; private readonly Queue _Vertices; private readonly Queue _VerticesTextures; @@ -80,7 +81,7 @@ namespace Vocaluxe.Lib.Draw public CDirect3D() { Icon = new Icon(Path.Combine(Environment.CurrentDirectory, CSettings.Icon)); - _Textures = new Dictionary(); + _Textures = new Dictionary(); _D3DTextures = new Dictionary(); _Queue = new List(); _IDs = new Queue(); @@ -676,9 +677,9 @@ namespace Vocaluxe.Lib.Draw /// Copies the current frame into a texture /// A texture holding the current frame /// - public STexture CopyScreen() + public CTexture CopyScreen() { - STexture texture = new STexture(-1, _W, _H); + CTexture texture = new CTexture(-1, _W, _H); texture.W2 = _CheckForNextPowerOf2(_W); texture.H2 = _CheckForNextPowerOf2(_H); @@ -701,7 +702,7 @@ namespace Vocaluxe.Lib.Draw /// Copies the current frame into a texture /// /// The texture in which the frame is copied to - public void CopyScreen(ref STexture texture) + public void CopyScreen(ref CTexture texture) { //Check for actual texture sizes! (W2/H2) as it may be up/downsized compared to OrigSize if (!_TextureExists(ref texture) || texture.W2 != GetScreenWidth() || texture.H2 != GetScreenHeight()) @@ -795,7 +796,7 @@ namespace Vocaluxe.Lib.Draw /// /// The texture's filepath /// A STexture object containing the added texture - public STexture AddTexture(string texturePath) + public CTexture AddTexture(string texturePath) { if (File.Exists(texturePath)) { @@ -807,9 +808,9 @@ namespace Vocaluxe.Lib.Draw catch (Exception) { CLog.LogError("Error loading Texture: " + texturePath); - return new STexture(-1); + return new CTexture(-1); } - STexture s; + CTexture s; try { s = AddTexture(bmp); @@ -821,7 +822,7 @@ namespace Vocaluxe.Lib.Draw return s; } CLog.LogError("Can't find File: " + texturePath); - return new STexture(-1); + return new CTexture(-1); } /// @@ -829,10 +830,10 @@ namespace Vocaluxe.Lib.Draw /// /// The Bitmap of which the texure will be created from /// A STexture object containing the added texture - public STexture AddTexture(Bitmap bmp) + public CTexture AddTexture(Bitmap bmp) { if (bmp.Height == 0 || bmp.Width == 0) - return new STexture(-1); + return new CTexture(-1); int maxSize; //Apply the right max size switch (CConfig.TextureQuality) @@ -857,7 +858,7 @@ namespace Vocaluxe.Lib.Draw break; } - STexture texture = new STexture(-1, bmp.Width, bmp.Height) {UseFullTexture = true}; + CTexture texture = new CTexture(-1, bmp.Width, bmp.Height) {UseFullTexture = true}; int w = Math.Min(bmp.Width, maxSize); int h = Math.Min(bmp.Height, maxSize); @@ -900,13 +901,13 @@ namespace Vocaluxe.Lib.Draw return _AddTexture(texture, w, data); } - public STexture AddTexture(int w, int h, byte[] data) + public CTexture AddTexture(int w, int h, byte[] data) { - STexture texture = new STexture(-1, w, h) {W2 = _CheckForNextPowerOf2(w), H2 = _CheckForNextPowerOf2(h)}; + CTexture texture = new CTexture(-1, w, h) {W2 = _CheckForNextPowerOf2(w), H2 = _CheckForNextPowerOf2(h)}; return _AddTexture(texture, w, data); } - private STexture _AddTexture(STexture texture, int w, byte[] data) + private CTexture _AddTexture(CTexture texture, int w, byte[] data) { Texture t = _CreateTexture(ref texture, w, data); @@ -919,7 +920,7 @@ namespace Vocaluxe.Lib.Draw return texture; } - private Texture _CreateTexture(ref STexture texture, int w, byte[] data) + private Texture _CreateTexture(ref CTexture texture, int w, byte[] data) { //Create a new texture in the managed pool, which does not need to be recreated on a lost device //because a copy of the texture is hold in the Ram @@ -949,9 +950,9 @@ namespace Vocaluxe.Lib.Draw return t; } - public STexture EnqueueTexture(int w, int h, byte[] data) + public CTexture EnqueueTexture(int w, int h, byte[] data) { - STexture texture = new STexture(-1, w, h); + CTexture texture = new CTexture(-1, w, h); STextureQueue queue = new STextureQueue {Data = data, Height = h, Width = w}; lock (_MutexTexture) @@ -973,7 +974,7 @@ namespace Vocaluxe.Lib.Draw /// The texture to update /// A byte array containing the new texture's data /// True if succeeded - public bool UpdateTexture(ref STexture texture, byte[] data) + public bool UpdateTexture(ref CTexture texture, byte[] data) { if ((texture.Index >= 0) && (_Textures.Count > 0) && _TextureExists(ref texture)) { @@ -1001,7 +1002,7 @@ namespace Vocaluxe.Lib.Draw /// /// The texture to check /// True if the texture exists - private bool _TextureExists(ref STexture texture) + private bool _TextureExists(ref CTexture texture) { lock (_MutexTexture) { @@ -1021,7 +1022,7 @@ namespace Vocaluxe.Lib.Draw /// Removes a texture from the Vram /// /// The texture to be removed - public void RemoveTexture(ref STexture texture) + public void RemoveTexture(ref CTexture texture) { lock (_MutexTexture) { @@ -1042,7 +1043,7 @@ namespace Vocaluxe.Lib.Draw /// Draws a texture /// /// The texture to be drawn - public void DrawTexture(STexture texture) + public void DrawTexture(CTexture texture) { DrawTexture(texture, texture.Rect, texture.Color); } @@ -1052,7 +1053,7 @@ namespace Vocaluxe.Lib.Draw /// /// The texture to be drawn /// A SRectF struct containing the destination coordinates - public void DrawTexture(STexture texture, SRectF rect) + public void DrawTexture(CTexture texture, SRectF rect) { DrawTexture(texture, rect, texture.Color); } @@ -1064,7 +1065,7 @@ namespace Vocaluxe.Lib.Draw /// A SRectF struct containing the destination coordinates /// A SColorF struct containing a color which the texture will be colored in /// True if the texture should be mirrored - public void DrawTexture(STexture texture, SRectF rect, SColorF color, bool mirrored = false) + public void DrawTexture(CTexture texture, SRectF rect, SColorF color, bool mirrored = false) { DrawTexture(texture, rect, color, new SRectF(0, 0, CSettings.RenderW, CSettings.RenderH, rect.Z), mirrored); } @@ -1077,7 +1078,7 @@ namespace Vocaluxe.Lib.Draw /// A SColorF struct containing a color which the texture will be colored in /// A SRectF struct containing which part of the texture should be drawn /// True if the texture should be mirrored - public void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false) + public void DrawTexture(CTexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false) { if (_TextureExists(ref texture)) { @@ -1168,7 +1169,7 @@ namespace Vocaluxe.Lib.Draw /// A SColorF struct containing a color which the texture will be colored in /// A Value ranging from 0 to 1 containing the beginning of the texture /// A Value ranging from 0 to 1 containing the ending of the texture - public void DrawTexture(STexture texture, SRectF rect, SColorF color, float begin, float end) + public void DrawTexture(CTexture texture, SRectF rect, SColorF color, float begin, float end) { if (!_TextureExists(ref texture)) return; @@ -1212,7 +1213,7 @@ namespace Vocaluxe.Lib.Draw /// A SRectF struct containing which part of the texture should be drawn /// The space between the texture and the reflection /// The height of the reflection - public void DrawTextureReflection(STexture texture, SRectF rect, SColorF color, SRectF bounds, float space, float height) + public void DrawTextureReflection(CTexture texture, SRectF rect, SColorF color, SRectF bounds, float space, float height) { if (!_TextureExists(ref texture)) return; @@ -1300,7 +1301,7 @@ namespace Vocaluxe.Lib.Draw _Queue.RemoveAt(0); if (!_Textures.ContainsKey(q.ID)) continue; - STexture texture = _Textures[q.ID]; + CTexture texture = _Textures[q.ID]; if (q.Width == texture.OrigSize.Width && q.Height == texture.OrigSize.Height) { texture.W2 = _CheckForNextPowerOf2(texture.OrigSize.Width); diff --git a/Vocaluxe/Lib/Draw/CDrawWinForm.cs b/Vocaluxe/Lib/Draw/CDrawWinForm.cs index ade2012b..ab765c21 100644 --- a/Vocaluxe/Lib/Draw/CDrawWinForm.cs +++ b/Vocaluxe/Lib/Draw/CDrawWinForm.cs @@ -27,6 +27,7 @@ using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; using Vocaluxe.Base; +using VocaluxeLib.Draw; using VocaluxeLib.Menu; namespace Vocaluxe.Lib.Draw @@ -45,7 +46,7 @@ namespace Vocaluxe.Lib.Draw private bool _TopMost; private Rectangle _Bounds; - private readonly List _Textures; + private readonly List _Textures; private readonly List _Bitmaps; private readonly Color _ClearColor = Color.DarkBlue; @@ -54,7 +55,7 @@ namespace Vocaluxe.Lib.Draw { Icon = new Icon(Path.Combine(Environment.CurrentDirectory, CSettings.Icon)); - _Textures = new List(); + _Textures = new List(); _Bitmaps = new List(); _Keys = new CKeys(); @@ -289,11 +290,11 @@ namespace Vocaluxe.Lib.Draw _G.Clear(_ClearColor); } - public STexture CopyScreen() + public CTexture CopyScreen() { Bitmap bmp = new Bitmap(_Backbuffer); _Bitmaps.Add(bmp); - STexture texture = new STexture(_Bitmaps.Count - 1, bmp.Width, bmp.Height); + CTexture texture = new CTexture(_Bitmaps.Count - 1, bmp.Width, bmp.Height); // Add to Texture List _Textures.Add(texture); @@ -301,7 +302,7 @@ namespace Vocaluxe.Lib.Draw return texture; } - public void CopyScreen(ref STexture texture) + public void CopyScreen(ref CTexture texture) { if (texture.Index == 0 || texture.W2 != GetScreenWidth() || texture.H2 != GetScreenHeight()) { @@ -333,11 +334,11 @@ namespace Vocaluxe.Lib.Draw public void DrawColorReflection(SColorF color, SRectF rect, float space, float height) {} - public STexture AddTexture(Bitmap bmp) + public CTexture AddTexture(Bitmap bmp) { Bitmap bmp2 = new Bitmap(bmp); _Bitmaps.Add(bmp2); - STexture texture = new STexture(_Bitmaps.Count - 1, bmp.Width, bmp.Height); + CTexture texture = new CTexture(_Bitmaps.Count - 1, bmp.Width, bmp.Height); // Add to Texture List texture.TexturePath = String.Empty; @@ -347,13 +348,13 @@ namespace Vocaluxe.Lib.Draw return texture; } - public STexture AddTexture(string texturePath) + public CTexture AddTexture(string texturePath) { - STexture texture = new STexture(); + CTexture texture = new CTexture(); if (File.Exists(texturePath)) { bool found = false; - foreach (STexture tex in _Textures) + foreach (CTexture tex in _Textures) { if (tex.TexturePath == texturePath) { @@ -373,7 +374,7 @@ namespace Vocaluxe.Lib.Draw return texture; } - public void RemoveTexture(ref STexture texture) + public void RemoveTexture(ref CTexture texture) { if ((texture.Index >= 0) && (_Textures.Count > 0)) { @@ -390,12 +391,12 @@ namespace Vocaluxe.Lib.Draw } } - public STexture EnqueueTexture(int w, int h, byte[] data) + public CTexture EnqueueTexture(int w, int h, byte[] data) { return AddTexture(w, h, data); } - public STexture AddTexture(int w, int h, byte[] data) + public CTexture AddTexture(int w, int h, byte[] data) { using (Bitmap bmp = new Bitmap(w, h)) { @@ -406,7 +407,7 @@ namespace Vocaluxe.Lib.Draw } } - public bool UpdateTexture(ref STexture texture, byte[] data) + public bool UpdateTexture(ref CTexture texture, byte[] data) { if ((texture.Index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > texture.Index)) { @@ -418,25 +419,25 @@ namespace Vocaluxe.Lib.Draw return true; } - public void DrawTexture(STexture texture) + public void DrawTexture(CTexture texture) { if ((texture.Index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > texture.Index)) DrawTexture(texture, texture.Rect, texture.Color); } - public void DrawTexture(STexture texture, SRectF rect) + public void DrawTexture(CTexture texture, SRectF rect) { if ((texture.Index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > texture.Index)) DrawTexture(texture, rect, texture.Color); } - public void DrawTexture(STexture texture, SRectF rect, SColorF color, bool mirrored = false) + public void DrawTexture(CTexture texture, SRectF rect, SColorF color, bool mirrored = false) { if ((texture.Index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > texture.Index)) DrawTexture(texture, rect, color, rect, mirrored); } - public void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false) + public void DrawTexture(CTexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false) { if ((texture.Index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > texture.Index)) { @@ -446,9 +447,9 @@ namespace Vocaluxe.Lib.Draw } } - public void DrawTexture(STexture texture, SRectF rect, SColorF color, float begin, float end) {} + public void DrawTexture(CTexture texture, SRectF rect, SColorF color, float begin, float end) {} - public void DrawTextureReflection(STexture texture, SRectF rect, SColorF color, SRectF bounds, float space, float height) {} + public void DrawTextureReflection(CTexture texture, SRectF rect, SColorF color, SRectF bounds, float space, float height) {} public int GetTextureCount() { diff --git a/Vocaluxe/Lib/Draw/COpenGL.cs b/Vocaluxe/Lib/Draw/COpenGL.cs index 3cdd6c02..f460d4fa 100644 --- a/Vocaluxe/Lib/Draw/COpenGL.cs +++ b/Vocaluxe/Lib/Draw/COpenGL.cs @@ -30,6 +30,7 @@ using System.IO; using System.Runtime.InteropServices; using System.Windows.Forms; using Vocaluxe.Base; +using VocaluxeLib.Draw; using VocaluxeLib.Menu; using BeginMode = OpenTK.Graphics.OpenGL.BeginMode; using BlendingFactorDest = OpenTK.Graphics.OpenGL.BlendingFactorDest; @@ -82,7 +83,7 @@ namespace Vocaluxe.Lib.Draw private SClientRect _Restore; private bool _Fullscreen; - private readonly Dictionary _Textures; + private readonly Dictionary _Textures; private readonly Queue _IDs; private readonly List _Queue; @@ -100,7 +101,7 @@ namespace Vocaluxe.Lib.Draw { Icon = new Icon(Path.Combine(Environment.CurrentDirectory, CSettings.Icon)); - _Textures = new Dictionary(); + _Textures = new Dictionary(); _Queue = new List(); _IDs = new Queue(1000000); @@ -465,7 +466,7 @@ namespace Vocaluxe.Lib.Draw Close(); } catch {} - STexture[] textures = new STexture[_Textures.Count]; + CTexture[] textures = new CTexture[_Textures.Count]; _Textures.Values.CopyTo(textures, 0); for (int i = 0; i < _Textures.Count; i++) RemoveTexture(ref textures[i]); @@ -488,9 +489,9 @@ namespace Vocaluxe.Lib.Draw GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); } - public STexture CopyScreen() + public CTexture CopyScreen() { - STexture texture = new STexture(-1, _W, _H); + CTexture texture = new CTexture(-1, _W, _H); int id = GL.GenTexture(); GL.BindTexture(TextureTarget.Texture2D, id); texture.ID = id; @@ -518,7 +519,7 @@ namespace Vocaluxe.Lib.Draw return texture; } - public void CopyScreen(ref STexture texture) + public void CopyScreen(ref CTexture texture) { //Check for actual texture sizes! (W2/H2) as it may be up/downsized compared to OrigSize if (!_TextureExists(ref texture) || texture.W2 != GetScreenWidth() || texture.H2 != GetScreenHeight()) @@ -643,7 +644,7 @@ namespace Vocaluxe.Lib.Draw #region Textures #region adding - public STexture AddTexture(string texturePath) + public CTexture AddTexture(string texturePath) { if (File.Exists(texturePath)) { @@ -655,7 +656,7 @@ namespace Vocaluxe.Lib.Draw catch (Exception) { CLog.LogError("Error loading Texture: " + texturePath); - return new STexture(-1); + return new CTexture(-1); } try { @@ -667,13 +668,13 @@ namespace Vocaluxe.Lib.Draw } } CLog.LogError("Can't find File: " + texturePath); - return new STexture(-1); + return new CTexture(-1); } - public STexture AddTexture(Bitmap bmp) + public CTexture AddTexture(Bitmap bmp) { if (bmp.Height == 0 || bmp.Width == 0) - return new STexture(-1); + return new CTexture(-1); int maxSize; switch (CConfig.TextureQuality) @@ -698,7 +699,7 @@ namespace Vocaluxe.Lib.Draw break; } - STexture texture = new STexture(-1, bmp.Width, bmp.Height) {UseFullTexture = true}; + CTexture texture = new CTexture(-1, bmp.Width, bmp.Height) {UseFullTexture = true}; int id = GL.GenTexture(); GL.BindTexture(TextureTarget.Texture2D, id); @@ -761,9 +762,9 @@ namespace Vocaluxe.Lib.Draw return texture; } - public STexture AddTexture(int w, int h, byte[] data) + public CTexture AddTexture(int w, int h, byte[] data) { - STexture texture = new STexture(-1, w, h); + CTexture texture = new CTexture(-1, w, h); _CreateTexture(data, ref texture); @@ -776,7 +777,7 @@ namespace Vocaluxe.Lib.Draw return texture; } - private void _CreateTexture(byte[] data, ref STexture texture) + private void _CreateTexture(byte[] data, ref CTexture texture) { int w = texture.OrigSize.Width; int h = texture.OrigSize.Height; @@ -822,9 +823,9 @@ namespace Vocaluxe.Lib.Draw texture.TexturePath = String.Empty; } - public STexture EnqueueTexture(int w, int h, byte[] data) + public CTexture EnqueueTexture(int w, int h, byte[] data) { - STexture texture = new STexture(-1, w, h); + CTexture texture = new CTexture(-1, w, h); STextureQueue queue = new STextureQueue {Data = data, Height = h, Width = w}; lock (_MutexTexture) @@ -840,7 +841,7 @@ namespace Vocaluxe.Lib.Draw #endregion adding #region updating - public bool UpdateTexture(ref STexture texture, byte[] data) + public bool UpdateTexture(ref CTexture texture, byte[] data) { if (_TextureExists(ref texture)) { @@ -882,7 +883,7 @@ namespace Vocaluxe.Lib.Draw } #endregion updating - public void RemoveTexture(ref STexture texture) + public void RemoveTexture(ref CTexture texture) { if ((texture.Index > 0) && (_Textures.Count > 0)) { @@ -899,7 +900,7 @@ namespace Vocaluxe.Lib.Draw } } - private bool _TextureExists(ref STexture texture) + private bool _TextureExists(ref CTexture texture) { lock (_MutexTexture) { @@ -916,22 +917,22 @@ namespace Vocaluxe.Lib.Draw } #region drawing - public void DrawTexture(STexture texture) + public void DrawTexture(CTexture texture) { DrawTexture(texture, texture.Rect, texture.Color); } - public void DrawTexture(STexture texture, SRectF rect) + public void DrawTexture(CTexture texture, SRectF rect) { DrawTexture(texture, rect, texture.Color); } - public void DrawTexture(STexture texture, SRectF rect, SColorF color, bool mirrored = false) + public void DrawTexture(CTexture texture, SRectF rect, SColorF color, bool mirrored = false) { DrawTexture(texture, rect, color, new SRectF(0, 0, CSettings.RenderW, CSettings.RenderH, rect.Z), mirrored); } - public void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false) + public void DrawTexture(CTexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false) { if (Math.Abs(rect.W) < float.Epsilon || Math.Abs(rect.H) < float.Epsilon || Math.Abs(bounds.H) < float.Epsilon || Math.Abs(bounds.W) < float.Epsilon || Math.Abs(color.A) < float.Epsilon) @@ -1039,7 +1040,7 @@ namespace Vocaluxe.Lib.Draw GL.BindTexture(TextureTarget.Texture2D, 0); } - public void DrawTexture(STexture texture, SRectF rect, SColorF color, float begin, float end) + public void DrawTexture(CTexture texture, SRectF rect, SColorF color, float begin, float end) { if (_TextureExists(ref texture)) { @@ -1071,7 +1072,7 @@ namespace Vocaluxe.Lib.Draw } } - public void DrawTextureReflection(STexture texture, SRectF rect, SColorF color, SRectF bounds, float space, float height) + public void DrawTextureReflection(CTexture texture, SRectF rect, SColorF color, SRectF bounds, float space, float height) { if (Math.Abs(rect.W) < float.Epsilon || Math.Abs(rect.H) < float.Epsilon || Math.Abs(bounds.H) < float.Epsilon || Math.Abs(bounds.W) < float.Epsilon || Math.Abs(color.A) < float.Epsilon || height <= float.Epsilon) @@ -1180,7 +1181,7 @@ namespace Vocaluxe.Lib.Draw { STextureQueue q = _Queue[0]; _Queue.RemoveAt(0); - STexture texture = new STexture(-1); + CTexture texture = new CTexture(-1); if (_Textures.ContainsKey(q.ID)) texture = _Textures[q.ID]; diff --git a/Vocaluxe/Lib/Draw/IDraw.cs b/Vocaluxe/Lib/Draw/IDraw.cs index 77a605aa..b5066667 100644 --- a/Vocaluxe/Lib/Draw/IDraw.cs +++ b/Vocaluxe/Lib/Draw/IDraw.cs @@ -18,6 +18,7 @@ #endregion using System.Drawing; +using VocaluxeLib.Draw; using VocaluxeLib.Menu; namespace Vocaluxe.Lib.Draw @@ -34,28 +35,28 @@ namespace Vocaluxe.Lib.Draw int GetTextureCount(); void ClearScreen(); - STexture CopyScreen(); - void CopyScreen(ref STexture texture); + CTexture CopyScreen(); + void CopyScreen(ref CTexture texture); void MakeScreenShot(); - STexture AddTexture(string texturePath); - STexture AddTexture(Bitmap bitmap); - STexture AddTexture(int w, int h, byte[] data); - STexture EnqueueTexture(int w, int h, byte[] data); - bool UpdateTexture(ref STexture texture, byte[] data); - void RemoveTexture(ref STexture texture); + CTexture AddTexture(string texturePath); + CTexture AddTexture(Bitmap bitmap); + CTexture AddTexture(int w, int h, byte[] data); + CTexture EnqueueTexture(int w, int h, byte[] data); + bool UpdateTexture(ref CTexture texture, byte[] data); + void RemoveTexture(ref CTexture texture); // Basic Draw Methods void DrawLine(int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2); void DrawColor(SColorF color, SRectF rect); void DrawColorReflection(SColorF color, SRectF rect, float space, float height); - void DrawTexture(STexture texture); - void DrawTexture(STexture texture, SRectF rect); - void DrawTexture(STexture texture, SRectF rect, SColorF color, bool mirrored = false); - void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false); - void DrawTexture(STexture texture, SRectF rect, SColorF color, float begin, float end); + void DrawTexture(CTexture texture); + void DrawTexture(CTexture texture, SRectF rect); + void DrawTexture(CTexture texture, SRectF rect, SColorF color, bool mirrored = false); + void DrawTexture(CTexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false); + void DrawTexture(CTexture texture, SRectF rect, SColorF color, float begin, float end); - void DrawTextureReflection(STexture texture, SRectF rect, SColorF color, SRectF bounds, float space, float height); + void DrawTextureReflection(CTexture texture, SRectF rect, SColorF color, SRectF bounds, float space, float height); } } \ No newline at end of file diff --git a/Vocaluxe/Lib/Video/CVideoDecoder.cs b/Vocaluxe/Lib/Video/CVideoDecoder.cs index 53d96bef..691f5e96 100644 --- a/Vocaluxe/Lib/Video/CVideoDecoder.cs +++ b/Vocaluxe/Lib/Video/CVideoDecoder.cs @@ -19,6 +19,7 @@ using System.Collections.Generic; using System.Linq; +using VocaluxeLib.Draw; using VocaluxeLib.Menu; namespace Vocaluxe.Lib.Video @@ -58,7 +59,7 @@ namespace Vocaluxe.Lib.Video return 0f; } - public abstract bool GetFrame(int streamID, ref STexture frame, float time, out float videoTime); + public abstract bool GetFrame(int streamID, ref CTexture frame, float time, out float videoTime); public virtual bool Skip(int streamID, float start, float gap) { diff --git a/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs b/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs index 77f6592a..7203b015 100644 --- a/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs +++ b/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs @@ -25,6 +25,7 @@ using System.Runtime.InteropServices; using System.Threading; using Vocaluxe.Base; using Vocaluxe.Lib.Video.Acinerella; +using VocaluxeLib.Draw; using VocaluxeLib.Menu; namespace Vocaluxe.Lib.Video @@ -90,7 +91,7 @@ namespace Vocaluxe.Lib.Video return false; } - public override bool GetFrame(int streamID, ref STexture frame, float time, out float videoTime) + public override bool GetFrame(int streamID, ref CTexture frame, float time, out float videoTime) { videoTime = 0; if (_Initialized) @@ -299,7 +300,7 @@ namespace Vocaluxe.Lib.Video return true; } - public bool GetFrame(ref STexture frame, float time, out float videoTime) + public bool GetFrame(ref CTexture frame, float time, out float videoTime) { videoTime = 0; if (!_FileOpened) @@ -650,7 +651,7 @@ namespace Vocaluxe.Lib.Video } } - private void _UploadNewFrame(ref STexture frame) + private void _UploadNewFrame(ref CTexture frame) { if (!_FileOpened) return; diff --git a/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs b/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs index 4c411cc2..5d9def8b 100644 --- a/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs +++ b/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs @@ -20,6 +20,7 @@ using System; using Vocaluxe.Base; using Vocaluxe.Lib.Video.Gstreamer; +using VocaluxeLib.Draw; using VocaluxeLib.Menu; namespace Vocaluxe.Lib.Video @@ -78,7 +79,7 @@ namespace Vocaluxe.Lib.Video return CGstreamerVideoWrapper.GetVideoLength(streamID); } - public bool GetFrame(int streamID, ref STexture frame, float time, out float videoTime) + public bool GetFrame(int streamID, ref CTexture frame, float time, out float videoTime) { SManagedFrame managedFrame = CGstreamerVideoWrapper.GetFrame(streamID, time); videoTime = managedFrame.Videotime; @@ -117,7 +118,7 @@ namespace Vocaluxe.Lib.Video CGstreamerVideoWrapper.UpdateVideo(); } - private void _UploadNewFrame(ref STexture frame, ref byte[] data, int width, int height) + private void _UploadNewFrame(ref CTexture frame, ref byte[] data, int width, int height) { if (data == null) return; diff --git a/Vocaluxe/Lib/Video/IVideoDecoder.cs b/Vocaluxe/Lib/Video/IVideoDecoder.cs index 4dc3905a..ef8d57c7 100644 --- a/Vocaluxe/Lib/Video/IVideoDecoder.cs +++ b/Vocaluxe/Lib/Video/IVideoDecoder.cs @@ -17,6 +17,7 @@ // */ #endregion +using VocaluxeLib.Draw; using VocaluxeLib.Menu; namespace Vocaluxe.Lib.Video @@ -41,7 +42,7 @@ namespace Vocaluxe.Lib.Video int GetNumStreams(); float GetLength(int streamID); - bool GetFrame(int streamID, ref STexture frame, float time, out float videoTime); + bool GetFrame(int streamID, ref CTexture frame, float time, out float videoTime); bool Skip(int streamID, float start, float gap); void SetLoop(int streamID, bool loop); void Pause(int streamID); diff --git a/Vocaluxe/Lib/Webcam/CAForgeNet.cs b/Vocaluxe/Lib/Webcam/CAForgeNet.cs index e2589dfe..20530dae 100644 --- a/Vocaluxe/Lib/Webcam/CAForgeNet.cs +++ b/Vocaluxe/Lib/Webcam/CAForgeNet.cs @@ -24,6 +24,7 @@ using System.Drawing; using System.Drawing.Imaging; using System.Runtime.InteropServices; using Vocaluxe.Base; +using VocaluxeLib.Draw; using VocaluxeLib.Menu; namespace Vocaluxe.Lib.Webcam @@ -50,7 +51,7 @@ namespace Vocaluxe.Lib.Webcam } } - public bool GetFrame(ref STexture frame) + public bool GetFrame(ref CTexture frame) { if (_Webcam != null && _Width > 0 && _Height > 0 && _Data.Length == _Width * _Height * 4) { diff --git a/Vocaluxe/Lib/Webcam/IWebcam.cs b/Vocaluxe/Lib/Webcam/IWebcam.cs index 32804bfc..0d8042ef 100644 --- a/Vocaluxe/Lib/Webcam/IWebcam.cs +++ b/Vocaluxe/Lib/Webcam/IWebcam.cs @@ -19,6 +19,7 @@ using System.Collections.Generic; using System.Drawing; +using VocaluxeLib.Draw; using VocaluxeLib.Menu; namespace Vocaluxe.Lib.Webcam @@ -54,7 +55,7 @@ namespace Vocaluxe.Lib.Webcam void Stop(); void Close(); - bool GetFrame(ref STexture frame); + bool GetFrame(ref CTexture frame); Bitmap GetBitmap(); SWebcamConfig GetConfig(); SWebcamDevice[] GetDevices(); diff --git a/Vocaluxe/Screens/CScreenCredits.cs b/Vocaluxe/Screens/CScreenCredits.cs index e5d3e81c..861adea3 100644 --- a/Vocaluxe/Screens/CScreenCredits.cs +++ b/Vocaluxe/Screens/CScreenCredits.cs @@ -23,6 +23,7 @@ using System.Diagnostics; using System.Windows.Forms; using Vocaluxe.Base; using Vocaluxe.Base.Fonts; +using VocaluxeLib.Draw; using VocaluxeLib.Menu; namespace Vocaluxe.Screens @@ -126,21 +127,21 @@ namespace Vocaluxe.Screens private List _Paragraphs; private List _ParagraphTexts; - private STexture _TexLogo; - private STexture _TexPerfectNoteStar; + private CTexture _TexLogo; + private CTexture _TexPerfectNoteStar; - private STexture _TexRedDot; - private STexture _TexBlueDot; + private CTexture _TexRedDot; + private CTexture _TexBlueDot; - private STexture _TexNameBrunzel; - private STexture _TexNameDarkice; - private STexture _TexNameFlokuep; - private STexture _TexNameFlamefire; - private STexture _TexNameMesand; - private STexture _TexNameBohning; - private STexture _TexNameBabene03; - private STexture _TexNamePantero; - private STexture _TexNamePinky007; + private CTexture _TexNameBrunzel; + private CTexture _TexNameDarkice; + private CTexture _TexNameFlokuep; + private CTexture _TexNameFlamefire; + private CTexture _TexNameMesand; + private CTexture _TexNameBohning; + private CTexture _TexNameBabene03; + private CTexture _TexNamePantero; + private CTexture _TexNamePinky007; public override void Init() { @@ -282,12 +283,12 @@ namespace Vocaluxe.Screens return GetNewParticleEffect(numStars, partColor, rect, _TexPerfectNoteStar, partSize, EParticleType.Star); } - private void _AddNewCreditName(STexture texture, int particleOffsetX, int particleOffsetY, bool bigParticles) + private void _AddNewCreditName(CTexture texture, int particleOffsetX, int particleOffsetY, bool bigParticles) { bool isRight = _CreditNames.Count % 2 == 0; int partRectSize = bigParticles ? 25 : 20; int partCount = bigParticles ? 8 : 6; - STexture texDot = isRight ? _TexRedDot : _TexBlueDot; + CTexture texDot = isRight ? _TexRedDot : _TexBlueDot; CStatic image = GetNewStatic(texture, new SColorF(1, 1, 1, 1), new SRectF(-1, -1, 400, 120, -4)); diff --git a/Vocaluxe/Screens/CScreenNames.cs b/Vocaluxe/Screens/CScreenNames.cs index c1e332c4..30ad6d92 100644 --- a/Vocaluxe/Screens/CScreenNames.cs +++ b/Vocaluxe/Screens/CScreenNames.cs @@ -21,6 +21,7 @@ using System; using System.Collections.Generic; using System.Windows.Forms; using Vocaluxe.Base; +using VocaluxeLib.Draw; using VocaluxeLib.Menu; namespace Vocaluxe.Screens @@ -53,7 +54,7 @@ namespace Vocaluxe.Screens {"EqualizerPlayer1", "EqualizerPlayer2", "EqualizerPlayer3", "EqualizerPlayer4", "EqualizerPlayer5", "EqualizerPlayer6"}; private readonly string[] _SelectSlideDuetPlayer = new string[] {"SelectSlideDuetPlayer1", "SelectSlideDuetPlayer2", "SelectSlideDuetPlayer3", "SelectSlideDuetPlayer4", "SelectSlideDuetPlayer5", "SelectSlideDuetPlayer6"}; - private readonly STexture[] _OriginalPlayerAvatarTextures = new STexture[CSettings.MaxNumPlayer]; + private readonly CTexture[] _OriginalPlayerAvatarTextures = new CTexture[CSettings.MaxNumPlayer]; private bool _SelectingKeyboardActive; private bool _SelectingFast; diff --git a/Vocaluxe/Screens/CScreenOptionsVideo.cs b/Vocaluxe/Screens/CScreenOptionsVideo.cs index 3367edc2..6bbcee44 100644 --- a/Vocaluxe/Screens/CScreenOptionsVideo.cs +++ b/Vocaluxe/Screens/CScreenOptionsVideo.cs @@ -21,6 +21,7 @@ using System; using System.Windows.Forms; using Vocaluxe.Base; using Vocaluxe.Lib.Webcam; +using VocaluxeLib.Draw; using VocaluxeLib.Menu; namespace Vocaluxe.Screens @@ -45,7 +46,7 @@ namespace Vocaluxe.Screens private const string _ButtonExit = "ButtonExit"; private SWebcamConfig _Config; - private STexture _WebcamTexture = new STexture(-1); + private CTexture _WebcamTexture = new CTexture(-1); private int _DeviceNr; private int _CapabilityNr; diff --git a/Vocaluxe/Screens/CScreenProfiles.cs b/Vocaluxe/Screens/CScreenProfiles.cs index b3c3740e..c666ee16 100644 --- a/Vocaluxe/Screens/CScreenProfiles.cs +++ b/Vocaluxe/Screens/CScreenProfiles.cs @@ -23,6 +23,7 @@ using System.Drawing.Imaging; using System.IO; using System.Windows.Forms; using Vocaluxe.Base; +using VocaluxeLib.Draw; using VocaluxeLib.Menu; namespace Vocaluxe.Screens @@ -60,7 +61,7 @@ namespace Vocaluxe.Screens private EEditMode _EditMode; - private STexture _WebcamTexture = new STexture(-1); + private CTexture _WebcamTexture = new CTexture(-1); private Bitmap _Snapshot; public override void Init() diff --git a/Vocaluxe/Screens/CScreenScore.cs b/Vocaluxe/Screens/CScreenScore.cs index 57764cac..8c2ad2f9 100644 --- a/Vocaluxe/Screens/CScreenScore.cs +++ b/Vocaluxe/Screens/CScreenScore.cs @@ -22,6 +22,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Windows.Forms; using Vocaluxe.Base; +using VocaluxeLib.Draw; using VocaluxeLib.Menu; using VocaluxeLib.Menu.SongMenu; @@ -367,7 +368,7 @@ namespace Vocaluxe.Screens _Statics[_StaticPointsBarBG[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; _Statics[_StaticAvatar[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; - _Statics[_StaticAvatar[player, numplayer]].Texture = new STexture(-1); + _Statics[_StaticAvatar[player, numplayer]].Texture = new CTexture(-1); } } } diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index 166dd841..1f018cfc 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -26,6 +26,7 @@ using System.Linq; using System.Windows.Forms; using Vocaluxe.Base; using Vocaluxe.Base.Fonts; +using VocaluxeLib.Draw; using VocaluxeLib.Menu; using VocaluxeLib.Menu.SingNotes; using VocaluxeLib.Menu.SongMenu; @@ -96,9 +97,9 @@ namespace Vocaluxe.Screens private const float _Volume = 100f; private int _CurrentVideo = -1; private EAspect _VideoAspect = EAspect.Crop; - private STexture _CurrentVideoTexture = new STexture(-1); - private STexture _CurrentWebcamFrameTexture = new STexture(-1); - private STexture _Background = new STexture(-1); + private CTexture _CurrentVideoTexture = new CTexture(-1); + private CTexture _CurrentWebcamFrameTexture = new CTexture(-1); + private CTexture _Background = new CTexture(-1); private float _CurrentTime; private float _FinishTime; @@ -411,8 +412,8 @@ namespace Vocaluxe.Screens _FadeOut = false; _CurrentVideo = -1; - _CurrentVideoTexture = new STexture(-1); - _CurrentWebcamFrameTexture = new STexture(-1); + _CurrentVideoTexture = new CTexture(-1); + _CurrentWebcamFrameTexture = new CTexture(-1); _CurrentBeat = -100; _CurrentTime = 0f; _FinishTime = 0f; @@ -453,7 +454,7 @@ namespace Vocaluxe.Screens { if (_Active) { - STexture background; + CTexture background; EAspect aspect = EAspect.Crop; if (_CurrentVideo != -1 && CConfig.VideosInSongs == EOffOn.TR_CONFIG_ON && !_Webcam) { @@ -1353,7 +1354,7 @@ namespace Vocaluxe.Screens foreach (CLine line in voice.Lines.Where(line => line.VisibleInTimeLine)) { STimeRect trect = new STimeRect {StartBeat = line.FirstNoteBeat, EndBeat = line.EndBeat}; - trect.Rect = GetNewStatic(new STexture(-1), + trect.Rect = GetNewStatic(new CTexture(-1), new SColorF(1f, 1f, 1f, 1f), new SRectF( stat.Rect.X + stat.Rect.W * ((CGame.GetTimeFromBeats(trect.StartBeat, song.BPM) + song.Gap - song.Start) / totalTime), diff --git a/VocaluxeLib/Draw/CTexture.cs b/VocaluxeLib/Draw/CTexture.cs new file mode 100644 index 00000000..f987ec8b --- /dev/null +++ b/VocaluxeLib/Draw/CTexture.cs @@ -0,0 +1,120 @@ +using System; +using System.Drawing; +using VocaluxeLib.Menu; + +namespace VocaluxeLib.Draw +{ + public class CTexture + { + public int Index; + public int PBO; + public int ID; + + public string TexturePath; + + /// + /// Original size (e.g. of bmp) + /// + public readonly Size OrigSize; + public float OrigAspect + { + get { return (float)OrigSize.Width / OrigSize.Height; } + } + + /// + /// Current size when drawn + /// + public SRectF Rect; + + public SColorF Color; + + private int _W2, _H2; + private float _WidthRatio, _HeightRatio; + private bool _UseFullTexture; + /// + /// Internal texture width (on device), a power of 2 if necessary + /// + public int W2 + { + get { return _W2; } + set + { + _W2 = value; + if (!_UseFullTexture) + WidthRatio = (float)OrigSize.Width / _W2; + } + } + /// + /// Internal texture height (on device), a power of 2 if necessary + /// + public int H2 + { + get { return _H2; } + set + { + _H2 = value; + if (!_UseFullTexture) + HeightRatio = (float)OrigSize.Height / _H2; + } + } + + /// + /// Internal use. Specifies which part of texture memory is actually used + /// + public float WidthRatio + { + get { return _WidthRatio; } + private set { _WidthRatio = value; } + } + /// + /// Internal use. Specifies which part of texture memory is actually used + /// + public float HeightRatio + { + get { return _HeightRatio; } + private set { _HeightRatio = value; } + } + + /// + /// Internal use. Specifies if full texture memory should be used + /// Set to true if you resized the original image to the maximum + /// + public bool UseFullTexture + { + get { return _UseFullTexture; } + set + { + _UseFullTexture = value; + if (value) + { + WidthRatio = 1; + HeightRatio = 1; + } + else + { + WidthRatio = (float)OrigSize.Width / _W2; + HeightRatio = (float)OrigSize.Height / _H2; + } + } + } + + public CTexture(int index, int origWidth = 1, int origHeight = 1) + { + Index = index; + PBO = 0; + ID = -1; + TexturePath = String.Empty; + + OrigSize = new Size(origWidth, origHeight); + Rect = new SRectF(0f, 0f, origWidth, origHeight, 0f); + + Color = new SColorF(1f, 1f, 1f, 1f); + + _W2 = origWidth; + _H2 = origHeight; + _WidthRatio = 1; + _HeightRatio = 1; + _UseFullTexture = false; + } + } +} \ No newline at end of file diff --git a/VocaluxeLib/Menu/CBackground.cs b/VocaluxeLib/Menu/CBackground.cs index 073325ea..21e6814d 100644 --- a/VocaluxeLib/Menu/CBackground.cs +++ b/VocaluxeLib/Menu/CBackground.cs @@ -20,6 +20,7 @@ using System; using System.Drawing; using System.Xml; +using VocaluxeLib.Draw; namespace VocaluxeLib.Menu { @@ -202,7 +203,7 @@ namespace VocaluxeLib.Menu private bool _DrawTexture() { - STexture texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID); + CTexture texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID); if (texture.OrigSize.Height > 1) { RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH()); @@ -217,7 +218,7 @@ namespace VocaluxeLib.Menu private bool _DrawVideo() { - STexture videoTexture = CBase.Theme.GetSkinVideoTexture(_Theme.VideoName, _PartyModeID); + CTexture videoTexture = CBase.Theme.GetSkinVideoTexture(_Theme.VideoName, _PartyModeID); if (videoTexture.OrigSize.Height > 1) { RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH()); @@ -232,7 +233,7 @@ namespace VocaluxeLib.Menu private bool _DrawBackgroundMusicVideo() { - STexture videoTexture = CBase.BackgroundMusic.GetVideoTexture(); + CTexture videoTexture = CBase.BackgroundMusic.GetVideoTexture(); if (videoTexture.OrigSize.Height > 1) { RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH()); diff --git a/VocaluxeLib/Menu/CButton.cs b/VocaluxeLib/Menu/CButton.cs index 976da6b4..0ac3edca 100644 --- a/VocaluxeLib/Menu/CButton.cs +++ b/VocaluxeLib/Menu/CButton.cs @@ -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; @@ -94,8 +95,8 @@ namespace VocaluxeLib.Menu Rect = new SRectF(); Color = new SColorF(); SelColor = new SColorF(); - Texture = new STexture(-1); - SelTexture = new STexture(-1); + Texture = new CTexture(-1); + SelTexture = new CTexture(-1); _IsSelText = false; Text = new CText(_PartyModeID); @@ -301,7 +302,7 @@ namespace VocaluxeLib.Menu if (!Visible && CBase.Settings.GetGameState() != EGameState.EditTheme && !forceDraw) return; - STexture texture; + CTexture texture; if (!Selected && !Pressed || !Enabled) { diff --git a/VocaluxeLib/Menu/CMenu.cs b/VocaluxeLib/Menu/CMenu.cs index 9a5d6da8..3de37a98 100644 --- a/VocaluxeLib/Menu/CMenu.cs +++ b/VocaluxeLib/Menu/CMenu.cs @@ -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); } diff --git a/VocaluxeLib/Menu/CNameSelection.cs b/VocaluxeLib/Menu/CNameSelection.cs index 39fba2b4..2347ca88 100644 --- a/VocaluxeLib/Menu/CNameSelection.cs +++ b/VocaluxeLib/Menu/CNameSelection.cs @@ -21,6 +21,7 @@ using System; using System.Collections.Generic; using System.Windows.Forms; using System.Xml; +using VocaluxeLib.Draw; namespace VocaluxeLib.Menu { @@ -69,8 +70,8 @@ namespace VocaluxeLib.Menu public SRectF Rect; private readonly List _Tiles; - private STexture _TextureEmptyTile; - private STexture _TextureTileSelected; + private CTexture _TextureEmptyTile; + private CTexture _TextureTileSelected; public SColorF ColorEmptyTile; diff --git a/VocaluxeLib/Menu/CParticle.cs b/VocaluxeLib/Menu/CParticle.cs index e9a832cc..928e624e 100644 --- a/VocaluxeLib/Menu/CParticle.cs +++ b/VocaluxeLib/Menu/CParticle.cs @@ -21,6 +21,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.Xml; +using VocaluxeLib.Draw; namespace VocaluxeLib.Menu { @@ -45,7 +46,7 @@ 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; @@ -115,7 +116,7 @@ namespace VocaluxeLib.Menu { _PartyModeID = partyModeID; _TextureName = textureName; - _Texture = new STexture(-1); + _Texture = new CTexture(-1); _Color = color; _Rect = new SRectF(x, y, size, size, z); _Size = size; @@ -134,7 +135,7 @@ namespace VocaluxeLib.Menu _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; @@ -312,7 +313,7 @@ namespace VocaluxeLib.Menu private SThemeParticleEffect _Theme; private bool _ThemeLoaded; - public STexture Texture; + public CTexture Texture; public SColorF Color; public SRectF Rect; @@ -356,7 +357,7 @@ namespace VocaluxeLib.Menu Rect = rect; Color = color; _Theme.TextureName = textureName; - Texture = new STexture(-1); + Texture = new CTexture(-1); _MaxNumber = maxNumber; _Size = size; _Type = type; @@ -365,7 +366,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(); @@ -602,7 +603,7 @@ namespace VocaluxeLib.Menu public void UnloadTextures() { - Texture = new STexture(); + Texture = new CTexture(); } public void LoadTextures() diff --git a/VocaluxeLib/Menu/CScreenSetting.cs b/VocaluxeLib/Menu/CScreenSetting.cs index 691074f9..ffe6e98f 100644 --- a/VocaluxeLib/Menu/CScreenSetting.cs +++ b/VocaluxeLib/Menu/CScreenSetting.cs @@ -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); } diff --git a/VocaluxeLib/Menu/CSelectSlide.cs b/VocaluxeLib/Menu/CSelectSlide.cs index 488d2af6..1269aaeb 100644 --- a/VocaluxeLib/Menu/CSelectSlide.cs +++ b/VocaluxeLib/Menu/CSelectSlide.cs @@ -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 _ValueNames; private readonly List _ValuePartyModeIDs; - private readonly List _Textures; + private readonly List _Textures; private readonly List _ValueIndexes; private readonly List _ValueBounds = new List(); @@ -178,7 +179,7 @@ namespace VocaluxeLib.Menu MaxW = 0f; _Selected = false; - _Textures = new List(); + _Textures = new List(); _ValueIndexes = new List(); _ValueNames = new List(); _ValuePartyModeIDs = new List(); @@ -226,7 +227,7 @@ namespace VocaluxeLib.Menu MaxW = slide.MaxW; _Selected = slide._Selected; - _Textures = new List(slide._Textures); + _Textures = new List(slide._Textures); _ValueIndexes = new List(slide._ValueIndexes); _ValueNames = new List(slide._ValueNames); _ValueBounds = new List(slide._ValueBounds); @@ -530,20 +531,20 @@ namespace VocaluxeLib.Menu public void AddValue(string value, int partyModeID) { - AddValue(value, new STexture(-1), _ValueIndexes.Count, partyModeID); + AddValue(value, new CTexture(-1), _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 values) { foreach (string value in values) - _AddValue(value, new STexture(-1), _PartyModeID); + _AddValue(value, new CTexture(-1), _PartyModeID); _ValueBounds.Clear(); } - public void AddValues(string[] values, STexture[] textures) + public void AddValues(string[] values, CTexture[] textures) { if (values.Length != textures.Length) return; @@ -590,10 +591,10 @@ namespace VocaluxeLib.Menu public void RenameValue(int selection, string newName) { - RenameValue(selection, newName, new STexture(-1)); + RenameValue(selection, newName, new CTexture(-1)); } - public void RenameValue(int selection, string newName, STexture newTexture) + public void RenameValue(int selection, string newName, CTexture newTexture) { if (selection < 0 && selection >= _ValueNames.Count) return; @@ -696,15 +697,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) { diff --git a/VocaluxeLib/Menu/CStatic.cs b/VocaluxeLib/Menu/CStatic.cs index 3a56a25f..5ad19529 100644 --- a/VocaluxeLib/Menu/CStatic.cs +++ b/VocaluxeLib/Menu/CStatic.cs @@ -20,6 +20,7 @@ using System; using System.Drawing; using System.Xml; +using VocaluxeLib.Draw; namespace VocaluxeLib.Menu { @@ -42,8 +43,8 @@ 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); } @@ -70,7 +71,7 @@ namespace VocaluxeLib.Menu _Theme = new SThemeStatic(); _ThemeLoaded = false; - _Texture = new STexture(-1); + _Texture = new CTexture(-1); Color = new SColorF(); Rect = new SRectF(); Reflection = false; @@ -100,7 +101,7 @@ 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(); @@ -124,7 +125,7 @@ namespace VocaluxeLib.Menu _Theme = new SThemeStatic {TextureName = textureSkinName}; _ThemeLoaded = false; - _Texture = new STexture(-1); + _Texture = new CTexture(-1); Color = color; Rect = rect; Reflection = false; @@ -238,7 +239,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.Index != -1 ? _Texture : CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID); SRectF bounds = new SRectF( Rect.X - Rect.W * (scale - 1f), diff --git a/VocaluxeLib/Menu/IMenu.cs b/VocaluxeLib/Menu/IMenu.cs index b2b91758..aac8f334 100644 --- a/VocaluxeLib/Menu/IMenu.cs +++ b/VocaluxeLib/Menu/IMenu.cs @@ -21,6 +21,7 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Drawing; +using VocaluxeLib.Draw; using VocaluxeLib.Menu.SongMenu; namespace VocaluxeLib.Menu @@ -113,8 +114,8 @@ namespace VocaluxeLib.Menu { 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); @@ -144,17 +145,17 @@ namespace VocaluxeLib.Menu 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); - void RemoveTexture(ref STexture texture); + void RemoveTexture(ref CTexture texture); void DrawColor(SColorF color, SRectF rect); void DrawColorReflection(SColorF color, SRectF rect, float space, float height); @@ -259,7 +260,7 @@ namespace VocaluxeLib.Menu { 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); } @@ -282,12 +283,12 @@ namespace VocaluxeLib.Menu 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 diff --git a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs index f5e68c61..72ca886f 100644 --- a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs +++ b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs @@ -21,6 +21,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.Xml; +using VocaluxeLib.Draw; namespace VocaluxeLib.Menu.SingNotes { @@ -475,9 +476,9 @@ namespace VocaluxeLib.Menu.SingNotes SRectF noteRect = new SRectF(rect.X + dw, rect.Y + dh, rect.W - 2 * dw, rect.H - 2 * dh, rect.Z); - STexture noteBegin = CBase.Theme.GetSkinTexture(_Theme.SkinLeftName, _PartyModeID); - STexture noteMiddle = CBase.Theme.GetSkinTexture(_Theme.SkinMiddleName, _PartyModeID); - STexture noteEnd = CBase.Theme.GetSkinTexture(_Theme.SkinRightName, _PartyModeID); + CTexture noteBegin = CBase.Theme.GetSkinTexture(_Theme.SkinLeftName, _PartyModeID); + CTexture noteMiddle = CBase.Theme.GetSkinTexture(_Theme.SkinMiddleName, _PartyModeID); + CTexture noteEnd = CBase.Theme.GetSkinTexture(_Theme.SkinRightName, _PartyModeID); //Width of each of the ends (round parts) //Need 2 of them so use minimum @@ -522,9 +523,9 @@ 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 = r.H * noteBackgroundBegin.OrigAspect; if (2 * dx > r.W) @@ -617,7 +618,7 @@ namespace VocaluxeLib.Menu.SingNotes rect.Z ); - STexture noteBegin = CBase.Theme.GetSkinTexture(_Theme.SkinLeftName, _PartyModeID); + CTexture noteBegin = CBase.Theme.GetSkinTexture(_Theme.SkinLeftName, _PartyModeID); float dx = r.H * noteBegin.OrigAspect; if (2 * dx > r.W) dx = r.W / 2; @@ -674,7 +675,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); diff --git a/VocaluxeLib/Menu/SongMenu/CCategory.cs b/VocaluxeLib/Menu/SongMenu/CCategory.cs index faa5a22a..299f2adf 100644 --- a/VocaluxeLib/Menu/SongMenu/CCategory.cs +++ b/VocaluxeLib/Menu/SongMenu/CCategory.cs @@ -18,14 +18,15 @@ #endregion using System.Collections.Generic; +using VocaluxeLib.Draw; namespace VocaluxeLib.Menu.SongMenu { public class CCategory { public readonly string Name; - private STexture _CoverTextureSmall = new STexture(-1); - private STexture _CoverTextureBig = new STexture(-1); + private CTexture _CoverTextureSmall = new CTexture(-1); + private CTexture _CoverTextureBig = new CTexture(-1); private bool _CoverBigLoaded; public readonly List Songs = new List(); @@ -34,14 +35,14 @@ namespace VocaluxeLib.Menu.SongMenu Name = name; } - public STexture CoverTextureSmall + public CTexture CoverTextureSmall { get { return _CoverTextureSmall; } set { _CoverTextureSmall = value; } } - public STexture CoverTextureBig + public CTexture CoverTextureBig { get { return _CoverBigLoaded ? _CoverTextureBig : _CoverTextureSmall; } set @@ -53,7 +54,7 @@ namespace VocaluxeLib.Menu.SongMenu } } - public CCategory(string name, STexture coverSmall, STexture coverBig) + public CCategory(string name, CTexture coverSmall, CTexture coverBig) { Name = name; CoverTextureSmall = coverSmall; diff --git a/VocaluxeLib/Menu/SongMenu/CSong.cs b/VocaluxeLib/Menu/SongMenu/CSong.cs index c3598585..dc01c3f6 100644 --- a/VocaluxeLib/Menu/SongMenu/CSong.cs +++ b/VocaluxeLib/Menu/SongMenu/CSong.cs @@ -22,6 +22,7 @@ using System.Collections.Generic; using System.IO; using System.Text; using System.Text.RegularExpressions; +using VocaluxeLib.Draw; using VocaluxeLib.Menu.SingNotes; namespace VocaluxeLib.Menu.SongMenu @@ -71,8 +72,8 @@ namespace VocaluxeLib.Menu.SongMenu { private bool _CoverSmallLoaded; private bool _CoverBigLoaded; - private STexture _CoverTextureSmall = new STexture(-1); - private STexture _CoverTextureBig = new STexture(-1); + private CTexture _CoverTextureSmall = new CTexture(-1); + private CTexture _CoverTextureBig = new CTexture(-1); public SMedley Medley; @@ -96,7 +97,7 @@ namespace VocaluxeLib.Menu.SongMenu public bool NotesLoaded { get; private set; } - public STexture CoverTextureSmall + public CTexture CoverTextureSmall { get { @@ -112,7 +113,7 @@ namespace VocaluxeLib.Menu.SongMenu } } - public STexture CoverTextureBig + public CTexture CoverTextureBig { get { return _CoverBigLoaded ? _CoverTextureBig : _CoverTextureSmall; } set diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs index 8ff84dc1..3621c14c 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs @@ -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 _Streams = new List(); private int _Actsong = -1; private int _Actsongstream = -1; - protected STexture _Vidtex = new STexture(-1); + protected CTexture _Vidtex = new CTexture(-1); protected bool _Initialized; protected int _LastKnownNumSongs; @@ -463,7 +464,7 @@ namespace VocaluxeLib.Menu.SongMenu public virtual void OnShow() { _Actsongstream = -1; - _Vidtex = new STexture(-1); + _Vidtex = new CTexture(-1); } public virtual void OnHide() diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs index cad9f32f..960f896a 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs @@ -22,6 +22,7 @@ using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Windows.Forms; +using VocaluxeLib.Draw; using VocaluxeLib.PartyModes; namespace VocaluxeLib.Menu.SongMenu @@ -37,8 +38,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; diff --git a/VocaluxeLib/Menu/Structs.cs b/VocaluxeLib/Menu/Structs.cs index fef94d82..fbce1f29 100644 --- a/VocaluxeLib/Menu/Structs.cs +++ b/VocaluxeLib/Menu/Structs.cs @@ -21,6 +21,7 @@ using System; using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; +using VocaluxeLib.Draw; using VocaluxeLib.Menu.SingNotes; namespace VocaluxeLib.Menu @@ -99,120 +100,6 @@ namespace VocaluxeLib.Menu public int Y; public int Z; } - - public struct STexture - { - public int Index; - public int PBO; - public int ID; - - public string TexturePath; - - /// - /// Original size (e.g. of bmp) - /// - public readonly Size OrigSize; - public float OrigAspect - { - get { return (float)OrigSize.Width / OrigSize.Height; } - } - - /// - /// Current size when drawn - /// - public SRectF Rect; - - public SColorF Color; - - private int _W2, _H2; - private float _WidthRatio, _HeightRatio; - private bool _UseFullTexture; - /// - /// Internal texture width (on device), a power of 2 if necessary - /// - public int W2 - { - get { return _W2; } - set - { - _W2 = value; - if (!_UseFullTexture) - WidthRatio = (float)OrigSize.Width / _W2; - } - } - /// - /// Internal texture height (on device), a power of 2 if necessary - /// - public int H2 - { - get { return _H2; } - set - { - _H2 = value; - if (!_UseFullTexture) - HeightRatio = (float)OrigSize.Height / _H2; - } - } - - /// - /// Internal use. Specifies which part of texture memory is actually used - /// - public float WidthRatio - { - get { return _WidthRatio; } - private set { _WidthRatio = value; } - } - /// - /// Internal use. Specifies which part of texture memory is actually used - /// - public float HeightRatio - { - get { return _HeightRatio; } - private set { _HeightRatio = value; } - } - - /// - /// Internal use. Specifies if full texture memory should be used - /// Set to true if you resized the original image to the maximum - /// - public bool UseFullTexture - { - get { return _UseFullTexture; } - set - { - _UseFullTexture = value; - if (value) - { - WidthRatio = 1; - HeightRatio = 1; - } - else - { - WidthRatio = (float)OrigSize.Width / _W2; - HeightRatio = (float)OrigSize.Height / _H2; - } - } - } - - public STexture(int index, int origWidth = 1, int origHeight = 1) - { - Index = index; - PBO = 0; - ID = -1; - TexturePath = String.Empty; - - OrigSize = new Size(origWidth, origHeight); - Rect = new SRectF(0f, 0f, origWidth, origHeight, 0f); - - Color = new SColorF(1f, 1f, 1f, 1f); - - _W2 = origWidth; - _H2 = origHeight; - _WidthRatio = 1; - _HeightRatio = 1; - _UseFullTexture = false; - } - } #endregion Drawing #region Inputs @@ -307,14 +194,14 @@ namespace VocaluxeLib.Menu public struct SAvatar { public string FileName; - public STexture Texture; + public CTexture Texture; // ReSharper disable UnusedParameter.Local public SAvatar(int dummy) // ReSharper restore UnusedParameter.Local { FileName = String.Empty; - Texture = new STexture(-1); + Texture = new CTexture(-1); } } #endregion Profiles diff --git a/VocaluxeLib/VocaluxeLib.csproj b/VocaluxeLib/VocaluxeLib.csproj index 93b1517f..37c027d5 100644 --- a/VocaluxeLib/VocaluxeLib.csproj +++ b/VocaluxeLib/VocaluxeLib.csproj @@ -130,6 +130,7 @@ +