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> /// <summary>
/// Represents a handle to cached text. /// Represents a handle to cached text.
/// </summary> /// </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; Handle = handle;
} }
private int handle;
protected TextureFont font;
protected bool disposed;
/// <summary> /// <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. /// to draw the text represented by this TextHandle.
/// </summary> /// </summary>
public readonly int Handle; public int Handle
internal TextureFont font; {
protected bool disposed; 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() #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); PerformLayout(text, font, width, wordWarp, alignment, rightToLeft, ref vertices, ref indices, out num_indices);
handle = Printer.Load(vertices, indices, num_indices); handle = Printer.Load(vertices, indices, num_indices);
handle.font = font; handle.Font = font;
} }
#endregion #endregion
@ -276,7 +276,7 @@ namespace OpenTK.Graphics
/// <param name="handle">The TextHandle to the cached text.</param> /// <param name="handle">The TextHandle to the cached text.</param>
public void Draw(TextHandle handle) public void Draw(TextHandle handle)
{ {
GL.BindTexture(TextureTarget.Texture2D, handle.font.Texture); GL.BindTexture(TextureTarget.Texture2D, handle.Font.Texture);
Printer.Draw(handle); Printer.Draw(handle);
} }