Class: Rubydraw::EventQueue

Inherits:
Object show all
Defined in:
lib/rubydraw/event_queue.rb

Overview

Rubydraw uses an EventQueue to collect SDL events, e.g. mouse movements keystrokes, and window actions. A new EventQueue is automatically created when a Rubydraw::Window is initialized. Every tick, the window asks its event queue (created in Rubydraw::Window#initialize) for the new events

Instance Method Summary collapse

Instance Method Details

#get_eventsObject

Get all the new events



8
9
10
11
12
13
14
# File 'lib/rubydraw/event_queue.rb', line 8

def get_events
  events = []
  until((event = SDL::PollEvent()).nil?)
    events << Events.match(event)
  end
  events
end