Changed texture sizes to more reasonable int

This commit is contained in:
Flamefire committed 2013-05-03 20:07:53 +02:00
1 parent 1bfc76e4d3
commit 151fab8857
22 files changed
+67 -66

No files matched your search

@@ -146,7 +146,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
_Rand = rand; _Rand = rand;
} }
public CCombination GetNextCombination(List<int> playerNrDemand) public CCombination GetNextCombination(IEnumerable<int> playerNrDemand)
{ {
if (_Combs.Count == 0) if (_Combs.Count == 0)
_Create(); _Create();
+1 -1
View File
@@ -202,7 +202,7 @@ namespace Vocaluxe.Base
RectangleF bounds = new RectangleF(staticBounds.Rect.X, staticBounds.Rect.Y, staticBounds.Rect.W, staticBounds.Rect.H); RectangleF bounds = new RectangleF(staticBounds.Rect.X, staticBounds.Rect.Y, staticBounds.Rect.W, staticBounds.Rect.H);
RectangleF rect; RectangleF rect;
CHelper.SetRect(bounds, out rect, texture.Width / texture.Height, aspect); CHelper.SetRect(bounds, out rect, (float)texture.Width / texture.Height, aspect);
DrawTexture(texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, staticBounds.Rect.Z), DrawTexture(texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, staticBounds.Rect.Z),
texture.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f)); texture.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f));
} }
+2 -2
View File
@@ -171,7 +171,7 @@ namespace Vocaluxe.Base
float videoTime = _VideoTimer.ElapsedMilliseconds / 1000f; float videoTime = _VideoTimer.ElapsedMilliseconds / 1000f;
_Finished = CVideo.Finished(_VideoStream); _Finished = CVideo.Finished(_VideoStream);
STexture tex = new STexture(-1) {Height = 0f}; STexture tex = new STexture(-1) {Height = 0};
CVideo.GetFrame(_VideoStream, ref tex, videoTime, out videoTime); CVideo.GetFrame(_VideoStream, ref tex, videoTime, out videoTime);
if (tex.Height > 0) if (tex.Height > 0)
@@ -182,7 +182,7 @@ namespace Vocaluxe.Base
} }
RectangleF bounds = new RectangleF(0f, 0f, CSettings.RenderW, CSettings.RenderH); RectangleF bounds = new RectangleF(0f, 0f, CSettings.RenderW, CSettings.RenderH);
RectangleF rect; RectangleF rect;
CHelper.SetRect(bounds, out rect, _VideoTexture.Width / _VideoTexture.Height, EAspect.Crop); CHelper.SetRect(bounds, out rect, (float)_VideoTexture.Width / _VideoTexture.Height, EAspect.Crop);
CDraw.DrawTexture(_VideoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CSettings.ZFar / 4)); CDraw.DrawTexture(_VideoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CSettings.ZFar / 4));
} }
+3 -3
View File
@@ -70,7 +70,7 @@ namespace Vocaluxe.Base.Fonts
private static void _BuildFonts() private static void _BuildFonts()
{ {
foreach (var font in _Fonts) foreach (SFont font in _Fonts)
{ {
font.Normal.Dispose(); font.Normal.Dispose();
font.Bold.Dispose(); font.Bold.Dispose();
@@ -257,8 +257,8 @@ namespace Vocaluxe.Base.Fonts
Height = height; Height = height;
SetFont(text.Font); SetFont(text.Font);
Style = text.Style; Style = text.Style;
var result = new RectangleF(text.X, text.Y, GetTextWidth(CLanguage.Translate(text.Text, text.TranslationID)), RectangleF result = new RectangleF(text.X, text.Y, GetTextWidth(CLanguage.Translate(text.Text, text.TranslationID)),
GetTextHeight(CLanguage.Translate(text.Text, text.TranslationID))); GetTextHeight(CLanguage.Translate(text.Text, text.TranslationID)));
//restore old values //restore old values
Height = oldHeight; Height = oldHeight;
_CurrentFont = oldFont; _CurrentFont = oldFont;
+2
View File
@@ -121,6 +121,7 @@ namespace Vocaluxe.Base.Fonts
_DrawBounding.Width = _Texture.Width; _DrawBounding.Width = _Texture.Width;
_DrawBounding.Height = _Texture.Height;*/ _DrawBounding.Height = _Texture.Height;*/
#pragma warning disable 162 #pragma warning disable 162
// ReSharper disable HeuristicUnreachableCode
if (false) if (false)
{ {
if (outline > 0) if (outline > 0)
@@ -128,6 +129,7 @@ namespace Vocaluxe.Base.Fonts
else else
bmpCropped.Save("font/" + chr + CFonts.Style + "2.png", ImageFormat.Png); bmpCropped.Save("font/" + chr + CFonts.Style + "2.png", ImageFormat.Png);
} }
// ReSharper restore HeuristicUnreachableCode
#pragma warning restore 162 #pragma warning restore 162
} }
} }
+12 -12
View File
@@ -708,7 +708,7 @@ namespace Vocaluxe.Lib.Draw
/// <param name="texture">The texture in which the frame is copied to</param> /// <param name="texture">The texture in which the frame is copied to</param>
public void CopyScreen(ref STexture texture) public void CopyScreen(ref STexture texture)
{ {
if (!_TextureExists(ref texture) || (int)texture.Width != GetScreenWidth() || (int)texture.Height != GetScreenHeight()) if (!_TextureExists(ref texture) || texture.Width != GetScreenWidth() || texture.Height != GetScreenHeight())
{ {
RemoveTexture(ref texture); RemoveTexture(ref texture);
texture = CopyScreen(); texture = CopyScreen();
@@ -758,8 +758,8 @@ namespace Vocaluxe.Lib.Draw
/// <param name="y2">The end y-value</param> /// <param name="y2">The end y-value</param>
public void DrawLine(int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2) public void DrawLine(int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2)
{ {
var lineVector = new Vector2[] {new Vector2(x1, y1), new Vector2(x2, y2)}; Vector2[] lineVector = new Vector2[] {new Vector2(x1, y1), new Vector2(x2, y2)};
using (var line = new Line(_Device)) using (Line line = new Line(_Device))
{ {
line.Antialias = true; line.Antialias = true;
line.Begin(); line.Begin();
@@ -872,9 +872,9 @@ namespace Vocaluxe.Lib.Draw
else if (h > maxSize) else if (h > maxSize)
newH = maxSize; newH = maxSize;
else if (w > h) else if (w > h)
newW = (int)_CheckForNextPowerOf2(w); newW = _CheckForNextPowerOf2(w);
else else
newH = (int)_CheckForNextPowerOf2(h); newH = _CheckForNextPowerOf2(h);
Bitmap bmp2 = null; Bitmap bmp2 = null;
byte[] data; byte[] data;
@@ -943,18 +943,18 @@ namespace Vocaluxe.Lib.Draw
texture.Height = h; texture.Height = h;
texture.W2 = _CheckForNextPowerOf2(w); texture.W2 = _CheckForNextPowerOf2(w);
texture.H2 = _CheckForNextPowerOf2(h); texture.H2 = _CheckForNextPowerOf2(h);
texture.WidthRatio = w / texture.W2; texture.WidthRatio = (float)w / texture.W2;
texture.HeightRatio = h / texture.H2; texture.HeightRatio = (float)h / texture.H2;
//Create a new texture in the managed pool, which does not need to be recreated on a lost device //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 //because a copy of the texture is hold in the Ram
Texture t = null; Texture t = null;
try try
{ {
t = new Texture(_Device, (int)texture.W2, (int)texture.H2, 0, Usage.AutoGenerateMipMap, Format.A8R8G8B8, Pool.Managed); t = new Texture(_Device, texture.W2, texture.H2, 0, Usage.AutoGenerateMipMap, Format.A8R8G8B8, Pool.Managed);
//Lock the texture and fill it with the data //Lock the texture and fill it with the data
DataRectangle rect = t.LockRectangle(0, LockFlags.Discard); DataRectangle rect = t.LockRectangle(0, LockFlags.Discard);
int rowWidth = 4 * (int)texture.W2; int rowWidth = 4 * texture.W2;
for (int i = 0; i + rowWidth <= data.Length; i += 4 * w) for (int i = 0; i + rowWidth <= data.Length; i += 4 * w)
{ {
rect.Data.Write(data, i, rowWidth); rect.Data.Write(data, i, rowWidth);
@@ -1010,7 +1010,7 @@ namespace Vocaluxe.Lib.Draw
lock (_MutexTexture) lock (_MutexTexture)
{ {
DataRectangle rect = _D3DTextures[texture.Index].LockRectangle(0, LockFlags.Discard); DataRectangle rect = _D3DTextures[texture.Index].LockRectangle(0, LockFlags.Discard);
int w = (int)texture.Width; int w = texture.Width;
for (int i = 0; i < data.Length; i += 4 * w) for (int i = 0; i < data.Length; i += 4 * w)
{ {
rect.Data.Write(data, i, 4 * w); rect.Data.Write(data, i, 4 * w);
@@ -1378,13 +1378,13 @@ namespace Vocaluxe.Lib.Draw
/// </summary> /// </summary>
/// <param name="n">The value of which the next power of two will be calculated</param> /// <param name="n">The value of which the next power of two will be calculated</param>
/// <returns>The next power of two</returns> /// <returns>The next power of two</returns>
private float _CheckForNextPowerOf2(float n) private int _CheckForNextPowerOf2(int n)
{ {
if (_NonPowerOf2TextureSupported) if (_NonPowerOf2TextureSupported)
return n; return n;
if (n < 0) if (n < 0)
throw new ArgumentOutOfRangeException("n", "Must be positive."); throw new ArgumentOutOfRangeException("n", "Must be positive.");
return (float)Math.Pow(2, Math.Ceiling(Math.Log(n, 2))); return (int)Math.Pow(2, Math.Ceiling(Math.Log(n, 2)));
} }
private SlimDX.Matrix _CalculateRotationMatrix(float rot, float rx1, float rx2, float ry1, float ry2) private SlimDX.Matrix _CalculateRotationMatrix(float rot, float rx1, float rx2, float ry1, float ry2)
+1 -1
View File
@@ -310,7 +310,7 @@ namespace Vocaluxe.Lib.Draw
public void CopyScreen(ref STexture texture) public void CopyScreen(ref STexture texture)
{ {
if (texture.Index == 0 || (int)texture.Width != GetScreenWidth() || (int)texture.Height != GetScreenHeight()) if (texture.Index == 0 || texture.Width != GetScreenWidth() || texture.Height != GetScreenHeight())
{ {
RemoveTexture(ref texture); RemoveTexture(ref texture);
texture = CopyScreen(); texture = CopyScreen();
+13 -13
View File
@@ -501,12 +501,12 @@ namespace Vocaluxe.Lib.Draw
texture.W2 = MathHelper.NextPowerOfTwo(texture.Width); texture.W2 = MathHelper.NextPowerOfTwo(texture.Width);
texture.H2 = MathHelper.NextPowerOfTwo(texture.Height); texture.H2 = MathHelper.NextPowerOfTwo(texture.Height);
texture.WidthRatio = texture.Width / texture.W2; texture.WidthRatio = (float)texture.Width / texture.W2;
texture.HeightRatio = texture.Height / texture.H2; texture.HeightRatio = (float)texture.Height / texture.H2;
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, (int)texture.W2, (int)texture.H2, 0, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero); GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, texture.W2, texture.H2, 0, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero);
GL.CopyTexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, _X, _Y, (int)texture.Width, (int)texture.Height); GL.CopyTexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, _X, _Y, texture.Width, texture.Height);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
@@ -537,7 +537,7 @@ namespace Vocaluxe.Lib.Draw
{ {
GL.BindTexture(TextureTarget.Texture2D, texture.ID); GL.BindTexture(TextureTarget.Texture2D, texture.ID);
GL.CopyTexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, 0, 0, (int)texture.Width, (int)texture.Height); GL.CopyTexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, 0, 0, texture.Width, texture.Height);
GL.BindTexture(TextureTarget.Texture2D, 0); GL.BindTexture(TextureTarget.Texture2D, 0);
} }
@@ -737,7 +737,7 @@ namespace Vocaluxe.Lib.Draw
texture.H2 = MathHelper.NextPowerOfTwo(h); texture.H2 = MathHelper.NextPowerOfTwo(h);
try try
{ {
using (Bitmap bmp2 = new Bitmap((int)texture.W2, (int)texture.H2)) using (Bitmap bmp2 = new Bitmap(texture.W2, texture.H2))
{ {
Graphics g = Graphics.FromImage(bmp2); Graphics g = Graphics.FromImage(bmp2);
g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.InterpolationMode = InterpolationMode.HighQualityBicubic;
@@ -750,7 +750,7 @@ namespace Vocaluxe.Lib.Draw
BitmapData bmpData = bmp2.LockBits(new Rectangle(0, 0, bmp2.Width, bmp2.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); BitmapData bmpData = bmp2.LockBits(new Rectangle(0, 0, bmp2.Width, bmp2.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, (int)texture.W2, (int)texture.H2, 0, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero); GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, texture.W2, texture.H2, 0, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero);
GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, bmpData.Width, bmpData.Height, PixelFormat.Bgra, PixelType.UnsignedByte, bmpData.Scan0); GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, bmpData.Width, bmpData.Height, PixelFormat.Bgra, PixelType.UnsignedByte, bmpData.Scan0);
@@ -759,7 +759,7 @@ namespace Vocaluxe.Lib.Draw
} }
catch catch
{ {
CLog.LogError(w + " " + h + " " + (int)texture.W2 + " " + (int)texture.H2); CLog.LogError(w + " " + h + " " + texture.W2 + " " + texture.H2);
throw; throw;
} }
@@ -828,10 +828,10 @@ namespace Vocaluxe.Lib.Draw
texture.W2 = MathHelper.NextPowerOfTwo(texture.Width); texture.W2 = MathHelper.NextPowerOfTwo(texture.Width);
texture.H2 = MathHelper.NextPowerOfTwo(texture.Height); texture.H2 = MathHelper.NextPowerOfTwo(texture.Height);
texture.WidthRatio = texture.Width / texture.W2; texture.WidthRatio = (float)texture.Width / texture.W2;
texture.HeightRatio = texture.Height / texture.H2; texture.HeightRatio = (float)texture.Height / texture.H2;
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, (int)texture.W2, (int)texture.H2, 0, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero); GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, texture.W2, texture.H2, 0, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero);
GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, w, h, PixelFormat.Bgra, PixelType.UnsignedByte, data); GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, w, h, PixelFormat.Bgra, PixelType.UnsignedByte, data);
@@ -887,7 +887,7 @@ namespace Vocaluxe.Lib.Draw
GL.UnmapBuffer(BufferTarget.PixelUnpackBuffer); GL.UnmapBuffer(BufferTarget.PixelUnpackBuffer);
GL.BindTexture(TextureTarget.Texture2D, texture.ID); GL.BindTexture(TextureTarget.Texture2D, texture.ID);
GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, (int)texture.Width, (int)texture.Height, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero); GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, texture.Width, texture.Height, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero);
GL.BindTexture(TextureTarget.Texture2D, 0); GL.BindTexture(TextureTarget.Texture2D, 0);
GL.BindBuffer(BufferTarget.PixelUnpackBuffer, 0); GL.BindBuffer(BufferTarget.PixelUnpackBuffer, 0);
@@ -897,7 +897,7 @@ namespace Vocaluxe.Lib.Draw
GL.BindTexture(TextureTarget.Texture2D, texture.ID); GL.BindTexture(TextureTarget.Texture2D, texture.ID);
GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, (int)texture.Width, (int)texture.Height, PixelFormat.Bgra, PixelType.UnsignedByte, data); GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, texture.Width, texture.Height, PixelFormat.Bgra, PixelType.UnsignedByte, data);
//GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureParameterName.ClampToEdge); //GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureParameterName.ClampToEdge);
//GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureParameterName.ClampToEdge); //GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureParameterName.ClampToEdge);
-1
View File
@@ -17,7 +17,6 @@
// */ // */
#endregion #endregion
using System;
using System.Drawing; using System.Drawing;
using VocaluxeLib.Menu; using VocaluxeLib.Menu;
+1 -1
View File
@@ -661,7 +661,7 @@ namespace Vocaluxe.Lib.Video
if (num >= 0) if (num >= 0)
{ {
if (frame.Index == -1 || _Width != (int)frame.Width || _Height != (int)frame.Height) if (frame.Index == -1 || _Width != frame.Width || _Height != frame.Height)
{ {
CDraw.RemoveTexture(ref frame); CDraw.RemoveTexture(ref frame);
frame = CDraw.AddTexture(_Width, _Height, _FrameBuffer[num].Data); frame = CDraw.AddTexture(_Width, _Height, _FrameBuffer[num].Data);
+1 -1
View File
@@ -121,7 +121,7 @@ namespace Vocaluxe.Lib.Video
{ {
if (data == null) if (data == null)
return; return;
if (frame.Index == -1 || width != (int)frame.Width || height != (int)frame.Height || data.Length == 0) if (frame.Index == -1 || width != frame.Width || height != frame.Height || data.Length == 0)
{ {
CDraw.RemoveTexture(ref frame); CDraw.RemoveTexture(ref frame);
frame = CDraw.AddTexture(width, height, data); frame = CDraw.AddTexture(width, height, data);
+1 -1
View File
@@ -56,7 +56,7 @@ namespace Vocaluxe.Lib.Webcam
{ {
lock (_MutexData) lock (_MutexData)
{ {
if (frame.Index == -1 || _Width != (int)frame.Width || _Height != (int)frame.Height) if (frame.Index == -1 || _Width != frame.Width || _Height != frame.Height)
{ {
CDraw.RemoveTexture(ref frame); CDraw.RemoveTexture(ref frame);
frame = CDraw.AddTexture(_Width, _Height, _Data); frame = CDraw.AddTexture(_Width, _Height, _Data);
+1 -1
View File
@@ -317,7 +317,7 @@ namespace Vocaluxe.Screens
base.OnShow(); base.OnShow();
//Vocaluxe-Logo //Vocaluxe-Logo
_Logo = GetNewStatic(_TexLogo, new SColorF(1, 1, 1, 1), new SRectF((CSettings.RenderW - _TexLogo.Width) / 2, -270, _TexLogo.Width, _TexLogo.Height, -2)); _Logo = GetNewStatic(_TexLogo, new SColorF(1, 1, 1, 1), new SRectF((float)(CSettings.RenderW - _TexLogo.Width) / 2, -270, _TexLogo.Width, _TexLogo.Height, -2));
//Little stars for logo //Little stars for logo
int numstars = (int)(_Logo.Rect.W * 0.25f / 2f); int numstars = (int)(_Logo.Rect.W * 0.25f / 2f);
+4 -4
View File
@@ -58,7 +58,7 @@ namespace Vocaluxe.Screens
private bool _SelectingKeyboardActive; private bool _SelectingKeyboardActive;
private bool _SelectingFast; private bool _SelectingFast;
private int _SelectingSwitchNr = -1; private int _SelectingSwitchNr = -1;
private int _SelectingFastPlayerNr = 0; private int _SelectingFastPlayerNr;
private int _SelectedPlayerNr = -1; private int _SelectedPlayerNr = -1;
public override void Init() public override void Init()
@@ -430,7 +430,7 @@ namespace Vocaluxe.Screens
CConfig.Players[_SelectingSwitchNr] = string.Empty; CConfig.Players[_SelectingSwitchNr] = string.Empty;
//Update texture and name //Update texture and name
_Statics[_StaticPlayerAvatar[_SelectingSwitchNr]].Texture = _OriginalPlayerAvatarTextures[_SelectingSwitchNr]; _Statics[_StaticPlayerAvatar[_SelectingSwitchNr]].Texture = _OriginalPlayerAvatarTextures[_SelectingSwitchNr];
_Texts[_TextPlayer[_SelectingSwitchNr]].Text = CProfiles.GetPlayerName(-1, (_SelectingSwitchNr+1)); _Texts[_TextPlayer[_SelectingSwitchNr]].Text = CProfiles.GetPlayerName(-1, (_SelectingSwitchNr + 1));
} }
//Update Game-infos with new player //Update Game-infos with new player
CGame.Players[i].ProfileID = _SelectedPlayerNr; CGame.Players[i].ProfileID = _SelectedPlayerNr;
@@ -447,7 +447,7 @@ namespace Vocaluxe.Screens
break; break;
} }
//Selected player is dropped out of area //Selected player is dropped out of area
else if (_SelectingSwitchNr > -1) if (_SelectingSwitchNr > -1)
{ {
//Update Game-infos with new player //Update Game-infos with new player
CGame.Players[_SelectingSwitchNr].ProfileID = -1; CGame.Players[_SelectingSwitchNr].ProfileID = -1;
@@ -569,7 +569,7 @@ namespace Vocaluxe.Screens
else else
stopSelectingFast = true; stopSelectingFast = true;
} }
else if(mouseEvent.MB) else if (mouseEvent.MB)
{ {
_ResetPlayerSelections(); _ResetPlayerSelections();
_SelectingFast = true; _SelectingFast = true;
+1 -1
View File
@@ -469,7 +469,7 @@ namespace Vocaluxe.Screens
background = _Background; background = _Background;
RectangleF bounds = new RectangleF(0, 0, CSettings.RenderW, CSettings.RenderH); RectangleF bounds = new RectangleF(0, 0, CSettings.RenderW, CSettings.RenderH);
RectangleF rect; RectangleF rect;
CHelper.SetRect(bounds, out rect, background.Width / background.Height, aspect); CHelper.SetRect(bounds, out rect, (float)background.Width / background.Height, aspect);
CDraw.DrawTexture(_Background, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, 0f), CDraw.DrawTexture(_Background, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, 0f),
_Background.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f)); _Background.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f));
+6 -6
View File
@@ -41,17 +41,17 @@ namespace Vocaluxe.Screens
base.Init(); base.Init();
const string test = "Ö ÄÜabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPGRSTUVWGXZ1234567890"; const string test = "Ö ÄÜabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPGRSTUVWGXZ1234567890";
SColorF color = new SColorF(1, 0, 0, 1); SColorF color = new SColorF(1, 0, 0, 1);
CText text = new CText(10, 50, 1, 32, 0, EAlignment.Left, EStyle.Normal, "Normal", color, "jÄNormal Text" + test, -1, 26, 0); CText text = new CText(10, 50, 1, 32, 0, EAlignment.Left, EStyle.Normal, "Normal", color, "jÄNormal Text" + test, -1, 26, 1);
_AddText(text); _AddText(text);
text = new CText(10, 90, 1, 32, 0, EAlignment.Left, EStyle.Bold, "Normal", color, "jÄBold Text" + test, -1, 26, 0); text = new CText(10, 90, 1, 32, 0, EAlignment.Left, EStyle.Bold, "Normal", color, "jÄBold Text" + test, -1, 26, 1);
_AddText(text); _AddText(text);
text = new CText(10, 130, 1, 32, 0, EAlignment.Left, EStyle.Italic, "Normal", color, "jÄItalic Text" + test, -1, 26, 0); text = new CText(10, 130, 1, 32, 0, EAlignment.Left, EStyle.Italic, "Normal", color, "jÄItalic Text" + test, -1, 26, 1);
_AddText(text); _AddText(text);
text = new CText(10, 170, 1, 32, 0, EAlignment.Left, EStyle.Normal, "Outline", color, "jÄNormal Text" + test, -1, 50, 0); text = new CText(10, 170, 1, 32, 0, EAlignment.Left, EStyle.Normal, "Outline", color, "jÄNormal Text" + test, -1, 50, 1);
_AddText(text); _AddText(text);
text = new CText(10, 210, 1, 32, 0, EAlignment.Left, EStyle.Bold, "Outline", color, "jÄBold Text" + test, -1, 100, 0); text = new CText(10, 210, 1, 32, 0, EAlignment.Left, EStyle.Bold, "Outline", color, "jÄBold Text" + test, -1, 100, 1);
_AddText(text); _AddText(text);
text = new CText(10, 250, 1, 32, 0, EAlignment.Left, EStyle.Italic, "Outline", color, "jÄItalic Text" + test, -1, 150, 0); text = new CText(10, 250, 1, 32, 0, EAlignment.Left, EStyle.Italic, "Outline", color, "jÄItalic Text" + test, -1, 150, 1);
_AddText(text); _AddText(text);
} }
+3 -3
View File
@@ -207,7 +207,7 @@ namespace VocaluxeLib.Menu
{ {
RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH()); RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
RectangleF rect; RectangleF rect;
CHelper.SetRect(bounds, out rect, texture.Width / texture.Height, EAspect.Crop); CHelper.SetRect(bounds, out rect, (float)texture.Width / texture.Height, EAspect.Crop);
CBase.Drawing.DrawTexture(texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4)); CBase.Drawing.DrawTexture(texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
return true; return true;
@@ -222,7 +222,7 @@ namespace VocaluxeLib.Menu
{ {
RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH()); RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
RectangleF rect; RectangleF rect;
CHelper.SetRect(bounds, out rect, videoTexture.Width / videoTexture.Height, EAspect.Crop); CHelper.SetRect(bounds, out rect, (float)videoTexture.Width / videoTexture.Height, EAspect.Crop);
CBase.Drawing.DrawTexture(videoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4)); CBase.Drawing.DrawTexture(videoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
return true; return true;
@@ -237,7 +237,7 @@ namespace VocaluxeLib.Menu
{ {
RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH()); RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH());
RectangleF rect; RectangleF rect;
CHelper.SetRect(bounds, out rect, videoTexture.Width / videoTexture.Height, EAspect.Crop); CHelper.SetRect(bounds, out rect, (float)videoTexture.Width / videoTexture.Height, EAspect.Crop);
CBase.Drawing.DrawTexture(videoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4)); CBase.Drawing.DrawTexture(videoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4));
return true; return true;
+1 -1
View File
@@ -348,7 +348,7 @@ namespace VocaluxeLib.Menu
public void HandleMouse(SMouseEvent mevent) public void HandleMouse(SMouseEvent mevent)
{ {
for (int i = 0; i < _Tiles.Count; i++ ) for (int i = 0; i < _Tiles.Count; i++)
{ {
if (CHelper.IsInBounds(_Tiles[i].Avatar.Rect, mevent)) if (CHelper.IsInBounds(_Tiles[i].Avatar.Rect, mevent))
{ {
+1 -1
View File
@@ -253,7 +253,7 @@ namespace VocaluxeLib.Menu
{ {
RectangleF bounds2 = new RectangleF(bounds.X, bounds.Y, bounds.W, bounds.H); RectangleF bounds2 = new RectangleF(bounds.X, bounds.Y, bounds.W, bounds.H);
RectangleF rect2; RectangleF rect2;
CHelper.SetRect(bounds2, out rect2, texture.Width / texture.Height, aspect); CHelper.SetRect(bounds2, out rect2, (float)texture.Width / texture.Height, aspect);
rect.X = rect2.X; rect.X = rect2.X;
rect.Y = rect2.Y; rect.Y = rect2.Y;
+3 -3
View File
@@ -169,7 +169,7 @@ namespace VocaluxeLib.Menu
} }
/// <summary> /// <summary>
/// Do NOT read/write this anywhere but in _UpdateTextPosition! /// Do NOT read/write this anywhere but in _UpdateTextPosition!
/// </summary> /// </summary>
private SRectF _Rect; private SRectF _Rect;
public SRectF Rect public SRectF Rect
@@ -499,8 +499,8 @@ namespace VocaluxeLib.Menu
public void DrawRelative(float rx, float ry, float reflectionHeight = 0f, float reflectionSpace = 0f, float rectHeight = 0f) public void DrawRelative(float rx, float ry, float reflectionHeight = 0f, float reflectionSpace = 0f, float rectHeight = 0f)
{ {
var oldReflectionSpace = ReflectionSpace; float oldReflectionSpace = ReflectionSpace;
var oldReflectionHeight = ReflectionHeight; float oldReflectionHeight = ReflectionHeight;
if (reflectionHeight > 0) if (reflectionHeight > 0)
{ {
ReflectionSpace = (rectHeight - Rect.Y - Rect.H) * 2 + reflectionSpace; ReflectionSpace = (rectHeight - Rect.Y - Rect.H) * 2 + reflectionSpace;
@@ -459,7 +459,7 @@ namespace VocaluxeLib.Menu.SongMenu
_CoverBig.Draw(1f, EAspect.Crop); _CoverBig.Draw(1f, EAspect.Crop);
RectangleF bounds = new RectangleF(_CoverBig.Rect.X, _CoverBig.Rect.Y, _CoverBig.Rect.W, _CoverBig.Rect.H); RectangleF bounds = new RectangleF(_CoverBig.Rect.X, _CoverBig.Rect.Y, _CoverBig.Rect.W, _CoverBig.Rect.H);
RectangleF rect; RectangleF rect;
CHelper.SetRect(bounds, out rect, _Vidtex.Width / _Vidtex.Height, EAspect.Crop); CHelper.SetRect(bounds, out rect, (float)_Vidtex.Width / _Vidtex.Height, EAspect.Crop);
SRectF vidRect = new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z); SRectF vidRect = new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z);
SRectF vidRectBounds = new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f); SRectF vidRectBounds = new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f);
+8 -8
View File
@@ -108,12 +108,12 @@ namespace VocaluxeLib.Menu
public string TexturePath; public string TexturePath;
public float Width; public int Width;
public float Height; public int Height;
public SRectF Rect; public SRectF Rect;
public float W2; //power of 2 width public int W2; //power of 2 width
public float H2; //power of 2 height public int H2; //power of 2 height
public float WidthRatio; public float WidthRatio;
public float HeightRatio; public float HeightRatio;
@@ -126,12 +126,12 @@ namespace VocaluxeLib.Menu
ID = -1; ID = -1;
TexturePath = String.Empty; TexturePath = String.Empty;
Width = 1f; Width = 1;
Height = 1f; Height = 1;
Rect = new SRectF(0f, 0f, 1f, 1f, 0f); Rect = new SRectF(0f, 0f, 1f, 1f, 0f);
W2 = 2f; W2 = 1;
H2 = 2f; H2 = 1;
WidthRatio = 0.5f; WidthRatio = 0.5f;
HeightRatio = 0.5f; HeightRatio = 0.5f;