Module Rubygame::EventTriggers
In: lib/rubygame/event_triggers.rb

This module contains all the event trigger classes that come with Rubygame.

An event trigger class is simply a class which can be used as a trigger an EventHook. The trigger is used to determine whether the EventHook matches a particular event that occurs.

The only requirement for an event trigger is this:

  • It must have a match? method which takes exactly one argument (an event) and always returns either true or false.

You can make your own custom event trigger classes and use them in an EventHook if they meet that requirement.

NOTE: The match? method may be called many times every second, even if there is no matching event. So, you should try to keep the method simple and fast, to have the least impact on your game’s framerate.

Here is an overview of the event trigger classes that come with Rubygame as of version 2.5:

AndTrigger:Holds multiple other triggers, and matches if ALL of the triggers match the event.
OrTrigger:Holds multiple other triggers, and matches if ONE OR MORE of the triggers match the event.
AttrTrigger:Matches if the event’s attributes have the expected values.
BlockTrigger:Passes the event to a custom code block to check whether it matches.
InstanceOfTrigger:Matches if the event is an instance of a particular class.
KeyPressTrigger:Matches certain KeyPressed events.
KeyReleaseTrigger:Matches certain KeyReleased events.
KindOfTrigger:Matches if the event is kind_of? a particular class or module.
MousePressTrigger:Matches certain MousePressed events.
MouseMoveTrigger:Matches certain MouseMoved events.
MouseReleaseTrigger:Matches certain MouseReleased events.
TickTrigger:Matches ClockTicked events.
YesTrigger:Matches every event, no matter what.

Classes and Modules

Class Rubygame::EventTriggers::AndTrigger
Class Rubygame::EventTriggers::AttrTrigger
Class Rubygame::EventTriggers::BlockTrigger
Class Rubygame::EventTriggers::InstanceOfTrigger
Class Rubygame::EventTriggers::KeyPressTrigger
Class Rubygame::EventTriggers::KeyReleaseTrigger
Class Rubygame::EventTriggers::KindOfTrigger
Class Rubygame::EventTriggers::MouseMoveTrigger
Class Rubygame::EventTriggers::MousePressTrigger
Class Rubygame::EventTriggers::MouseReleaseTrigger
Class Rubygame::EventTriggers::OrTrigger
Class Rubygame::EventTriggers::TickTrigger
Class Rubygame::EventTriggers::YesTrigger

[Validate]