Convert STexture to class CTexture

This commit is contained in:
Flamefire committed 2013-05-04 15:14:02 +02:00
1 parent 017b96be5f
commit f370693dde
45 files changed
+427 -377

No files matched your search

+6 -5
View File
@@ -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<CPlaylistElement> _PreviousFileNames = new List<CPlaylistElement>();
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
{
+7 -6
View File
@@ -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<SCover> _Cover = new List<SCover>();
private static readonly List<SCoverTheme> _CoverThemes = new List<SCoverTheme>();
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
/// <summary>
/// Returns a STexture for a given cover name. Returns "NoCover" if the cover does not exist.
/// </summary>
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();
+3 -2
View File
@@ -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;
+16 -15
View File
@@ -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);
}
+2 -1
View File
@@ -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;
+12 -11
View File
@@ -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);
}
+3 -2
View File
@@ -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)
{
+9 -8
View File
@@ -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)
+5 -4
View File
@@ -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)
+2 -1
View File
@@ -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;
+4 -3
View File
@@ -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);
+3 -2
View File
@@ -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();
+30 -29
View File
@@ -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<int, STexture> _Textures;
private readonly Dictionary<int, CTexture> _Textures;
private readonly Dictionary<int, Texture> _D3DTextures;
private readonly List<STextureQueue> _Queue;
private readonly Queue<int> _IDs;
@@ -65,7 +66,7 @@ namespace Vocaluxe.Lib.Draw
private int _Y;
private int _X;
private STexture _BlankTexture;
private CTexture _BlankTexture;
private readonly Queue<STexturedColoredVertex> _Vertices;
private readonly Queue<Texture> _VerticesTextures;
@@ -80,7 +81,7 @@ namespace Vocaluxe.Lib.Draw
public CDirect3D()
{
Icon = new Icon(Path.Combine(Environment.CurrentDirectory, CSettings.Icon));
_Textures = new Dictionary<int, STexture>();
_Textures = new Dictionary<int, CTexture>();
_D3DTextures = new Dictionary<int, Texture>();
_Queue = new List<STextureQueue>();
_IDs = new Queue<int>();
@@ -676,9 +677,9 @@ namespace Vocaluxe.Lib.Draw
/// Copies the current frame into a texture
/// <returns>A texture holding the current frame</returns>
/// </summary>
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
/// </summary>
/// <param name="texture">The texture in which the frame is copied to</param>
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
/// </summary>
/// <param name="texturePath">The texture's filepath</param>
/// <returns>A STexture object containing the added texture</returns>
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);
}
/// <summary>
@@ -829,10 +830,10 @@ namespace Vocaluxe.Lib.Draw
/// </summary>
/// <param name="bmp">The Bitmap of which the texure will be created from</param>
/// <returns>A STexture object containing the added texture</returns>
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
/// <param name="texture">The texture to update</param>
/// <param name="data">A byte array containing the new texture's data</param>
/// <returns>True if succeeded</returns>
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
/// </summary>
/// <param name="texture">The texture to check</param>
/// <returns>True if the texture exists</returns>
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
/// </summary>
/// <param name="texture">The texture to be removed</param>
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
/// </summary>
/// <param name="texture">The texture to be drawn</param>
public void DrawTexture(STexture texture)
public void DrawTexture(CTexture texture)
{
DrawTexture(texture, texture.Rect, texture.Color);
}
@@ -1052,7 +1053,7 @@ namespace Vocaluxe.Lib.Draw
/// </summary>
/// <param name="texture">The texture to be drawn</param>
/// <param name="rect">A SRectF struct containing the destination coordinates</param>
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
/// <param name="rect">A SRectF struct containing the destination coordinates</param>
/// <param name="color">A SColorF struct containing a color which the texture will be colored in</param>
/// <param name="mirrored">True if the texture should be mirrored</param>
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
/// <param name="color">A SColorF struct containing a color which the texture will be colored in</param>
/// <param name="bounds">A SRectF struct containing which part of the texture should be drawn</param>
/// <param name="mirrored">True if the texture should be mirrored</param>
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
/// <param name="color">A SColorF struct containing a color which the texture will be colored in</param>
/// <param name="begin">A Value ranging from 0 to 1 containing the beginning of the texture</param>
/// <param name="end">A Value ranging from 0 to 1 containing the ending of the texture</param>
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
/// <param name="bounds">A SRectF struct containing which part of the texture should be drawn</param>
/// <param name="space">The space between the texture and the reflection</param>
/// <param name="height">The height of the reflection</param>
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);
+21 -20
View File
@@ -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<STexture> _Textures;
private readonly List<CTexture> _Textures;
private readonly List<Bitmap> _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<STexture>();
_Textures = new List<CTexture>();
_Bitmaps = new List<Bitmap>();
_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()
{
+28 -27
View File
@@ -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<int, STexture> _Textures;
private readonly Dictionary<int, CTexture> _Textures;
private readonly Queue<int> _IDs;
private readonly List<STextureQueue> _Queue;
@@ -100,7 +101,7 @@ namespace Vocaluxe.Lib.Draw
{
Icon = new Icon(Path.Combine(Environment.CurrentDirectory, CSettings.Icon));
_Textures = new Dictionary<int, STexture>();
_Textures = new Dictionary<int, CTexture>();
_Queue = new List<STextureQueue>();
_IDs = new Queue<int>(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];
+15 -14
View File
@@ -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);
}
}
+2 -1
View File
@@ -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)
{
+4 -3
View File
@@ -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;
+3 -2
View File
@@ -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;
+2 -1
View File
@@ -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);
+2 -1
View File
@@ -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)
{
+2 -1
View File
@@ -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();
+16 -15
View File
@@ -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<string[]> _Paragraphs;
private List<CText> _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));
+2 -1
View File
@@ -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;
+2 -1
View File
@@ -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;
+2 -1
View File
@@ -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()
+2 -1
View File
@@ -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);
}
}
}
+8 -7
View File
@@ -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),
+120
View File
@@ -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;
/// <summary>
/// Original size (e.g. of bmp)
/// </summary>
public readonly Size OrigSize;
public float OrigAspect
{
get { return (float)OrigSize.Width / OrigSize.Height; }
}
/// <summary>
/// Current size when drawn
/// </summary>
public SRectF Rect;
public SColorF Color;
private int _W2, _H2;
private float _WidthRatio, _HeightRatio;
private bool _UseFullTexture;
/// <summary>
/// Internal texture width (on device), a power of 2 if necessary
/// </summary>
public int W2
{
get { return _W2; }
set
{
_W2 = value;
if (!_UseFullTexture)
WidthRatio = (float)OrigSize.Width / _W2;
}
}
/// <summary>
/// Internal texture height (on device), a power of 2 if necessary
/// </summary>
public int H2
{
get { return _H2; }
set
{
_H2 = value;
if (!_UseFullTexture)
HeightRatio = (float)OrigSize.Height / _H2;
}
}
/// <summary>
/// Internal use. Specifies which part of texture memory is actually used
/// </summary>
public float WidthRatio
{
get { return _WidthRatio; }
private set { _WidthRatio = value; }
}
/// <summary>
/// Internal use. Specifies which part of texture memory is actually used
/// </summary>
public float HeightRatio
{
get { return _HeightRatio; }
private set { _HeightRatio = value; }
}
/// <summary>
/// Internal use. Specifies if full texture memory should be used
/// Set to true if you resized the original image to the maximum
/// </summary>
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;
}
}
}
+4 -3
View File
@@ -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());
+6 -5
View File
@@ -19,6 +19,7 @@
using System;
using System.Xml;
using VocaluxeLib.Draw;
namespace VocaluxeLib.Menu
{
@@ -39,8 +40,8 @@ namespace VocaluxeLib.Menu
private bool _ThemeLoaded;
private readonly int _PartyModeID;
public STexture Texture;
public STexture SelTexture;
public CTexture Texture;
public CTexture SelTexture;
public SRectF Rect;
public SColorF Color;
public SColorF SelColor;
@@ -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)
{
+3 -2
View File
@@ -24,6 +24,7 @@ using System.IO;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using VocaluxeLib.Draw;
using VocaluxeLib.Menu.SingNotes;
using VocaluxeLib.Menu.SongMenu;
@@ -478,7 +479,7 @@ namespace VocaluxeLib.Menu
return new CStatic(oldStatic);
}
public CStatic GetNewStatic(STexture texture, SColorF color, SRectF rect)
public CStatic GetNewStatic(CTexture texture, SColorF color, SRectF rect)
{
return new CStatic(_PartyModeID, texture, color, rect);
}
@@ -523,7 +524,7 @@ namespace VocaluxeLib.Menu
return new CPlaylist(_PartyModeID);
}
public CParticleEffect GetNewParticleEffect(int maxNumber, SColorF color, SRectF area, STexture texture, float size, EParticleType type)
public CParticleEffect GetNewParticleEffect(int maxNumber, SColorF color, SRectF area, CTexture texture, float size, EParticleType type)
{
return new CParticleEffect(_PartyModeID, maxNumber, color, area, texture, size, type);
}
+3 -2
View File
@@ -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<CTile> _Tiles;
private STexture _TextureEmptyTile;
private STexture _TextureTileSelected;
private CTexture _TextureEmptyTile;
private CTexture _TextureTileSelected;
public SColorF ColorEmptyTile;
+8 -7
View File
@@ -21,6 +21,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Xml;
using VocaluxeLib.Draw;
namespace VocaluxeLib.Menu
{
@@ -45,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()
+2 -1
View File
@@ -19,6 +19,7 @@
using System;
using System.Xml;
using VocaluxeLib.Draw;
namespace VocaluxeLib.Menu
{
@@ -127,7 +128,7 @@ namespace VocaluxeLib.Menu
}
}
private STexture _GetTextureValue(string value)
private CTexture _GetTextureValue(string value)
{
return CBase.Theme.GetSkinTexture(value, _PartyModeID);
}
+19 -18
View File
@@ -21,6 +21,7 @@ using System;
using System.Collections.Generic;
using System.Drawing;
using System.Xml;
using VocaluxeLib.Draw;
namespace VocaluxeLib.Menu
{
@@ -110,7 +111,7 @@ namespace VocaluxeLib.Menu
private readonly List<string> _ValueNames;
private readonly List<int> _ValuePartyModeIDs;
private readonly List<STexture> _Textures;
private readonly List<CTexture> _Textures;
private readonly List<int> _ValueIndexes;
private readonly List<SRectF> _ValueBounds = new List<SRectF>();
@@ -178,7 +179,7 @@ namespace VocaluxeLib.Menu
MaxW = 0f;
_Selected = false;
_Textures = new List<STexture>();
_Textures = new List<CTexture>();
_ValueIndexes = new List<int>();
_ValueNames = new List<string>();
_ValuePartyModeIDs = new List<int>();
@@ -226,7 +227,7 @@ namespace VocaluxeLib.Menu
MaxW = slide.MaxW;
_Selected = slide._Selected;
_Textures = new List<STexture>(slide._Textures);
_Textures = new List<CTexture>(slide._Textures);
_ValueIndexes = new List<int>(slide._ValueIndexes);
_ValueNames = new List<string>(slide._ValueNames);
_ValueBounds = new List<SRectF>(slide._ValueBounds);
@@ -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<string> 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)
{
+7 -6
View File
@@ -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),
+12 -11
View File
@@ -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
+9 -8
View File
@@ -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);
+6 -5
View File
@@ -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<CSongPointer> Songs = new List<CSongPointer>();
@@ -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;
+5 -4
View File
@@ -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
@@ -22,6 +22,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Xml;
using VocaluxeLib.Draw;
using VocaluxeLib.PartyModes;
namespace VocaluxeLib.Menu.SongMenu
@@ -104,7 +105,7 @@ namespace VocaluxeLib.Menu.SongMenu
private readonly List<int> _Streams = new List<int>();
private int _Actsong = -1;
private int _Actsongstream = -1;
protected STexture _Vidtex = new STexture(-1);
protected CTexture _Vidtex = 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()
@@ -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;
+3 -116
View File
@@ -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;
/// <summary>
/// Original size (e.g. of bmp)
/// </summary>
public readonly Size OrigSize;
public float OrigAspect
{
get { return (float)OrigSize.Width / OrigSize.Height; }
}
/// <summary>
/// Current size when drawn
/// </summary>
public SRectF Rect;
public SColorF Color;
private int _W2, _H2;
private float _WidthRatio, _HeightRatio;
private bool _UseFullTexture;
/// <summary>
/// Internal texture width (on device), a power of 2 if necessary
/// </summary>
public int W2
{
get { return _W2; }
set
{
_W2 = value;
if (!_UseFullTexture)
WidthRatio = (float)OrigSize.Width / _W2;
}
}
/// <summary>
/// Internal texture height (on device), a power of 2 if necessary
/// </summary>
public int H2
{
get { return _H2; }
set
{
_H2 = value;
if (!_UseFullTexture)
HeightRatio = (float)OrigSize.Height / _H2;
}
}
/// <summary>
/// Internal use. Specifies which part of texture memory is actually used
/// </summary>
public float WidthRatio
{
get { return _WidthRatio; }
private set { _WidthRatio = value; }
}
/// <summary>
/// Internal use. Specifies which part of texture memory is actually used
/// </summary>
public float HeightRatio
{
get { return _HeightRatio; }
private set { _HeightRatio = value; }
}
/// <summary>
/// Internal use. Specifies if full texture memory should be used
/// Set to true if you resized the original image to the maximum
/// </summary>
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
+1
View File
@@ -130,6 +130,7 @@
<Compile Include="Menu\CStatic.cs" />
<Compile Include="Menu\CText.cs" />
<Compile Include="Menu\CScreenSetting.cs" />
<Compile Include="Draw\CTexture.cs" />
<Compile Include="Menu\CXMLReader.cs" />
<Compile Include="Menu\Enums.cs" />
<Compile Include="Menu\IMenu.cs" />