Added code for event handling in renderer

* Now the emulator works fully