Added protected and public getters and setters to TextHandle.

This commit is contained in:
the_fiddler 2008-05-24 07:52:36 +00:00
parent b98fe61653
commit c63102621f
2 changed files with 27 additions and 8 deletions

View file

@ -13,20 +13,39 @@ namespace OpenTK.Graphics
/// <summary>
/// Represents a handle to cached text.
/// </summary>
public class TextHandle : IDisposable
public abstract class TextHandle : IDisposable
{
internal TextHandle(int handle)
/// <summary>
/// Constructs a new TextHandle,
/// </summary>
/// <param name="handle"></param>
public TextHandle(int handle)
{
Handle = handle;
}
private int handle;
protected TextureFont font;
protected bool disposed;
/// <summary>
/// The handle of the cached text. Call the OpenTK.Graphics.ITextPrinter.Draw() method
/// Gets the handle of the cached text run. Call the OpenTK.Graphics.ITextPrinter.Draw() method
/// to draw the text represented by this TextHandle.
/// </summary>
public readonly int Handle;
internal TextureFont font;
protected bool disposed;
public int Handle
{
get { return handle; }
protected set { handle = value; }
}
/// <summary>
/// Gets the TextureFont used for this text run.
/// </summary>
public TextureFont Font
{
get { return font; }
internal set { font = value; }
}
#region public override string ToString()

View file

@ -162,7 +162,7 @@ namespace OpenTK.Graphics
PerformLayout(text, font, width, wordWarp, alignment, rightToLeft, ref vertices, ref indices, out num_indices);
handle = Printer.Load(vertices, indices, num_indices);
handle.font = font;
handle.Font = font;
}
#endregion
@ -276,7 +276,7 @@ namespace OpenTK.Graphics
/// <param name="handle">The TextHandle to the cached text.</param>
public void Draw(TextHandle handle)
{
GL.BindTexture(TextureTarget.Texture2D, handle.font.Texture);
GL.BindTexture(TextureTarget.Texture2D, handle.Font.Texture);
Printer.Draw(handle);
}