Class: MG::Text

Inherits:
Widget show all
Defined in:
doc/API_reference.rb

Properties collapse

Attributes inherited from Widget

#enabled?, #highlighted?, #touch_enabled?

Attributes inherited from Node

#alpha, #anchor_point, #color, #name, #position, #rotation, #scale, #size, #visible?, #z_index

Constructors collapse

Methods inherited from Widget

#on_touch

Methods inherited from Node

#add, #children, #clear, #delete, #delete_from_parent, #intersects?, #parent, #run_action, #stop_action, #stop_all_actions

Constructor Details

#initialize(text = '', font = '', font_size = 0) ⇒ Text

Creates a new Text widget with optional content, font name and size.

Parameters:

  • text (String) (defaults to: '')

    content for the text widget.

  • font (String) (defaults to: '')

    name of the font the text widget should use.

  • font_size (Integer) (defaults to: 0)

    size of the font the text widget should use.



1188
# File 'doc/API_reference.rb', line 1188

def initialize(text='', font='', font_size=0); end

Instance Attribute Details

#area_sizeSize

Returns the text rendering area size.

Returns:

  • (Size)

    the text rendering area size.



1206
1207
1208
# File 'doc/API_reference.rb', line 1206

def area_size
  @area_size
end

#fontString

Returns name of the font used by the widget.

Returns:

  • (String)

    name of the font used by the widget.



1200
1201
1202
# File 'doc/API_reference.rb', line 1200

def font
  @font
end

#font_sizeInteger

Returns size of the font used by the widget.

Returns:

  • (Integer)

    size of the font used by the widget.



1203
1204
1205
# File 'doc/API_reference.rb', line 1203

def font_size
  @font_size
end

#horizontal_align:left, ...

Returns the horizontal alignment of the text.

Returns:

  • (:left, :center, :right)

    the horizontal alignment of the text.



1212
1213
1214
# File 'doc/API_reference.rb', line 1212

def horizontal_align
  @horizontal_align
end

#textString

Returns content of the widget.

Returns:

  • (String)

    content of the widget.



1194
1195
1196
# File 'doc/API_reference.rb', line 1194

def text
  @text
end

#text_colorColor

Returns color of the text part of the widget.

Returns:

  • (Color)

    color of the text part of the widget.



1197
1198
1199
# File 'doc/API_reference.rb', line 1197

def text_color
  @text_color
end

#vertical_align:top, ...

Returns the vertical alignment of the text.

Returns:

  • (:top, :center, :bottom)

    the vertical alignment of the text.



1209
1210
1211
# File 'doc/API_reference.rb', line 1209

def vertical_align
  @vertical_align
end