Added joypad events and changed event handling complexity from O(n) to O(1)

http://stackoverflow.com/questions/11445226/better-optimization-technique-using-if-else-or-dictionary