| Class | Rubygame::Queue |
| In: |
lib/rubygame/queue.rb
ext/rubygame/rubygame_transform.c |
| Parent: | Object |
(Note: I‘m not putting much effort into documenting the current Queue class, because it is going to be changing substantially in the next version. It is mostly usable for now, but neither elegant nor fun to use. Frankly, I think it‘s an abomination, and it took all my willpower to put off rewriting it until next version.)
Queue provides an interface to SDL‘s events, allowing the application to detect keyboard presses, mouse movements and clicks, joystick movement, etc.
The full list of default events is:
You are allowed to create new child classes of Event and post them to the Queue, but for now you would probably be better off using some other data structure to hold your own events. I recommend checking out the queue class in Ruby‘s stardard library.
P.S. Queue is a singleton, so you must use Queue.instance, not Queue.new.
Allow the given event classes. Returns all event classes that had previously been disallowed, but are now allowed.
Allow ONLY the given event classes. Returns all event classes that had previously been disallowed, but are now allowed.
Disallow the given event classes from being posted. Returns all classes which had previously been allowed, but are now disallowed.
Get all events currently in the Queue which match the classes in the Array klasses, and return them in an Array. If klasses is omitted, returns all
Events which did not match will remain on the Queue, so make sure you eventually get every class of events that is allowed, or they might build up in the Queue.)
Waits until an event matching the classes in Array klasses occurs, then return that event. All non-matching events will be discarded in the meantime.
If klasses is omitted, ANY event class allowed by the Queue will trigger return. (Important: omitting klasses is not the same as giving nil.)
klasses is an Array of the Event classes which will trigger this method to return. Any classes which are blocked by the Queue or are not Rubygame-generated hardware events will be stripped from klasses.
If klasses is given, but does not contain any valid classes, this method will immediately return nil.