From 151fab8857b5e290f96b0f63b63296bd6a80c064 Mon Sep 17 00:00:00 2001 From: Flamefire Date: Fri, 3 May 2013 20:07:53 +0200 Subject: [PATCH] Changed texture sizes to more reasonable int --- .../CChallengeRounds.cs | 2 +- Vocaluxe/Base/CDraw.cs | 2 +- Vocaluxe/Base/CVideo.cs | 4 +-- Vocaluxe/Base/Fonts/CFonts.cs | 6 ++--- Vocaluxe/Base/Fonts/CGlyph.cs | 2 ++ Vocaluxe/Lib/Draw/CDirect3D.cs | 24 ++++++++--------- Vocaluxe/Lib/Draw/CDrawWinForm.cs | 2 +- Vocaluxe/Lib/Draw/COpenGL.cs | 26 +++++++++---------- Vocaluxe/Lib/Draw/IDraw.cs | 1 - Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs | 2 +- Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs | 2 +- Vocaluxe/Lib/Webcam/CAForgeNet.cs | 2 +- Vocaluxe/Screens/CScreenCredits.cs | 2 +- Vocaluxe/Screens/CScreenNames.cs | 8 +++--- Vocaluxe/Screens/CScreenSing.cs | 2 +- Vocaluxe/Screens/CScreenTest.cs | 12 ++++----- VocaluxeLib/Menu/CBackground.cs | 6 ++--- VocaluxeLib/Menu/CNameSelection.cs | 2 +- VocaluxeLib/Menu/CStatic.cs | 2 +- VocaluxeLib/Menu/CText.cs | 6 ++--- .../Menu/SongMenu/CSongMenuTileBoard.cs | 2 +- VocaluxeLib/Menu/Structs.cs | 16 ++++++------ 22 files changed, 67 insertions(+), 66 deletions(-) diff --git a/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs b/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs index 4114320b..d2345005 100644 --- a/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs +++ b/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs @@ -146,7 +146,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _Rand = rand; } - public CCombination GetNextCombination(List playerNrDemand) + public CCombination GetNextCombination(IEnumerable playerNrDemand) { if (_Combs.Count == 0) _Create(); diff --git a/Vocaluxe/Base/CDraw.cs b/Vocaluxe/Base/CDraw.cs index e7f48201..d2b9b74d 100644 --- a/Vocaluxe/Base/CDraw.cs +++ b/Vocaluxe/Base/CDraw.cs @@ -202,7 +202,7 @@ namespace Vocaluxe.Base RectangleF bounds = new RectangleF(staticBounds.Rect.X, staticBounds.Rect.Y, staticBounds.Rect.W, staticBounds.Rect.H); 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), texture.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f)); } diff --git a/Vocaluxe/Base/CVideo.cs b/Vocaluxe/Base/CVideo.cs index b78ef2c9..a8926164 100644 --- a/Vocaluxe/Base/CVideo.cs +++ b/Vocaluxe/Base/CVideo.cs @@ -171,7 +171,7 @@ namespace Vocaluxe.Base float videoTime = _VideoTimer.ElapsedMilliseconds / 1000f; _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); if (tex.Height > 0) @@ -182,7 +182,7 @@ namespace Vocaluxe.Base } RectangleF bounds = new RectangleF(0f, 0f, CSettings.RenderW, CSettings.RenderH); 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)); } diff --git a/Vocaluxe/Base/Fonts/CFonts.cs b/Vocaluxe/Base/Fonts/CFonts.cs index 0db4b25d..e0e50e84 100644 --- a/Vocaluxe/Base/Fonts/CFonts.cs +++ b/Vocaluxe/Base/Fonts/CFonts.cs @@ -70,7 +70,7 @@ namespace Vocaluxe.Base.Fonts private static void _BuildFonts() { - foreach (var font in _Fonts) + foreach (SFont font in _Fonts) { font.Normal.Dispose(); font.Bold.Dispose(); @@ -257,8 +257,8 @@ namespace Vocaluxe.Base.Fonts Height = height; SetFont(text.Font); Style = text.Style; - var result = new RectangleF(text.X, text.Y, GetTextWidth(CLanguage.Translate(text.Text, text.TranslationID)), - GetTextHeight(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))); //restore old values Height = oldHeight; _CurrentFont = oldFont; diff --git a/Vocaluxe/Base/Fonts/CGlyph.cs b/Vocaluxe/Base/Fonts/CGlyph.cs index 453301ad..af06252b 100644 --- a/Vocaluxe/Base/Fonts/CGlyph.cs +++ b/Vocaluxe/Base/Fonts/CGlyph.cs @@ -121,6 +121,7 @@ namespace Vocaluxe.Base.Fonts _DrawBounding.Width = _Texture.Width; _DrawBounding.Height = _Texture.Height;*/ #pragma warning disable 162 + // ReSharper disable HeuristicUnreachableCode if (false) { if (outline > 0) @@ -128,6 +129,7 @@ namespace Vocaluxe.Base.Fonts else bmpCropped.Save("font/" + chr + CFonts.Style + "2.png", ImageFormat.Png); } + // ReSharper restore HeuristicUnreachableCode #pragma warning restore 162 } } diff --git a/Vocaluxe/Lib/Draw/CDirect3D.cs b/Vocaluxe/Lib/Draw/CDirect3D.cs index 5d1bb3e0..7aff044b 100644 --- a/Vocaluxe/Lib/Draw/CDirect3D.cs +++ b/Vocaluxe/Lib/Draw/CDirect3D.cs @@ -708,7 +708,7 @@ namespace Vocaluxe.Lib.Draw /// The texture in which the frame is copied to 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); texture = CopyScreen(); @@ -758,8 +758,8 @@ namespace Vocaluxe.Lib.Draw /// The end y-value 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)}; - using (var line = new Line(_Device)) + Vector2[] lineVector = new Vector2[] {new Vector2(x1, y1), new Vector2(x2, y2)}; + using (Line line = new Line(_Device)) { line.Antialias = true; line.Begin(); @@ -872,9 +872,9 @@ namespace Vocaluxe.Lib.Draw else if (h > maxSize) newH = maxSize; else if (w > h) - newW = (int)_CheckForNextPowerOf2(w); + newW = _CheckForNextPowerOf2(w); else - newH = (int)_CheckForNextPowerOf2(h); + newH = _CheckForNextPowerOf2(h); Bitmap bmp2 = null; byte[] data; @@ -943,18 +943,18 @@ namespace Vocaluxe.Lib.Draw texture.Height = h; texture.W2 = _CheckForNextPowerOf2(w); texture.H2 = _CheckForNextPowerOf2(h); - texture.WidthRatio = w / texture.W2; - texture.HeightRatio = h / texture.H2; + texture.WidthRatio = (float)w / texture.W2; + 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 //because a copy of the texture is hold in the Ram Texture t = null; 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 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) { rect.Data.Write(data, i, rowWidth); @@ -1010,7 +1010,7 @@ namespace Vocaluxe.Lib.Draw lock (_MutexTexture) { 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) { rect.Data.Write(data, i, 4 * w); @@ -1378,13 +1378,13 @@ namespace Vocaluxe.Lib.Draw /// /// The value of which the next power of two will be calculated /// The next power of two - private float _CheckForNextPowerOf2(float n) + private int _CheckForNextPowerOf2(int n) { if (_NonPowerOf2TextureSupported) return n; if (n < 0) 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) diff --git a/Vocaluxe/Lib/Draw/CDrawWinForm.cs b/Vocaluxe/Lib/Draw/CDrawWinForm.cs index 58617230..1a8a5f80 100644 --- a/Vocaluxe/Lib/Draw/CDrawWinForm.cs +++ b/Vocaluxe/Lib/Draw/CDrawWinForm.cs @@ -310,7 +310,7 @@ namespace Vocaluxe.Lib.Draw 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); texture = CopyScreen(); diff --git a/Vocaluxe/Lib/Draw/COpenGL.cs b/Vocaluxe/Lib/Draw/COpenGL.cs index 83ce5c70..653dc770 100644 --- a/Vocaluxe/Lib/Draw/COpenGL.cs +++ b/Vocaluxe/Lib/Draw/COpenGL.cs @@ -501,12 +501,12 @@ namespace Vocaluxe.Lib.Draw texture.W2 = MathHelper.NextPowerOfTwo(texture.Width); texture.H2 = MathHelper.NextPowerOfTwo(texture.Height); - texture.WidthRatio = texture.Width / texture.W2; - texture.HeightRatio = texture.Height / texture.H2; + texture.WidthRatio = (float)texture.Width / texture.W2; + 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.TextureMinFilter, (int)TextureMinFilter.Linear); @@ -537,7 +537,7 @@ namespace Vocaluxe.Lib.Draw { 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); } @@ -737,7 +737,7 @@ namespace Vocaluxe.Lib.Draw texture.H2 = MathHelper.NextPowerOfTwo(h); 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); 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); - 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); @@ -759,7 +759,7 @@ namespace Vocaluxe.Lib.Draw } catch { - CLog.LogError(w + " " + h + " " + (int)texture.W2 + " " + (int)texture.H2); + CLog.LogError(w + " " + h + " " + texture.W2 + " " + texture.H2); throw; } @@ -828,10 +828,10 @@ namespace Vocaluxe.Lib.Draw texture.W2 = MathHelper.NextPowerOfTwo(texture.Width); texture.H2 = MathHelper.NextPowerOfTwo(texture.Height); - texture.WidthRatio = texture.Width / texture.W2; - texture.HeightRatio = texture.Height / texture.H2; + texture.WidthRatio = (float)texture.Width / texture.W2; + 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); @@ -887,7 +887,7 @@ namespace Vocaluxe.Lib.Draw GL.UnmapBuffer(BufferTarget.PixelUnpackBuffer); 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.BindBuffer(BufferTarget.PixelUnpackBuffer, 0); @@ -897,7 +897,7 @@ namespace Vocaluxe.Lib.Draw 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.TextureWrapT, (int)TextureParameterName.ClampToEdge); diff --git a/Vocaluxe/Lib/Draw/IDraw.cs b/Vocaluxe/Lib/Draw/IDraw.cs index 3a48be4c..77a605aa 100644 --- a/Vocaluxe/Lib/Draw/IDraw.cs +++ b/Vocaluxe/Lib/Draw/IDraw.cs @@ -17,7 +17,6 @@ // */ #endregion -using System; using System.Drawing; using VocaluxeLib.Menu; diff --git a/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs b/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs index e9dcd175..7beeb29c 100644 --- a/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs +++ b/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs @@ -661,7 +661,7 @@ namespace Vocaluxe.Lib.Video 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); frame = CDraw.AddTexture(_Width, _Height, _FrameBuffer[num].Data); diff --git a/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs b/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs index c5449dbc..5bfcf8a5 100644 --- a/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs +++ b/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs @@ -121,7 +121,7 @@ namespace Vocaluxe.Lib.Video { if (data == null) 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); frame = CDraw.AddTexture(width, height, data); diff --git a/Vocaluxe/Lib/Webcam/CAForgeNet.cs b/Vocaluxe/Lib/Webcam/CAForgeNet.cs index 99c1f820..14ef1782 100644 --- a/Vocaluxe/Lib/Webcam/CAForgeNet.cs +++ b/Vocaluxe/Lib/Webcam/CAForgeNet.cs @@ -56,7 +56,7 @@ namespace Vocaluxe.Lib.Webcam { 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); frame = CDraw.AddTexture(_Width, _Height, _Data); diff --git a/Vocaluxe/Screens/CScreenCredits.cs b/Vocaluxe/Screens/CScreenCredits.cs index 495bc9c6..3f2367bd 100644 --- a/Vocaluxe/Screens/CScreenCredits.cs +++ b/Vocaluxe/Screens/CScreenCredits.cs @@ -317,7 +317,7 @@ namespace Vocaluxe.Screens base.OnShow(); //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 int numstars = (int)(_Logo.Rect.W * 0.25f / 2f); diff --git a/Vocaluxe/Screens/CScreenNames.cs b/Vocaluxe/Screens/CScreenNames.cs index 99006246..c1e332c4 100644 --- a/Vocaluxe/Screens/CScreenNames.cs +++ b/Vocaluxe/Screens/CScreenNames.cs @@ -58,7 +58,7 @@ namespace Vocaluxe.Screens private bool _SelectingKeyboardActive; private bool _SelectingFast; private int _SelectingSwitchNr = -1; - private int _SelectingFastPlayerNr = 0; + private int _SelectingFastPlayerNr; private int _SelectedPlayerNr = -1; public override void Init() @@ -430,7 +430,7 @@ namespace Vocaluxe.Screens CConfig.Players[_SelectingSwitchNr] = string.Empty; //Update texture and name _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 CGame.Players[i].ProfileID = _SelectedPlayerNr; @@ -447,7 +447,7 @@ namespace Vocaluxe.Screens break; } //Selected player is dropped out of area - else if (_SelectingSwitchNr > -1) + if (_SelectingSwitchNr > -1) { //Update Game-infos with new player CGame.Players[_SelectingSwitchNr].ProfileID = -1; @@ -569,7 +569,7 @@ namespace Vocaluxe.Screens else stopSelectingFast = true; } - else if(mouseEvent.MB) + else if (mouseEvent.MB) { _ResetPlayerSelections(); _SelectingFast = true; diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index 04f7e174..c6dbd9d4 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -469,7 +469,7 @@ namespace Vocaluxe.Screens background = _Background; RectangleF bounds = new RectangleF(0, 0, CSettings.RenderW, CSettings.RenderH); 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), _Background.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f)); diff --git a/Vocaluxe/Screens/CScreenTest.cs b/Vocaluxe/Screens/CScreenTest.cs index 7783f39b..b4362f55 100644 --- a/Vocaluxe/Screens/CScreenTest.cs +++ b/Vocaluxe/Screens/CScreenTest.cs @@ -41,17 +41,17 @@ namespace Vocaluxe.Screens base.Init(); const string test = "Ö ÄÜabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPGRSTUVWGXZ1234567890"; 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); - 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); - 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); - 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); - 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); - 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); } diff --git a/VocaluxeLib/Menu/CBackground.cs b/VocaluxeLib/Menu/CBackground.cs index 3dafcbb5..c63aeb24 100644 --- a/VocaluxeLib/Menu/CBackground.cs +++ b/VocaluxeLib/Menu/CBackground.cs @@ -207,7 +207,7 @@ namespace VocaluxeLib.Menu { RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH()); 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)); return true; @@ -222,7 +222,7 @@ namespace VocaluxeLib.Menu { RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH()); 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)); return true; @@ -237,7 +237,7 @@ namespace VocaluxeLib.Menu { RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH()); 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)); return true; diff --git a/VocaluxeLib/Menu/CNameSelection.cs b/VocaluxeLib/Menu/CNameSelection.cs index 2888d8ea..39fba2b4 100644 --- a/VocaluxeLib/Menu/CNameSelection.cs +++ b/VocaluxeLib/Menu/CNameSelection.cs @@ -348,7 +348,7 @@ namespace VocaluxeLib.Menu 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)) { diff --git a/VocaluxeLib/Menu/CStatic.cs b/VocaluxeLib/Menu/CStatic.cs index 8dfa8d07..d5a1f6f3 100644 --- a/VocaluxeLib/Menu/CStatic.cs +++ b/VocaluxeLib/Menu/CStatic.cs @@ -253,7 +253,7 @@ namespace VocaluxeLib.Menu { RectangleF bounds2 = new RectangleF(bounds.X, bounds.Y, bounds.W, bounds.H); 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.Y = rect2.Y; diff --git a/VocaluxeLib/Menu/CText.cs b/VocaluxeLib/Menu/CText.cs index 978eaf6f..6fc4e09f 100644 --- a/VocaluxeLib/Menu/CText.cs +++ b/VocaluxeLib/Menu/CText.cs @@ -169,7 +169,7 @@ namespace VocaluxeLib.Menu } /// - /// Do NOT read/write this anywhere but in _UpdateTextPosition! + /// Do NOT read/write this anywhere but in _UpdateTextPosition! /// private 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) { - var oldReflectionSpace = ReflectionSpace; - var oldReflectionHeight = ReflectionHeight; + float oldReflectionSpace = ReflectionSpace; + float oldReflectionHeight = ReflectionHeight; if (reflectionHeight > 0) { ReflectionSpace = (rectHeight - Rect.Y - Rect.H) * 2 + reflectionSpace; diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs index 5d437d1d..b5a65b20 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs @@ -459,7 +459,7 @@ namespace VocaluxeLib.Menu.SongMenu _CoverBig.Draw(1f, EAspect.Crop); RectangleF bounds = new RectangleF(_CoverBig.Rect.X, _CoverBig.Rect.Y, _CoverBig.Rect.W, _CoverBig.Rect.H); 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 vidRectBounds = new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f); diff --git a/VocaluxeLib/Menu/Structs.cs b/VocaluxeLib/Menu/Structs.cs index 062379fe..59ce099c 100644 --- a/VocaluxeLib/Menu/Structs.cs +++ b/VocaluxeLib/Menu/Structs.cs @@ -108,12 +108,12 @@ namespace VocaluxeLib.Menu public string TexturePath; - public float Width; - public float Height; + public int Width; + public int Height; public SRectF Rect; - public float W2; //power of 2 width - public float H2; //power of 2 height + public int W2; //power of 2 width + public int H2; //power of 2 height public float WidthRatio; public float HeightRatio; @@ -126,12 +126,12 @@ namespace VocaluxeLib.Menu ID = -1; TexturePath = String.Empty; - Width = 1f; - Height = 1f; + Width = 1; + Height = 1; Rect = new SRectF(0f, 0f, 1f, 1f, 0f); - W2 = 2f; - H2 = 2f; + W2 = 1; + H2 = 1; WidthRatio = 0.5f; HeightRatio = 0.5f;