diff --git a/Vocaluxe/Base/CDraw.cs b/Vocaluxe/Base/CDraw.cs index 0bed36e9..fa4683cf 100644 --- a/Vocaluxe/Base/CDraw.cs +++ b/Vocaluxe/Base/CDraw.cs @@ -103,16 +103,6 @@ namespace Vocaluxe.Base return _Draw.GetScreenHeight(); } - public static RectangleF GetTextBounds(CText text) - { - return _Draw.GetTextBounds(text); - } - - public static RectangleF GetTextBounds(CText text, float height) - { - return _Draw.GetTextBounds(text, height); - } - public static void DrawLine(int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2) { _Draw.DrawLine(a, r, g, b, w, x1, y1, x2, y2); @@ -159,12 +149,6 @@ namespace Vocaluxe.Base _Draw.MakeScreenShot(); } - // Draw Basic Text (must be deleted later) - public static void DrawText(string text, int x, int y, int h) - { - _Draw.DrawText(text, x, y, h); - } - public static STexture AddTexture(Bitmap bitmap) { return _Draw.AddTexture(bitmap); diff --git a/Vocaluxe/Base/CMain.cs b/Vocaluxe/Base/CMain.cs index a2f834f7..b6b6ce48 100644 --- a/Vocaluxe/Base/CMain.cs +++ b/Vocaluxe/Base/CMain.cs @@ -340,11 +340,6 @@ namespace Vocaluxe.Base class CBdraw : IDrawing { - public RectangleF GetTextBounds(CText text) - { - return CDraw.GetTextBounds(text); - } - public void DrawTexture(STexture texture, SRectF rect) { CDraw.DrawTexture(texture, rect); @@ -429,6 +424,11 @@ namespace Vocaluxe.Base CFonts.Style = fontStyle; } + public RectangleF GetTextBounds(CText text) + { + return CFonts.GetTextBounds(text); + } + public RectangleF GetTextBounds(CText text, float textHeight) { return CFonts.GetTextBounds(text, textHeight); diff --git a/Vocaluxe/Lib/Draw/CDirect3D.cs b/Vocaluxe/Lib/Draw/CDirect3D.cs index 48ca7a32..81010284 100644 --- a/Vocaluxe/Lib/Draw/CDirect3D.cs +++ b/Vocaluxe/Lib/Draw/CDirect3D.cs @@ -31,7 +31,6 @@ using System.Runtime.InteropServices; using System.Windows.Forms; using SlimDX.Windows; using Vocaluxe.Base; -using Vocaluxe.Base.Fonts; using VocaluxeLib.Menu; namespace Vocaluxe.Lib.Draw @@ -620,30 +619,6 @@ namespace Vocaluxe.Lib.Draw return _Device.Viewport.Height; } - /// - /// Calculates the bounds for a CText object - /// - /// The CText object of which the bounds should be calculated for - /// RectangleF object containing the bounds - public RectangleF GetTextBounds(CText text) - { - return GetTextBounds(text, text.Height); - } - - /// - /// Calculates the bounds for a CText object - /// - /// The CText object of which the bounds should be calculated for - /// The height of the CText object - /// RectangleF object containing the bounds - public RectangleF GetTextBounds(CText text, float height) - { - CFonts.Height = height; - CFonts.SetFont(text.Font); - CFonts.Style = text.Style; - return new RectangleF(text.X, text.Y, CFonts.GetTextWidth(CLanguage.Translate(text.Text)), CFonts.GetTextHeight(CLanguage.Translate(text.Text))); - } - /// /// Adds a quad a list which will be added and rendered to the vertexbuffer when calling RenderToVertexBuffer to reduce vertexbuffer calls each frame to a minimum /// @@ -795,19 +770,6 @@ namespace Vocaluxe.Lib.Draw DrawTexture(_BlankTexture, new SRectF(x1, y1, x2, y2, 1), color); } - /// - /// Draws a text string - /// - /// The text to be drawn - /// The text's x-position - /// The text's y-position - /// The text's height - /// The text's z-position - public void DrawText(string text, int x, int y, int h, int z = 0) - { - CFonts.DrawText(text, h, x, y, z, new SColorF(1f, 1f, 1f, 1f)); - } - /// /// Draws a colored rectangle /// diff --git a/Vocaluxe/Lib/Draw/CDrawWinForm.cs b/Vocaluxe/Lib/Draw/CDrawWinForm.cs index 08a4eeb0..422da25b 100644 --- a/Vocaluxe/Lib/Draw/CDrawWinForm.cs +++ b/Vocaluxe/Lib/Draw/CDrawWinForm.cs @@ -27,7 +27,6 @@ using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; using Vocaluxe.Base; -using Vocaluxe.Base.Fonts; using VocaluxeLib.Menu; namespace Vocaluxe.Lib.Draw @@ -286,19 +285,6 @@ namespace Vocaluxe.Lib.Draw return ClientSize.Height; } - public RectangleF GetTextBounds(CText text) - { - return GetTextBounds(text, text.Height); - } - - public RectangleF GetTextBounds(CText text, float height) - { - CFonts.Height = height; - CFonts.SetFont(text.Font); - CFonts.Style = text.Style; - return new RectangleF(text.X, text.Y, CFonts.GetTextWidth(CLanguage.Translate(text.Text)), CFonts.GetTextHeight(CLanguage.Translate(text.Text))); - } - public void ClearScreen() { _G.Clear(_ClearColor); @@ -351,12 +337,6 @@ namespace Vocaluxe.Lib.Draw _G.DrawLine(new Pen(Color.FromArgb(a, r, g, b), w), new Point(x1, y1), new Point(x2, y2)); } - // Draw Basic Text - public void DrawText(string text, int x, int y, int h, int z = 0) - { - CFonts.DrawText(text, h, x, y, z, new SColorF(1, 1, 1, 1)); - } - public void DrawColor(SColorF color, SRectF rect) {} public void DrawColorReflection(SColorF color, SRectF rect, float space, float height) {} @@ -491,7 +471,7 @@ namespace Vocaluxe.Lib.Draw { if ((texture.Index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > texture.Index)) { - Bitmap coloredBitmap = ColorizeBitmap(_Bitmaps[texture.Index], color); + Bitmap coloredBitmap = _ColorizeBitmap(_Bitmaps[texture.Index], color); _G.DrawImage(coloredBitmap, new RectangleF(rect.X, rect.Y, rect.W, rect.H)); coloredBitmap.Dispose(); } @@ -506,7 +486,7 @@ namespace Vocaluxe.Lib.Draw return _Textures.Count; } - public static Bitmap ColorizeBitmap(Bitmap original, SColorF color) + private static Bitmap _ColorizeBitmap(Bitmap original, SColorF color) { Bitmap newBitmap = new Bitmap(original.Width, original.Height); diff --git a/Vocaluxe/Lib/Draw/COpenGL.cs b/Vocaluxe/Lib/Draw/COpenGL.cs index 18795432..064e8862 100644 --- a/Vocaluxe/Lib/Draw/COpenGL.cs +++ b/Vocaluxe/Lib/Draw/COpenGL.cs @@ -188,6 +188,7 @@ namespace Vocaluxe.Lib.Draw return samples / 2; } + /* private int _CheckColorDepth(int setValue) { int result = 16; @@ -213,6 +214,7 @@ namespace Vocaluxe.Lib.Draw return result - 8; } +*/ private void _ToggleFullScreen() { @@ -481,19 +483,6 @@ namespace Vocaluxe.Lib.Draw { return _Control.Height; } - - public RectangleF GetTextBounds(CText text) - { - return GetTextBounds(text, text.Height); - } - - public RectangleF GetTextBounds(CText text, float height) - { - CFonts.Height = height; - CFonts.SetFont(text.Font); - CFonts.Style = text.Style; - return new RectangleF(text.X, text.Y, CFonts.GetTextWidth(CLanguage.Translate(text.Text)), CFonts.GetTextHeight(CLanguage.Translate(text.Text))); - } #endregion main stuff #region Basic Draw Methods @@ -583,12 +572,6 @@ namespace Vocaluxe.Lib.Draw public void DrawLine(int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2) {} - // Draw Basic Text (must be deleted later) - public void DrawText(string text, int x, int y, int h, int z = 0) - { - CFonts.DrawText(text, h, x, y, z, new SColorF(1, 1, 1, 1)); - } - public void DrawColor(SColorF color, SRectF rect) { GL.Enable(EnableCap.Blend); diff --git a/Vocaluxe/Lib/Draw/IDraw.cs b/Vocaluxe/Lib/Draw/IDraw.cs index 1230145c..a2b562fe 100644 --- a/Vocaluxe/Lib/Draw/IDraw.cs +++ b/Vocaluxe/Lib/Draw/IDraw.cs @@ -32,9 +32,6 @@ namespace Vocaluxe.Lib.Draw int GetScreenWidth(); int GetScreenHeight(); - RectangleF GetTextBounds(CText text); - RectangleF GetTextBounds(CText text, float height); - // 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); @@ -45,9 +42,6 @@ namespace Vocaluxe.Lib.Draw void CopyScreen(ref STexture texture); void MakeScreenShot(); - // Draw Basic Text (must be deleted later) - void DrawText(string text, int x, int y, int h, int z = 0); - STexture AddTexture(string texturePath); STexture AddTexture(Bitmap bitmap); STexture AddTexture(int w, int h, IntPtr data); diff --git a/Vocaluxe/Screens/CScreenCredits.cs b/Vocaluxe/Screens/CScreenCredits.cs index ce02561c..495bc9c6 100644 --- a/Vocaluxe/Screens/CScreenCredits.cs +++ b/Vocaluxe/Screens/CScreenCredits.cs @@ -22,6 +22,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Windows.Forms; using Vocaluxe.Base; +using Vocaluxe.Base.Fonts; using VocaluxeLib.Menu; namespace Vocaluxe.Screens @@ -212,7 +213,7 @@ namespace Vocaluxe.Screens continue; string newLine = " " + paragraph[e]; CText text = GetNewText(75, lastY, -2, 30, -1, EAlignment.Left, EStyle.Bold, "Outline", new SColorF(1, 1, 1, 1), line); - if (CDraw.GetTextBounds(text).Width < (CSettings.RenderW - 220)) + if (CFonts.GetTextBounds(text).Width < (CSettings.RenderW - 220)) { line += newLine; diff --git a/Vocaluxe/Screens/CScreenMain.cs b/Vocaluxe/Screens/CScreenMain.cs index e5f6ca13..db7f2021 100644 --- a/Vocaluxe/Screens/CScreenMain.cs +++ b/Vocaluxe/Screens/CScreenMain.cs @@ -158,7 +158,7 @@ namespace Vocaluxe.Screens { CFonts.SetFont("Normal"); CFonts.Style = EStyle.Normal; - CDraw.DrawText(CSettings.GetFullVersionText(), 10, 680, 40); + CFonts.DrawText(CSettings.GetFullVersionText(), 10, 680, 40); } return true; diff --git a/Vocaluxe/Screens/CScreenTest.cs b/Vocaluxe/Screens/CScreenTest.cs index d7b3b722..4a84b29c 100644 --- a/Vocaluxe/Screens/CScreenTest.cs +++ b/Vocaluxe/Screens/CScreenTest.cs @@ -20,6 +20,7 @@ using System; using System.Windows.Forms; using Vocaluxe.Base; +using Vocaluxe.Base.Fonts; using VocaluxeLib.Menu; namespace Vocaluxe.Screens diff --git a/VocaluxeLib/Menu/CLyric.cs b/VocaluxeLib/Menu/CLyric.cs index 2d18e6ec..aeffa9f8 100644 --- a/VocaluxeLib/Menu/CLyric.cs +++ b/VocaluxeLib/Menu/CLyric.cs @@ -216,7 +216,7 @@ namespace VocaluxeLib.Menu if (n.Type == ENoteType.Freestyle) _Text.Style = EStyle.BoldItalic; - RectangleF rect = CBase.Drawing.GetTextBounds(_Text); + RectangleF rect = CBase.Fonts.GetTextBounds(_Text); _Width += rect.Width; _Notes.Add(n); } @@ -267,7 +267,7 @@ namespace VocaluxeLib.Menu _Text.X = x; _Text.Style = EStyle.Bold; _Text.Text = note.Text; - RectangleF rect = CBase.Drawing.GetTextBounds(_Text); + RectangleF rect = CBase.Fonts.GetTextBounds(_Text); if (note.Type == ENoteType.Freestyle) _Text.Style = EStyle.BoldItalic; @@ -326,7 +326,7 @@ namespace VocaluxeLib.Menu _Text.X = x; _Text.Style = EStyle.Bold; _Text.Text = _Notes[note].Text; - RectangleF rect = CBase.Drawing.GetTextBounds(_Text); + RectangleF rect = CBase.Fonts.GetTextBounds(_Text); if (_Notes[note].Type == ENoteType.Freestyle) _Text.Style = EStyle.BoldItalic; @@ -374,7 +374,7 @@ namespace VocaluxeLib.Menu if (_Notes[zoomNote].Type == ENoteType.Freestyle) _Text.Style = EStyle.BoldItalic; - RectangleF rect = CBase.Drawing.GetTextBounds(_Text); + RectangleF rect = CBase.Fonts.GetTextBounds(_Text); float diff = endBeat - _Notes[zoomNote].StartBeat; if (diff <= 0f) @@ -392,7 +392,7 @@ namespace VocaluxeLib.Menu float tz = _Text.Z; _Text.Height += _Text.Height * p * 0.4f; - RectangleF rectz = CBase.Drawing.GetTextBounds(_Text); + RectangleF rectz = CBase.Fonts.GetTextBounds(_Text); _Text.X -= (rectz.Width - rect.Width) / 2f; _Text.Y -= (rectz.Height - rect.Height) / 2f; _Text.Z -= 0.1f; @@ -415,7 +415,7 @@ namespace VocaluxeLib.Menu _Text.X = x; _Text.Style = EStyle.Bold; _Text.Text = note.Text; - RectangleF rect = CBase.Drawing.GetTextBounds(_Text); + RectangleF rect = CBase.Fonts.GetTextBounds(_Text); if (note.Type == ENoteType.Freestyle) _Text.Style = EStyle.BoldItalic; @@ -456,7 +456,7 @@ namespace VocaluxeLib.Menu _Text.X = x; _Text.Style = EStyle.Bold; _Text.Text = _Notes[note].Text; - RectangleF rect = CBase.Drawing.GetTextBounds(_Text); + RectangleF rect = CBase.Fonts.GetTextBounds(_Text); if (_Notes[note].Type == ENoteType.Freestyle) _Text.Style = EStyle.BoldItalic; diff --git a/VocaluxeLib/Menu/CMenu.cs b/VocaluxeLib/Menu/CMenu.cs index e17e6aec..90d5416e 100644 --- a/VocaluxeLib/Menu/CMenu.cs +++ b/VocaluxeLib/Menu/CMenu.cs @@ -1016,7 +1016,7 @@ namespace VocaluxeLib.Menu return true; break; case EType.Text: - RectangleF bounds = CBase.Drawing.GetTextBounds(_Texts[interact.Num]); + RectangleF bounds = CBase.Fonts.GetTextBounds(_Texts[interact.Num]); if (CHelper.IsInBounds(new SRectF(_Texts[interact.Num].X, _Texts[interact.Num].Y, bounds.Width, bounds.Height, _Texts[interact.Num].Z), x, y)) return true; break; diff --git a/VocaluxeLib/Menu/CSelectSlide.cs b/VocaluxeLib/Menu/CSelectSlide.cs index 7216166c..488d2af6 100644 --- a/VocaluxeLib/Menu/CSelectSlide.cs +++ b/VocaluxeLib/Menu/CSelectSlide.cs @@ -764,7 +764,7 @@ namespace VocaluxeLib.Menu alpha = new SColorF(1f, 1f, 1f, 1f); } - RectangleF bounds = CBase.Drawing.GetTextBounds(text); + RectangleF bounds = CBase.Fonts.GetTextBounds(text); text.X = (x + dx / 2f + dx * i) + TextRelativeX; if (!WithTextures) diff --git a/VocaluxeLib/Menu/CText.cs b/VocaluxeLib/Menu/CText.cs index f270cfb3..9d44c33a 100644 --- a/VocaluxeLib/Menu/CText.cs +++ b/VocaluxeLib/Menu/CText.cs @@ -551,7 +551,7 @@ namespace VocaluxeLib.Menu public void Draw(float begin, float end) { - RectangleF bounds = CBase.Fonts.GetTextBounds(this, Height); + RectangleF bounds = CBase.Fonts.GetTextBounds(this); float x = X; switch (Align) @@ -597,7 +597,7 @@ namespace VocaluxeLib.Menu CBase.Fonts.SetFont(Font); CBase.Fonts.SetStyle(Style); - RectangleF bounds = CBase.Fonts.GetTextBounds(this, Height); + RectangleF bounds = CBase.Fonts.GetTextBounds(this); if (bounds.Width > Bounds.W && Bounds.W > 0f && bounds.Width > 0f) { @@ -691,7 +691,7 @@ namespace VocaluxeLib.Menu float h = Height; float y = Y; - RectangleF bounds = CBase.Fonts.GetTextBounds(this, Height); + RectangleF bounds = CBase.Fonts.GetTextBounds(this); if (bounds.Width > Bounds.W && Bounds.W > 0f && bounds.Width > 0f) { diff --git a/VocaluxeLib/Menu/IMenu.cs b/VocaluxeLib/Menu/IMenu.cs index b698adaa..95100788 100644 --- a/VocaluxeLib/Menu/IMenu.cs +++ b/VocaluxeLib/Menu/IMenu.cs @@ -159,8 +159,6 @@ namespace VocaluxeLib.Menu public interface IDrawing { - RectangleF GetTextBounds(CText text); - void DrawTexture(STexture texture, SRectF rect); void DrawTexture(STexture texture, SRectF rect, SColorF color); void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds); @@ -192,6 +190,7 @@ namespace VocaluxeLib.Menu void SetFont(string fontName); void SetStyle(EStyle fontStyle); + RectangleF GetTextBounds(CText text); RectangleF GetTextBounds(CText text, float textHeight); void DrawText(string text, float textHeight, float x, float y, float z, SColorF color);