Class: GraphicText

GraphicText

A class for all the texts to display in HUD

new GraphicText (text, opts)

Name Type Default Description
text string "" optional The brut text to display
opts Object {} optional Options
Name Type Default Description
x number 0 optional The x coords of the text
y number 0 optional The y coords of the text
w number 0 optional The w coords of the text
h number 0 optional The h coords of the text
align Align Align.Left optional Alignement of the text
fontSize number RPM.defaultValue(RPM.datasGame.system.dbOptions.vtSize, RPM.fontSize) optional The font height used for the text
fontName string RPM.defaultValue(RPM.datasGame.system.dbOptions.vtFont, RPM.fontName) optional The font name used for the text
verticalAlign AlignVertical AlignVertical.Center optional Vertical alignement of the text
color SystemColor RPM.defaultValue(RPM.datasGame.system.dbOptions.vtcText optional The color used for the text
bold boolean false optional If checked, make the text bold
italic boolean false optional If checked, make the text italic
backColor SystemColor RPM.defaultValue(RPM.datasGame.system.dbOptions.vtcBackground, null) optional The background color behind the text
strokeColor SystemColor RPM.defaultValue(RPM.datasGame.system.dbOptions.tOutline, false)? RPM.defaultValue(RPM.datasGame.system.dbOptions.vtcOutline, null) : null optional The stroke color of the text
Properties:
Name Type Description
text string The brut text to display
align Align Alignement of the text
fontSize number The font height used for the text
fontName string The font name used for the text
verticalAlign AlignVertical Vertical alignement of the text
color SystemColor The color used for the text
bold boolean If checked, make the text bold
italic boolean If checked, make the text italic
backColor SystemColor The background color behind the text
strokeColor SystemColor The stroke color of the text
font string The font used for the text (combining fontSize + fontName)
textWidth number The font text width (without resizing)

Extends

Methods

setFontSize (fontSize)

Set the font size and the final font
Name Type Description
fontSize number The new font size

setText (text)

Set the current displayed text
Name Type Description
text string The new text

updateContextFont ()

Update the context font (without window resizing), this function is used before a context.measureText

updateContextFontReal ()

Update the context font with resizing

measureText ()

Measure text width and stock results in the instance

drawChoice (x, y, w, h, positionResize)

Drawing the text in choice box
Name Type Default Description
x number this.oX optional The x position to draw graphic
y number this.oY optional The y position to draw graphic
w number this.oW optional The width dimention to draw graphic
h number this.oH optional The height dimention to draw graphic
positionResize boolean true optional If checked, resize postion according to screen resolution

drawBox (x, y, w, h, positionResize)

Drawing the text in box (duplicate of drawChoice)
Name Type Default Description
x number this.oX optional The x position to draw graphic
y number this.oY optional The y position to draw graphic
w number this.oW optional The width dimention to draw graphic
h number this.oH optional The height dimention to draw graphic
positionResize boolean true optional If checked, resize postion according to screen resolution

draw (x, y, w, h, positionResize)

Drawing the text (duplicate of drawChoice)
Name Type Default Description
x number this.oX optional The x position to draw graphic
y number this.oY optional The y position to draw graphic
w number this.oW optional The width dimention to draw graphic
h number this.oH optional The height dimention to draw graphic
positionResize boolean true optional If checked, resize postion according to screen resolution

setX (x, min) inherited overrides

Set the x value
Name Type Default Description
x number The x value
min boolean false optional If checked, transform screen value with min x y

setY (y, min) inherited overrides

Set the y value
Name Type Default Description
y number The y value
min boolean false optional If checked, transform screen value with min x y

setW (w, min) inherited overrides

Set the w value
Name Type Default Description
w number The w value
min boolean false optional If checked, transform screen value with min x y

setH (h, min) inherited overrides

Set the h value
Name Type Default Description
h number The h value
min boolean false optional If checked, transform screen value with min x y

setLeft () inherited overrides

Set the position to the left

setTop () inherited overrides

Set the position to the top

setRight () inherited overrides

Set the position to the right

setBot () inherited overrides

Set the position to the bot

setCoords (x, y, w, h) inherited overrides

Set all the coords values
Name Type Description
x number The x value
y number The y value
w number The w value
h number The h value