Label Class Reference

Draw text primitive. More...

Inheritance diagram for Label:
Node

List of all members.

Public Member Functions

 Label ()
 Label constructor.
 Label (string text, FontMap fontmap=null)
 Label constructor.
override void Draw ()
 The draw function.
override bool GetlContentLocalBounds (ref Bounds2 bounds)
 Return the Bounds2 object containing the text, in local space.
Bounds2 GetlContentLocalBounds ()
 Return the Bounds2 object containing the text, in local space.

Public Attributes

string Text = ""
 The text to display.
Vector4 Color = Colors.White
 The text color.
BlendMode BlendMode = BlendMode.Normal
 The text blend mode.
float HeightScale = 1.0f
 A scale factor applied to the character's pixel height during rendering.
FontMap FontMap
 The fontmap used to display this Label (the character set has to match).
SpriteRenderer.ISpriteShader Shader = (SpriteRenderer.ISpriteShader)Director.Instance.SpriteRenderer.DefaultFontShader
 User can set an external shader.

Properties

float CharWorldHeight [get]
 The character height in world coordinates = FontHeight * HeightScale.

Detailed Description

Draw text primitive.

2 types of font data supported:

  • One using SpriteRenderer's embedded debug font
  • The other using a FontMap object

Constructor & Destructor Documentation

Label ( string  text,
FontMap  fontmap = null 
)

Label constructor.

Parameters:
textThe text to render.
fontmapThe font data used for rendering the text. If null, an embedded debug font will be used.

Member Data Documentation

SpriteRenderer.ISpriteShader Shader = (SpriteRenderer.ISpriteShader)Director.Instance.SpriteRenderer.DefaultFontShader

User can set an external shader.

The Label class won't dispose of shaders set by user.