Class: Rubygame::KeyUpEvent

Inherits:
Event
  • Object
show all
Defined in:
lib/rubygame/event.rb

Overview

Indicates that a keyboard key was released.

See KeyDownEvent.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, mods) ⇒ KeyUpEvent

Returns a new instance of KeyUpEvent.



227
228
229
230
231
232
233
234
235
236
237
238
239
240
# File 'lib/rubygame/event.rb', line 227

def initialize(key,mods)
  if key.kind_of? Integer
    @key = key
    @string = Rubygame.key2str(key, mods) #a string or nil
  elsif key.kind_of? String
    @key = Rubygame::Key::ASCII2KEY[key]
    if @key != nil
      @string = key
    else
      raise(ArgumentError,"First argument of KeyUpEvent.new() must be an Integer KeySym (like K_A) or a ASCII-like String (like \"a\" or \"A\"). Got %s (%s)"%[key,key.class])
    end
  end
  @mods = mods
end

Instance Attribute Details

#keyObject

Returns the value of attribute key.



226
227
228
# File 'lib/rubygame/event.rb', line 226

def key
  @key
end

#modsObject

Returns the value of attribute mods.



226
227
228
# File 'lib/rubygame/event.rb', line 226

def mods
  @mods
end

#stringObject

Returns the value of attribute string.



226
227
228
# File 'lib/rubygame/event.rb', line 226

def string
  @string
end