C# Class Nez.MarkupText

MarkupText lets you set fonts, textures and conditionals and provide some XML text to render that uses them. You must first set the fonts, textures and conditionals before you can use them in your markup. Lorem Ipsum

Some more text with color in the middle

Images are inlined too

conditions can be negated as well isTrue isnt trueisTrue is true

]]>
Inheritance: RenderableComponent
Mostrar archivo Open project: prime31/Nez Class Usage Examples

Public Methods

Method Description
MarkupText ( ) : System
MarkupText ( float textWidth ) : System
compile ( ) : void

compiles the current text to prepare it for rendering

render ( Graphics graphics, Camera camera ) : void

renders the MarkupText

setConditional ( string name, bool conditional ) : MarkupText

sets a conditional which can be used in an if tag with a condition attribute. It is also valid to negate the condition by prepending a ! to the name in the if tag

setFont ( string name, IFont font ) : MarkupText

sets a font that can be used in a text tag via the font attribute

setText ( string text ) : MarkupText

sets the text used for the run. Text should be valid XML.

setTextWidth ( float textWidth ) : MarkupText

sets the width that the run will fill

setTexture ( string name, Microsoft.Xna.Framework.Graphics.Texture2D texture ) : MarkupText

sets a texture which can be used in an img tag via the source attribute

Private Methods

Method Description
parseColor ( string hexString ) : Color
parseVector2 ( string vectorString ) : Vector2
wrapLine ( Vector2 position, List lineBuffer, HorizontalAlign alignment, float &currentLineHeight ) : Vector2

Method Details

MarkupText() public method

public MarkupText ( ) : System
return System

MarkupText() public method

public MarkupText ( float textWidth ) : System
textWidth float
return System

compile() public method

compiles the current text to prepare it for rendering
public compile ( ) : void
return void

render() public method

renders the MarkupText
public render ( Graphics graphics, Camera camera ) : void
graphics Graphics Graphics.
camera Camera Camera.
return void

setConditional() public method

sets a conditional which can be used in an if tag with a condition attribute. It is also valid to negate the condition by prepending a ! to the name in the if tag
public setConditional ( string name, bool conditional ) : MarkupText
name string Name.
conditional bool Conditional.
return MarkupText

setFont() public method

sets a font that can be used in a text tag via the font attribute
public setFont ( string name, IFont font ) : MarkupText
name string Name.
font IFont Font.
return MarkupText

setText() public method

sets the text used for the run. Text should be valid XML.
public setText ( string text ) : MarkupText
text string Text.
return MarkupText

setTextWidth() public method

sets the width that the run will fill
public setTextWidth ( float textWidth ) : MarkupText
textWidth float Width.
return MarkupText

setTexture() public method

sets a texture which can be used in an img tag via the source attribute
public setTexture ( string name, Microsoft.Xna.Framework.Graphics.Texture2D texture ) : MarkupText
name string Name.
texture Microsoft.Xna.Framework.Graphics.Texture2D Texture.
return MarkupText