Class: MG::Text

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

Instance Attribute Summary collapse

Attributes inherited from Node

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

Constructors collapse

Methods inherited from Widget

#enabled=, #enabled?, #highlighted=, #highlighted?, #on_touch, #touch_enabled=, #touch_enabled?

Methods inherited from Node

#add, #children, #clear, #delete, #delete_from_parent, #intersects?, #number_of_running_actions, #parent, #run_action, #schedule, #schedule_once, #stop_action, #stop_all_actions, #unschedule, #visible=, #visible?

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.



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

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.



1363
1364
1365
# File 'doc/API_reference.rb', line 1363

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.



1357
1358
1359
# File 'doc/API_reference.rb', line 1357

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.



1360
1361
1362
# File 'doc/API_reference.rb', line 1360

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.



1369
1370
1371
# File 'doc/API_reference.rb', line 1369

def horizontal_align
  @horizontal_align
end

#textString

Returns content of the widget.

Returns:

  • (String)

    content of the widget.



1351
1352
1353
# File 'doc/API_reference.rb', line 1351

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.



1354
1355
1356
# File 'doc/API_reference.rb', line 1354

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.



1366
1367
1368
# File 'doc/API_reference.rb', line 1366

def vertical_align
  @vertical_align
end