Class: MG::Button
Overview
A button widget. The Widget#on_touch method can be used to set a callback when the button is activated. Example:
button = Button.new("Touch me!") button.on_touch { |type| puts "touched!" if type == :end }
Properties (collapse)
-
- (String) font
Name of the font used for the button title.
-
- (Integer) font_size
Size of the font used by for button title.
-
- (String) text
Title of the button.
-
- (Color) text_color
Color of the title.
-
- (Float) zoom_scale
The value with which the button will zoom when the user presses it.
Attributes inherited from Widget
Attributes inherited from Node
#alpha, #anchor_point, #color, #name, #position, #rotation, #scale, #size, #visible?, #z_index
Constructors (collapse)
-
- (Button) initialize(title = '')
constructor
Creates a new Button widget with an optional title.
Methods inherited from Widget
Methods inherited from Node
#add, #children, #clear, #delete, #delete_from_parent, #intersects?, #parent
Constructor Details
- (Button) initialize(title = '')
Creates a new Button widget with an optional title.
744 |
# File 'motion-game', line 744 def initialize(title=''); end |
Instance Attribute Details
- (String) font
Returns name of the font used for the button title.
756 757 758 |
# File 'motion-game', line 756 def font @font end |
- (Integer) font_size
Returns size of the font used by for button title.
759 760 761 |
# File 'motion-game', line 759 def font_size @font_size end |
- (String) text
Returns title of the button.
750 751 752 |
# File 'motion-game', line 750 def text @text end |
- (Color) text_color
Returns color of the title.
753 754 755 |
# File 'motion-game', line 753 def text_color @text_color end |
- (Float) zoom_scale
Returns the value with which the button will zoom when the user presses it.
763 764 765 |
# File 'motion-game', line 763 def zoom_scale @zoom_scale end |