Component_TextBehavior Class
Item Index
Methods
Methods
addText
-
sender
-
params
Action to append a specified text.
Parameters:
-
sender
Object- The sender of the action.
-
params
Object- The action's parameters.
dispose
()
Disposes the component and bitmap.
onDataBundleRestore.
-
Object
-
gs.ObjectCodecContext
Called if this object instance is restored from a data-bundle. It can be used re-assign event-handler, anonymous functions, etc.
Parameters:
-
Object
Objectdata - The data-bundle
-
gs.ObjectCodecContext
Objectcontext - The codec-context.
redraw
()
Redraws the texts on game object's bitmap.
refresh
-
force
Refreshes the texts on game object's bitmap. If the text or font has not been changed, no refresh will happen.
Parameters:
-
force
Boolean- If set to true it will force redrawing the text even if the text and font has not been changed.
refreshBitmap
()
Recreates and clears the game object's bitmap if necessary.
refreshSize
()
Updates the game object's dstRect so that the text fits in. That only works if the game object's sizeToFit property is set.
refreshWithSize
-
size
Updates the game object's dstRect with the specified text size.
Parameters:
-
size
gs.Size- The text size to resize the game object for.
update
()
Updates the component. Checks if the game object's bitmap needs a refresh and maybe disposes the bitmap if the game object's is out of the screen and memory usage is too high.
Properties
font
String
protected
The font used for text-rendering.
format
String
protected
Standard Format String which can be used if the text represents a number value. Example: If the text is "3" and format is "%0d3" then 003 is the displayed text.
padding
String
protected
The space around the text.
text
String
protected
The current text displayed.