input handler working for keyboard and PS3 controller