Added proper event loop, provided better native event handling options.

- The engine will now emit a events.process_native events to which every
  module that has to handle native events can listen in order to know
  when it should process those.
- The event loop is now in-engine.
- Event types no longer have to be predefined - it proved to be mainly a
  pain in the ass.
Merged upstream.