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

+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" />