/*
* call-seq:
* fetch_sdl_events -> [Event, ...]
*
* Retrieves all pending events from SDL's event stack and converts them
* into Rubygame Event objects. Returns an Array of all the events, in
* the order they were read.
*
* This method is used by the EventQueue class, so don't call it if you are
* using EventQueue for event management! If you do, the EventQueue will not
* receive all the events, because they will have been removed from SDL's
* event stack by this method.
*
* However, if you aren't using EventQueue, you can safely use this method
* to make your own event management system.
*/
VALUE rbgm_fetchevents(VALUE self)
{
SDL_Event event;
VALUE event_array;
event_array = rb_ary_new();
/* put each in *event until no pending events are in SDL's queue */
/* for now, we don't care what type the event in. Filtering comes later */
while(SDL_PollEvent(&event)==1)
{
rb_ary_push(event_array, rbgm_convert_sdlevent(event) );
}
return event_array;
}