mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-25 16:45:27 +00:00
Allow the user to code his own ITextPrinterImplementation.
This commit is contained in:
parent
43aaa02745
commit
6ce200cdae
|
@ -15,10 +15,31 @@ namespace OpenTK.Graphics
|
|||
/// <summary>
|
||||
/// Defines the interface for TextPrinter implementations.
|
||||
/// </summary>
|
||||
interface ITextPrinterImplementation
|
||||
public interface ITextPrinterImplementation
|
||||
{
|
||||
TextHandle Load(Vector2[] vertices, ushort[] indices, int index_count);
|
||||
/// <summary>
|
||||
/// Caches a text fragment for future use.
|
||||
/// </summary>
|
||||
/// <param name="vertices">The vertex array for the text fragment.</param>
|
||||
/// <param name="indices">The index array for the text fragment. Please use the indexCount parameter
|
||||
/// instead of indices.Count, as the indices array may be larger than necessary for performance reasons.</param>
|
||||
/// <param name="indexCount">The actual number of indices in the text fragment.</param>
|
||||
/// <returns>A TextHandle that can be used to draw the text fragment.</returns>
|
||||
TextHandle Load(Vector2[] vertices, ushort[] indices, int indexCount);
|
||||
|
||||
/// <summary>
|
||||
/// Draws the specified cached text fragment.
|
||||
/// </summary>
|
||||
/// <param name="handle">The TextHandle corresponding to the desired text fragment.</param>
|
||||
void Draw(TextHandle handle);
|
||||
void Draw(Vector2[] vertices, ushort[] indices, int index_count);
|
||||
|
||||
/// <summary>
|
||||
/// Draws a text fragment, without caching.
|
||||
/// </summary>
|
||||
/// <param name="vertices">The vertex array for the text fragment.</param>
|
||||
/// <param name="indices">The index array for the text fragment. Please use the indexCount parameter
|
||||
/// instead of indices.Count, as the indices array may be larger than necessary for performance reasons.</param>
|
||||
/// <param name="indexCount">The actual number of indices in the text fragment.</param>
|
||||
void Draw(Vector2[] vertices, ushort[] indices, int indexCount);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,13 +38,20 @@ namespace OpenTK.Graphics
|
|||
Vector2[] vertices = new Vector2[8 * 8];
|
||||
ushort[] indices = new ushort[6 * 8];
|
||||
|
||||
#region --- Constructor ---
|
||||
#region --- Constructors ---
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new TextPrinter object.
|
||||
/// </summary>
|
||||
public TextPrinter() { }
|
||||
|
||||
public TextPrinter(ITextPrinterImplementation implementation)
|
||||
{
|
||||
if (implementation == null)
|
||||
throw new ArgumentNullException("implementation");
|
||||
printer = implementation;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- Private Members ---
|
||||
|
|
Loading…
Reference in a new issue