Redevelop GLFW 2 code

It should still be compatible with the old version. Added a few
things that were missing before, such as joystick support.
First crack at GLFW 3 support