on_scroll

The on_scroll method defines callback behavior that is triggered when the user scrolls while a Window has input focus. It generates a CrystGLFW::Event::WindowScroll that is yielded to the block:

window = Window.new

window.on_scroll do |event|
  puts "scroll offset: #{event.offset}"
end

With this callback defined, every time the user scrolls while window has input focus, the scroll offset is printed to standard output.

on_scroll must be called from within a run block definition.

results matching ""

    No results matching ""