Class Rubygame::MouseDownEvent
In: lib/rubygame/event.rb
Parent: Rubygame::Event

Indicates that a mouse button was pressed.

This event has these attributes:

string:string indicating the button that was pressed (“left”,“middle”, or “right”).
pos:the position of the mouse cursor when the button was pressed, in the form [x,y].
button:the mouse button that was pressed; one of these constants in module Rubygame (or the corresponding button number):
MOUSE_LEFT:1; left mouse button
MOUSE_MIDDLE:2; middle mouse button
MOUSE_RIGHT:3; right mouse button

Methods

new  

Attributes

button  [RW] 
pos  [RW] 
string  [RW] 

Public Class methods

[Source]

# File lib/rubygame/event.rb, line 275
                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 MouseDownEvent.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

[Validate]