Method: Ruby2D::Window#mouse_callback
- Defined in:
- lib/ruby2d/window.rb
#mouse_callback(type, button, direction, x, y, delta_x, delta_y) ⇒ Object
Mouse callback method, called by the native and web extentions
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 |
# File 'lib/ruby2d/window.rb', line 387 def mouse_callback(type, , direction, x, y, delta_x, delta_y) # All mouse events @events[:mouse].each do |_id, e| e.call(MouseEvent.new(type, , direction, x, y, delta_x, delta_y)) end case type # When mouse button pressed when :down _handle_mouse_down type, , x, y # When mouse button released when :up _handle_mouse_up type, , x, y # When mouse motion / movement when :scroll _handle_mouse_scroll type, direction, delta_x, delta_y # When mouse scrolling, wheel or trackpad when :move _handle_mouse_move type, x, y, delta_x, delta_y end end |