Class Rubygame::EventTriggers::MouseMoveTrigger
In: lib/rubygame/event_triggers.rb
Parent: Object

MouseMoveTrigger is an event trigger which fires when the mouse cursor is moved (MouseMoved). If buttons are given, it only matches events with those buttons. See new for details.


match?   new  

Public Class methods

Create a new instance of MouseMoveTrigger.

The buttons parameter determines which mouse buttons can be held down and still match this trigger. It can be one of:

  1. :any. Matches if zero or more buttons are held.
  2. :none. Matches when zero buttons are being held.
  3. :mouse_left, etc. Matches when at least the given button is being held.
  4. An array of :mouse_* symbols. Matches when exactly all buttons in the Array are being held, and nothing else.


   # Matches all MouseMoved events, regardless of buttons: :any )

   # Matches only if no buttons pressed: :none ) [] )

   # Matches if left mouse is held down, maybe with others: :mouse_left )

   # Matches if ONLY left mouse held down, nothing else: [:mouse_left] )

   # Matches if BOTH left AND right mouse are held down, nothing else: [:mouse_left, :mouse_right] )

   # Matches if EITHER left OR right mouse are held down:,


# File lib/rubygame/event_triggers.rb, line 594
        def initialize( buttons=:any )
                @buttons = buttons

Public Instance methods

Returns true if the given event matches this trigger. See new for information about how events match.


# File lib/rubygame/event_triggers.rb, line 602
        def match?( event )
                if event.kind_of?( Rubygame::Events::MouseMoved )
                        ((@buttons == :any) or 
                         (@buttons == :none and event.buttons == []) or 
                         (_buttons_match?(event.buttons)) or