Module: UserInputs
Instance Method Summary collapse
- #on_click(&block) ⇒ Object
- #on_click_do ⇒ Object
-
#on_cursor_down(&block) ⇒ Object
Set callbacks.
-
#on_cursor_down_do ⇒ Object
Execute callbacks.
- #on_cursor_left(&block) ⇒ Object
- #on_cursor_left_do ⇒ Object
- #on_cursor_right(&block) ⇒ Object
- #on_cursor_right_do ⇒ Object
- #on_cursor_up(&block) ⇒ Object
- #on_cursor_up_do ⇒ Object
- #on_mouse_button_left(&block) ⇒ Object
- #on_mouse_button_left_do ⇒ Object
- #on_space_bar(&block) ⇒ Object
- #on_space_bar_do ⇒ Object
Instance Method Details
#on_click(&block) ⇒ Object
29 30 31 |
# File 'lib/fantasy/includes/user_inputs.rb', line 29 def on_click(&block) @on_click_callback = block end |
#on_click_do ⇒ Object
58 59 60 61 |
# File 'lib/fantasy/includes/user_inputs.rb', line 58 def on_click_do puts "XXX: on_click_do: #{@on_click_callback}" instance_exec(&@on_click_callback) unless @on_click_callback.nil? end |
#on_cursor_down(&block) ⇒ Object
Set callbacks
5 6 7 |
# File 'lib/fantasy/includes/user_inputs.rb', line 5 def on_cursor_down(&block) @on_cursor_down_callback = block end |
#on_cursor_down_do ⇒ Object
Execute callbacks
34 35 36 |
# File 'lib/fantasy/includes/user_inputs.rb', line 34 def on_cursor_down_do instance_exec(&@on_cursor_down_callback) unless @on_cursor_down_callback.nil? end |
#on_cursor_left(&block) ⇒ Object
13 14 15 |
# File 'lib/fantasy/includes/user_inputs.rb', line 13 def on_cursor_left(&block) @on_cursor_left_callback = block end |
#on_cursor_left_do ⇒ Object
42 43 44 |
# File 'lib/fantasy/includes/user_inputs.rb', line 42 def on_cursor_left_do instance_exec(&@on_cursor_left_callback) unless @on_cursor_left_callback.nil? end |
#on_cursor_right(&block) ⇒ Object
17 18 19 |
# File 'lib/fantasy/includes/user_inputs.rb', line 17 def on_cursor_right(&block) @on_cursor_right_callback = block end |
#on_cursor_right_do ⇒ Object
46 47 48 |
# File 'lib/fantasy/includes/user_inputs.rb', line 46 def on_cursor_right_do instance_exec(&@on_cursor_right_callback) unless @on_cursor_right_callback.nil? end |
#on_cursor_up(&block) ⇒ Object
9 10 11 |
# File 'lib/fantasy/includes/user_inputs.rb', line 9 def on_cursor_up(&block) @on_cursor_up_callback = block end |
#on_cursor_up_do ⇒ Object
38 39 40 |
# File 'lib/fantasy/includes/user_inputs.rb', line 38 def on_cursor_up_do instance_exec(&@on_cursor_up_callback) unless @on_cursor_up_callback.nil? end |
#on_mouse_button_left(&block) ⇒ Object
25 26 27 |
# File 'lib/fantasy/includes/user_inputs.rb', line 25 def (&block) @on_mouse_button_left_callback = block end |
#on_mouse_button_left_do ⇒ Object
54 55 56 |
# File 'lib/fantasy/includes/user_inputs.rb', line 54 def instance_exec(&@on_mouse_button_left_callback) unless @on_mouse_button_left_callback.nil? end |
#on_space_bar(&block) ⇒ Object
21 22 23 |
# File 'lib/fantasy/includes/user_inputs.rb', line 21 def (&block) @on_space_bar_callback = block end |
#on_space_bar_do ⇒ Object
50 51 52 |
# File 'lib/fantasy/includes/user_inputs.rb', line 50 def instance_exec(&@on_space_bar_callback) unless @on_space_bar_callback.nil? end |