Class l2df.class.component.print

Last updated 2021-05-28 15:24:22

Print component.

Inherited from l2df.class.Component class.

Info:

Functions

Print:set(obj[, kwargs]) Set params for printing
Print:added(obj[, kwargs]) Component was added to Entity event.
Print:postupdate(obj) Component post-update event handler.

Fields

Print.data.align Text alignment: "left", "right", "center".
Print.data.limit Text max width.
Print.data.font Text font.
Print.data.color Text color.
Print.data.pcolor Placeholder color.


Functions

Methods
Print:set(obj[, kwargs])
Set params for printing

Parameters:

  • obj l2df.class.entity Entity's instance.
  • kwargs table Keyword arguments.
    • text string Text to display. (default "")
    • placeholder string Placeholder text to display. (default "")
    • font string, number, {string,number} or userdata Font used for displaying text. Can be a font name, font size, table-combination of both or even userdata with ready-to-use font instance. (default {"Arial.ttf";12})
    • limit string Max width of the one-line text string. Defaults to the text's length with setted font. (optional)
    • center string Text alignment: "left", "right", "center". Used in pair with kwargs.limit to align text after line breaks. (default 'left')
    • color {0..255,0..255,0..255,0..255} Text's RGBA color. Defaults to {255, 255, 255, 255} (white). (optional)
    • pcolor {0..255,0..255,0..255,0..255} Text placeholder's RGBA color. Defaults to the value of kwargs.color. (optional)
Print:added(obj[, kwargs])
Component was added to Entity event.

Parameters:

  • obj l2df.class.entity Entity's instance.
  • kwargs table Keyword arguments. See Print:set() for additional description.
    • hidden boolean Text's hidden state. Applies to entity's hidden state. (default false)
    • x number Text's X position. Careful: if setted it will change entity's position. (default 0)
    • y number Text's Y position. Careful: if setted it will change entity's position. (default 0)
    • z number Text's Z position. Careful: if setted it will change entity's position. (default 0)
    • r number Text's rotation in radians. Careful: if setted it will change entity's rotation. (default 0)
    • scalex number Text's X scale. Careful: if setted it will change entity's scale. (default 1)
    • scaley number Text's Y scale. Careful: if setted it will change entity's scale. (default 1)
    • centerx number Text's origin X position. Doesn't apply if entity already has origin setted. (default 0)
    • centery number Text's origin Y position. Doesn't apply if entity already has origin setted. (default 0)
Print:postupdate(obj)
Component post-update event handler.

Parameters:

Fields

Print.data.align string
Text alignment: "left", "right", "center". To access use Print:data() function.
Print.data.limit string
Text max width. To access use Print:data() function.
Print.data.font string
Text font. To access use Print:data() function.
Print.data.color {0..1,0..1,0..1,0..1}
Text color. To access use Print:data() function.
Print.data.pcolor {0..1,0..1,0..1,0..1}
Placeholder color. To access use Print:data() function.