Class: Rubygame::MouseUpEvent

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

Overview

Indicates that a mouse button was released.

See MouseDownEvent.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pos, button) ⇒ MouseUpEvent

Returns a new instance of MouseUpEvent.



296
297
298
299
300
301
302
303
304
305
306
307
308
309
# File 'lib/rubygame/event.rb', line 296

def initialize(pos,button)
	@pos = pos
	if button.kind_of? Integer
		@button = button
		@string = Rubygame::Mouse::MOUSE2STR[button] #a string or nil
	elsif key.kind_of? String
		@button = Rubygame::Mouse::STR2MOUSE[key]
		if @button != nil
			@string = button
		else
			raise(ArgumentError,"First argument of MouseUpEvent.new() must be an Integer Mouse button indentifier (like MOUSE_LEFT) or a String (like \"left\"). Got %s (%s)"%[button,button.class])
		end
	end
end

Instance Attribute Details

#buttonObject

Returns the value of attribute button.



295
296
297
# File 'lib/rubygame/event.rb', line 295

def button
  @button
end

#posObject

Returns the value of attribute pos.



295
296
297
# File 'lib/rubygame/event.rb', line 295

def pos
  @pos
end

#stringObject

Returns the value of attribute string.



295
296
297
# File 'lib/rubygame/event.rb', line 295

def string
  @string
end