API Documentation

for 0.0.1
Show:

TextField Class

TextField.

Constructor

TextField

(
  • params
)

Parameters:

  • params Object

    Config parameters

    • text String

      the String to display

    • font Font

      font Mobilizing.Font object

    • [fontSize= 20] Number optional

      fontSize font size

    • [lineMaxCharCount= 40] Number optional

      lineMaxCharCount the maximum number of characters a line should count

    • [color= Color.white] Color optional

      color the text color

    • backgroundColor Color

      backgroundColor backgroundColor of the text

    • [width= 300] Number optional

      width of the label

    • [height= 100] Number optional

      height of the label

Example:

//TODO

Methods

delete

()

Delete the letter currently before the cursor (or under selection when implemented)

getCanvas

() Canvas

Get the canvas

Returns:

Canvas:

canvas

getHeight

() Number

Get canvas height

Returns:

Number:

canvas height

getWidth

() Number

Get canvas width

Returns:

Number:

canvas width

moveCursorBack

()

Moves the cursor to the pevious letter

moveCursorForward

()

Moves the cursor to the next letter

moveCursorTo

(
  • index
)

Moves the cursor to the given index of the letter

Parameters:

  • index Number

pickLetter

(
  • x
  • y
)

Pick the letter situated under the given x,y coordinates

Parameters:

  • x Number
  • y Number

render

()

Renders the canvas

setColor

(
  • color
)

Set the color of the next letter

Parameters:

  • color Color

    the new Mobilizing Color

setFont

(
  • font
)

Set the font.

Parameters:

  • font Font

    Mobilizing font to use for the next letter

setSize

(
  • size
)

Set the size of the next letter

Parameters:

  • size Number

    the new size of the font

setText

(
  • letter
)

add a letter to the field content. Styles (font, color, etc) should be defined before calling this method.

Parameters:

  • letter String

    the letter to add

setup

() private

Setup bloc called after default font loading

Events

drawn

Triggered when the canvas has been redrawn, useful to synchronise Texture update and canvas refresh