on_char

The on_char method defines callback behavior that is triggered when a character is input while a Window has input focus. It generates a CrystGLFW::Event::WindowChar that is yielded to the block:

window = Window.new

window.on_char do |event|
  puts "user input: #{event.char}"
end

With this callback defined, every time a character is input while window has input focus, the character is printed to standard output.

on_char must be called from within a run block definition.

results matching ""

    No results matching ""