Class: Rubydraw::Events::KeyboardEvent

Inherits:
Event show all
Defined in:
lib/rubydraw/events.rb

Overview

Provides methods used in both Rubydraw::Events::KeyPressed and Rubydraw::Events::KeyReleased. No instances of this class should be created, but instances of subclasses are fine.

Direct Known Subclasses

KeyPressed, KeyReleased

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Event

#event?, matches?, matching_sdl_type

Constructor Details

#initialize(key) ⇒ KeyboardEvent

Returns a new instance of KeyboardEvent.



95
96
97
# File 'lib/rubydraw/events.rb', line 95

def initialize(key)
  @key = key
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



93
94
95
# File 'lib/rubydraw/events.rb', line 93

def key
  @key
end

Class Method Details

.from_sdl_event(sdl_event) ⇒ Object



89
90
91
# File 'lib/rubydraw/events.rb', line 89

def self.from_sdl_event(sdl_event)
  self.new(sdl_event.keysym.sym)
end

.wants_to_match?Boolean

Returns:

  • (Boolean)


85
86
87
# File 'lib/rubydraw/events.rb', line 85

def self.wants_to_match?
  false
end