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.new("Touch me!")
.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.
790 |
# File 'motion-game', line 790 def initialize(title=''); end |
Instance Attribute Details
- (String) font
Returns name of the font used for the button title.
802 803 804 |
# File 'motion-game', line 802 def font @font end |
- (Integer) font_size
Returns size of the font used by for button title.
805 806 807 |
# File 'motion-game', line 805 def font_size @font_size end |
- (String) text
Returns title of the button.
796 797 798 |
# File 'motion-game', line 796 def text @text end |
- (Color) text_color
Returns color of the title.
799 800 801 |
# File 'motion-game', line 799 def text_color @text_color end |
- (Float) zoom_scale
Returns the value with which the button will zoom when the user presses it.
809 810 811 |
# File 'motion-game', line 809 def zoom_scale @zoom_scale end |