Implemented gamepad support.

Only one gamepad at a time. Still has some rough edges.