mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-27 06:30:59 +00:00
Improved handling of line-endings. Removed some warnings.
This commit is contained in:
parent
6025cb9125
commit
188ea93280
|
@ -14,6 +14,7 @@ using System.Runtime.InteropServices;
|
||||||
using OpenTK.Math;
|
using OpenTK.Math;
|
||||||
using OpenTK.OpenGL;
|
using OpenTK.OpenGL;
|
||||||
using OpenTK.OpenGL.Enums;
|
using OpenTK.OpenGL.Enums;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
|
||||||
namespace OpenTK.Fonts
|
namespace OpenTK.Fonts
|
||||||
|
@ -25,7 +26,6 @@ namespace OpenTK.Fonts
|
||||||
{
|
{
|
||||||
//static Regex break_point = new Regex("[ .,/*-+?\\!=]", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
//static Regex break_point = new Regex("[ .,/*-+?\\!=]", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||||
//static char[] split_chars = new char[] { ' ', '\n', '\t', ',', '.', '/', '?', '!', ';', '\\', '-', '+', '*', '=' };
|
//static char[] split_chars = new char[] { ' ', '\n', '\t', ',', '.', '/', '?', '!', ';', '\\', '-', '+', '*', '=' };
|
||||||
static bool use_vbo, use_arb_vbo, use_display_list;
|
|
||||||
static bool functionality_checked = false;
|
static bool functionality_checked = false;
|
||||||
static ITextPrinterImplementation printer;
|
static ITextPrinterImplementation printer;
|
||||||
|
|
||||||
|
@ -38,6 +38,8 @@ namespace OpenTK.Fonts
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region static void CheckNeededFunctionality()
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks the machine's capabilities and selects the fastest method to print text.
|
/// Checks the machine's capabilities and selects the fastest method to print text.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -53,8 +55,12 @@ namespace OpenTK.Fonts
|
||||||
throw new NotSupportedException("DefaultLayoutProvider requires at least OpenGL 1.1 support.");
|
throw new NotSupportedException("DefaultLayoutProvider requires at least OpenGL 1.1 support.");
|
||||||
|
|
||||||
functionality_checked = true;
|
functionality_checked = true;
|
||||||
|
|
||||||
|
Debug.Print("Using {0} for font printing.", printer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region --- ITextPrinter Members ---
|
#region --- ITextPrinter Members ---
|
||||||
|
|
||||||
public void Prepare(string text, TextureFont font, out TextHandle handle)
|
public void Prepare(string text, TextureFont font, out TextHandle handle)
|
||||||
|
@ -106,13 +112,7 @@ namespace OpenTK.Fonts
|
||||||
if (Char.IsSeparator(c))
|
if (Char.IsSeparator(c))
|
||||||
last_break_point = index_count;
|
last_break_point = index_count;
|
||||||
|
|
||||||
if (c == '\n' || c == '\r')
|
if (c != '\n' && c != '\r')
|
||||||
{
|
|
||||||
//x_pos = layoutRect.Left;
|
|
||||||
x_pos = 0;
|
|
||||||
y_pos += font.Height;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
font.GlyphData(c, out char_width, out char_height, out rect, out texture);
|
font.GlyphData(c, out char_width, out char_height, out rect, out texture);
|
||||||
|
|
||||||
|
@ -146,6 +146,12 @@ namespace OpenTK.Fonts
|
||||||
font.MeasureString(text.Substring(i, 1), out measured_width, out measured_height);
|
font.MeasureString(text.Substring(i, 1), out measured_width, out measured_height);
|
||||||
x_pos += measured_width;
|
x_pos += measured_width;
|
||||||
}
|
}
|
||||||
|
else if (c == '\n')
|
||||||
|
{
|
||||||
|
//x_pos = layoutRect.Left;
|
||||||
|
x_pos = 0;
|
||||||
|
y_pos += font.Height;
|
||||||
|
}
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -171,7 +177,7 @@ namespace OpenTK.Fonts
|
||||||
GL.Enable(EnableCap.Blend);
|
GL.Enable(EnableCap.Blend);
|
||||||
GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
|
GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
|
||||||
|
|
||||||
//GL.Disable(EnableCap.Texture2d);
|
GL.Disable(EnableCap.DepthTest);
|
||||||
|
|
||||||
GL.BindTexture(TextureTarget.Texture2d, handle.font.Texture);
|
GL.BindTexture(TextureTarget.Texture2d, handle.font.Texture);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue