struct CrystGLFW::Event::WindowKey

Overview

A WindowKeyEvent is generated by the Window#on_key callback and contains a Key along with an interface to determine what action occurred with the key.

Included Modules

Defined in:

crystglfw/events/window_key.cr

Instance Method Summary

Instance methods inherited from module CrystGLFW::Event::Modifiers

alt? alt?, control? control?, shift? shift?, super? super?

Constructor methods inherited from struct CrystGLFW::Event::Any

new new

Instance Method Detail

def key : CrystGLFW::Key #

[View source]
def press? #

Returns true if the key was pressed. False otherwise.

window.on_key do |key_event|
  puts "a key was pressed." if key_event.press?
end

[View source]
def release? #

Returns true if the key was released. False otherwise.

window.on_key do |key_event|
  puts "a key was released." if key_event.release?
end

[View source]
def repeat? #

Returns true if the key was held down. False otherwise.

window.on_key do |key_event|
  puts "a key was held down." if key_event.repeat?
end

[View source]
def window : CrystGLFW::Window #

[View source]