Module | Rubygame::Events::KeyboardEvent |
In: |
lib/rubygame/events/keyboard_events.rb
|
KeyboardEvent is a mixin module included in the KeyPressed and KeyReleased classes. It defines the key and modifiers accessors.
key | [R] | |
modifiers | [R] |
Initialize the KeyboardEvent.
key: | a key symbol for the key that was pressed or released. (Symbol, required) |
modifiers: | an Array of key symbols for the modifier keys that were active when the event occured. (Array, optional) |
# File lib/rubygame/events/keyboard_events.rb, line 45 def initialize( key, modifiers=[] ) unless key.kind_of? Symbol raise ArgumentError, "key must be a :symbol" end @key = key @modifiers = modifiers.to_ary.dup @modifiers.freeze end