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
-
#font ⇒ String
Name of the font used for the button title.
-
#font_size ⇒ Integer
Size of the font used by for button title.
-
#text ⇒ String
Title of the button.
-
#text_color ⇒ Color
Color of the title.
-
#zoom_scale ⇒ Float
The value with which the button will zoom when the user presses it.
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
-
#initialize(title = '') ⇒ Button
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, #run_action, #stop_action, #stop_all_actions
Constructor Details
#initialize(title = '') ⇒ Button
Creates a new Button widget with an optional title.
1202 |
# File 'motion-game', line 1202 def initialize(title=''); end |
Instance Attribute Details
#font ⇒ String
Returns name of the font used for the button title.
1214 1215 1216 |
# File 'motion-game', line 1214 def font @font end |
#font_size ⇒ Integer
Returns size of the font used by for button title.
1217 1218 1219 |
# File 'motion-game', line 1217 def font_size @font_size end |
#text ⇒ String
Returns title of the button.
1208 1209 1210 |
# File 'motion-game', line 1208 def text @text end |
#text_color ⇒ Color
Returns color of the title.
1211 1212 1213 |
# File 'motion-game', line 1211 def text_color @text_color end |
#zoom_scale ⇒ Float
Returns the value with which the button will zoom when the user presses it.
1221 1222 1223 |
# File 'motion-game', line 1221 def zoom_scale @zoom_scale end |