public class Text extends Entity<T>
Modifier and Type | Class and Description |
---|---|
static class |
TextureBasedEntity.BlendMode
The list of supported PIXI blend modes and their associated constant.
|
Modifier and Type | Method and Description |
---|---|
double |
getAnchorX()
Returns the X anchor of this
TextureBasedEntity as a percentage of its width. |
double |
getAnchorY()
Returns the Y anchor of this
TextureBasedEntity as a percentage of its width. |
TextureBasedEntity.BlendMode |
getBlendMode()
Returns the
BlendMode this TextureBasedEntity is to be drawn with. |
int |
getFillColor()
Returns the color of the fill of this
Text as an RGB integer. |
java.lang.String |
getFontFamily()
Returns the name of the font of this
Text in px. |
int |
getFontSize()
Returns the size of the font of this
Text in px. |
int |
getStrokeColor()
Returns the color of the stroke of this
Text as an RGB integer. |
double |
getStrokeThickness()
Returs the thickness of the stroke of this
Text in pixels. |
java.lang.String |
getText()
Returns the string this
Text displays. |
int |
getTint()
Returns the tint of this
TextureBasedEntity as an RGB integer. |
T |
setAnchor(double anchor)
Sets both the X and Y anchors of this
TextureBasedEntity as a percentage of its width and height. |
T |
setAnchorX(double anchorX)
Sets the X anchor of this
TextureBasedEntity as a percentage of its width. |
T |
setAnchorX(double anchorX,
Curve curve)
Sets the X anchor of this
TextureBasedEntity as a percentage of its width. |
T |
setAnchorY(double anchorY)
Sets the Y anchor of this
TextureBasedEntity as a percentage of its width. |
T |
setAnchorY(double anchorY,
Curve curve)
Sets the Y anchor of this
TextureBasedEntity as a percentage of its width. |
T |
setBlendMode(TextureBasedEntity.BlendMode blendMode)
Sets the blend mode for this
TextureBasedEntity . |
Text |
setFillColor(int fillColor)
Sets the color of the fill of this
Text as an RGB integer. |
Text |
setFillColor(int fillColor,
Curve curve)
Sets the color of the fill of this
Text as an RGB integer. |
Text |
setFontFamily(java.lang.String fontFamily)
Sets the name of the font of this
Text . |
Text |
setFontSize(int fontSize)
Sets the size of the font of this
Text in px. |
Text |
setFontSize(int fontSize,
Curve curve)
Sets the size of the font of this
Text in px. |
Text |
setStrokeColor(int strokeColor)
Sets the color of the stroke of this
Text as an RGB integer. |
Text |
setStrokeColor(int strokeColor,
Curve curve)
Sets the color of the stroke of this
Text as an RGB integer. |
Text |
setStrokeThickness(double strokeThickness)
Returns the thickness of the stroke of this
Text in pixels. |
Text |
setStrokeThickness(double strokeThickness,
Curve curve)
Returns the thickness of the stroke of this
Text in pixels. |
Text |
setText(java.lang.String text)
Sets the string for this
Text to display. |
T |
setTint(int color)
Sets the tint of this
TextureBasedEntity as an RGB integer. |
T |
setTint(int color,
Curve curve)
Sets the tint of this
TextureBasedEntity as an RGB integer. |
getAlpha, getId, getRotation, getScaleX, getScaleY, getX, getY, getZIndex, isVisible, setAlpha, setAlpha, setRotation, setRotation, setScale, setScale, setScaleX, setScaleX, setScaleY, setScaleY, setVisible, setX, setX, setY, setY, setZIndex
public java.lang.String getText()
Text
displays.
Default is "" (empty string).
Text
.public Text setText(java.lang.String text)
Text
to display.text
- the string for this Text
to display.Text
.java.lang.NullPointerException
- if text is null.public int getStrokeColor()
Text
as an RGB integer.
Default is 0 (black).
Text
.public Text setStrokeColor(int strokeColor)
Text
as an RGB integer.strokeColor
- the color for the stroke of this Text
.Text
.java.lang.IllegalArgumentException
- if strokeColor is not a valid RGB integer.public Text setStrokeColor(int strokeColor, Curve curve)
Text
as an RGB integer.strokeColor
- the color for the stroke of this Text
.curve
- the transition to animate between values of this property.Text
.java.lang.IllegalArgumentException
- if strokeColor is not a valid RGB integer.public double getStrokeThickness()
Text
in pixels.Text
public Text setStrokeThickness(double strokeThickness)
Text
in pixels.
Default is 0 (no stroke).
strokeThickness
- the thickness for the stroke of this Text
.Text
public Text setStrokeThickness(double strokeThickness, Curve curve)
Text
in pixels.
Default is 0 (no stroke).
strokeThickness
- the thickness for the stroke of this Text
.curve
- the transition to animate between values of this property.Text
public int getFillColor()
Text
as an RGB integer.
Default is 0 (black).
Text
public Text setFillColor(int fillColor)
Text
as an RGB integer.fillColor
- the color for the fill of this Text
.Text
.java.lang.IllegalArgumentException
- if fillColor is not a valid RGB integer.public Text setFillColor(int fillColor, Curve curve)
Text
as an RGB integer.fillColor
- the color for the fill of this Text
.curve
- the transition to animate between values of this property.Text
.java.lang.IllegalArgumentException
- if fillColor is not a valid RGB integer.public int getFontSize()
Text
in px.
Default is 26.
Text
.public Text setFontSize(int fontSize)
Text
in px.fontSize
- the size for the font sof this Text
.Text
.public Text setFontSize(int fontSize, Curve curve)
Text
in px.fontSize
- the size for the font sof this Text
.curve
- the transition to animate between values of this property.Text
.public java.lang.String getFontFamily()
Text
in px.
Default is "Lato".
Text
.public Text setFontFamily(java.lang.String fontFamily)
Text
.
Only fonts available to the browser can be displayed.
fontFamily
- the size for the font sof this Text
.Text
.public TextureBasedEntity.BlendMode getBlendMode()
BlendMode
this TextureBasedEntity
is to be drawn with.BlendMode
this TextureBasedEntity
is to be drawn with.public T setBlendMode(TextureBasedEntity.BlendMode blendMode)
TextureBasedEntity
.
The possible values are found in BlendMode
.
blendMode
- TextureBasedEntity
.public T setAnchor(double anchor)
TextureBasedEntity
as a percentage of its width and height.
The point calculated by the anchors times the size of this TextureBasedEntity
will be the origin for any rotation or scale.
anchor
- the percentage for both anchors of this TextureBasedEntity
.TextureBasedEntity
.public double getAnchorX()
TextureBasedEntity
as a percentage of its width.
Default is 0.
TextureBasedEntity
as a percentage of its width.public T setAnchorX(double anchorX)
TextureBasedEntity
as a percentage of its width.
The point calculated by the anchors times the size of this TextureBasedEntity
will be the origin for any rotation or scale.
anchorX
- the X anchor for this TextureBasedEntity
.TextureBasedEntity
.public T setAnchorX(double anchorX, Curve curve)
TextureBasedEntity
as a percentage of its width.
The point calculated by the anchors times the size of this TextureBasedEntity
will be the origin for any rotation or scale.
anchorX
- the X anchor for this TextureBasedEntity
.curve
- the transition to animate between values of this property.TextureBasedEntity
.public double getAnchorY()
TextureBasedEntity
as a percentage of its width.
Default is 0.
TextureBasedEntity
as a percentage of its width.public T setAnchorY(double anchorY)
TextureBasedEntity
as a percentage of its width.
The point calculated by the anchors times the size of this TextureBasedEntity
will be the origin for any rotation or scale.
anchorY
- the Y anchor for this TextureBasedEntity
.TextureBasedEntity
.public T setAnchorY(double anchorY, Curve curve)
TextureBasedEntity
as a percentage of its width.
The point calculated by the anchors times the size of this TextureBasedEntity
will be the origin for any rotation or scale.
anchorY
- the Y anchor for this TextureBasedEntity
.curve
- the transition to animate between values of this property.TextureBasedEntity
.public T setTint(int color)
TextureBasedEntity
as an RGB integer.color
- the tint of this TextureBasedEntity
.TextureBasedEntity
.java.lang.IllegalArgumentException
- if color is not a valid RGB integer.public T setTint(int color, Curve curve)
TextureBasedEntity
as an RGB integer.color
- the tint of this TextureBasedEntity
.curve
- the transition to animate between values of this property.TextureBasedEntity
.java.lang.IllegalArgumentException
- if color is not a valid RGB integer.public int getTint()
TextureBasedEntity
as an RGB integer.
Default is 0xFFFFFF (white)
TextureBasedEntity
.