Class: Rubygame::ListenerList

Inherits:
Hash
  • Object
show all
Defined in:
lib/xgame.rb

Overview

This class defines an easy way to manage callbacks

Instance Method Summary collapse

Instance Method Details

#addEventListener(event, callback = nil, &block) ⇒ Object



42
43
44
45
46
# File 'lib/xgame.rb', line 42

def addEventListener(event, callback=nil, &block)
	callback = block unless callback
	self[event] = [] unless self.key?event
	self[event] << callback
end