struct CrystGLFW::Event::WindowKey
- CrystGLFW::Event::WindowKey
- CrystGLFW::Event::Any
- Struct
- Value
- Object
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.crInstance Method Summary
- #key : CrystGLFW::Key
-
#press?
Returns true if the key was pressed.
-
#release?
Returns true if the key was released.
-
#repeat?
Returns true if the key was held down.
- #window : CrystGLFW::Window
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 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
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
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