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

+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