Class: LiteRGSS::Text

Inherits:
Object
  • Object
show all
Defined in:
LiteRGSS.rb

Overview

Note:

Text cannot be saved, loaded from file nor cloned in the memory

Class that describes a text shown on the screen or inside a viewport

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(font_id, viewport, x, y, width, height, str, align = 0, outlinesize = nil) ⇒ Text

Create a new Text

Parameters:

  • font_id (Integer)

    the id of the font to use to draw the text (loads the size and default colors from that)

  • viewport (Viewport, nil)

    the viewport in which the text is shown

  • x (Integer)

    the x coordinate of the text surface

  • y (Integer)

    the y coordinate of the text surface

  • width (Integer)

    the width of the text surface

  • height (Integer)

    the height of the text surface

  • str (String)

    the text shown by this object

  • align (0, 1, 2) (defaults to: 0)

    the align of the text in its surface (best effort => no resize), 0 = left, 1 = center, 2 = right

  • outlinesize (Integer, nil) (defaults to: nil)

    the size of the text outline

Instance Attribute Details

#alignInteger

The alignment of the text (0 = left, 1 = center, 2 = right)

Returns:

  • (Integer)

#boldBoolean

If the text should be shown in bold

Returns:

  • (Boolean)

#draw_shadowBoolean

If the text is drawn as in Pokemon DPP / RSE / HGSS / BW

Returns:

  • (Boolean)

#fill_colorColor

The color of the text

Returns:

#heightNumeric

The height of the text surface

Returns:

  • (Numeric)

#italicBoolean

If the text should be shown in italic

Returns:

  • (Boolean)

#nchar_drawInteger

The number of character the object should draw

Returns:

  • (Integer)

#opacityInteger

Opacity of the text

Returns:

  • (Integer)

#outline_colorColor

The color of the outline

Returns:

#outline_thicknessInteger

The size of the text outline

Returns:

  • (Integer)

#real_widthInteger

Return the real width of the text

Returns:

  • (Integer)

#sizeInteger

The font size of the text

Returns:

  • (Integer)

#textString

Text shown by this Object

Returns:

  • (String)

#viewportLiteRGSS::Viewport? (readonly)

Return the Text viewport

Returns:

#visibleBoolean

If the Text is visible

Returns:

  • (Boolean)

#widthNumeric

The width of the text surface

Returns:

  • (Numeric)

#xNumeric

The x coordinate of the text surface

Returns:

  • (Numeric)

#yNumeric

The y coordinate of the text surface

Returns:

  • (Numeric)

#zNumeric

The Text z property

Returns:

  • (Numeric)

Instance Method Details

#__index__Integer

Return the text index to know if it has been created before an other sprite/text/viewport in the same viewport

Returns:

  • (Integer)

#disposeself

Dispose the text

Returns:

  • (self)

#disposed?Boolean

Indicate if the text is disposed or not

Returns:

  • (Boolean)

#load_color(font_id)

Load a color from a font_id

Parameters:

  • font_id (Integer)

    id of the font where to load the colors

Returns:

  • self

#set_position(x, y) ⇒ self

Define the position of the text

Parameters:

  • x (Numeric)
  • y (Numeric)

Returns:

  • (self)

#set_size(size) ⇒ self

Set the font size of the text

Parameters:

  • size (Integer)

Returns:

  • (self)

#text_width(text) ⇒ Integer

Return the width of the given string if drawn by this Text object

Parameters:

  • text (String)

Returns:

  • (Integer)