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.
1225 |
# File 'motion-game', line 1225 def initialize(title=''); end |
Instance Attribute Details
#font ⇒ String
Returns name of the font used for the button title.
1237 1238 1239 |
# File 'motion-game', line 1237 def font @font end |
#font_size ⇒ Integer
Returns size of the font used by for button title.
1240 1241 1242 |
# File 'motion-game', line 1240 def font_size @font_size end |
#text ⇒ String
Returns title of the button.
1231 1232 1233 |
# File 'motion-game', line 1231 def text @text end |
#text_color ⇒ Color
Returns color of the title.
1234 1235 1236 |
# File 'motion-game', line 1234 def text_color @text_color end |
#zoom_scale ⇒ Float
Returns the value with which the button will zoom when the user presses it.
1244 1245 1246 |
# File 'motion-game', line 1244 def zoom_scale @zoom_scale end |