I included the source and an executable for an input wrapper that I'm currently developing. Unfortunately, I do not have a gamepad to test out joystick compatibility, but this is similarly to how I programmed joystick code in other languages before.
Basically, its a wrapper for both the keyboard and joystick functions. I wrote a UDT that is stored in a multidimensional array. This array allows you to store values for multiple players and for multiple buttons, there is an example in the code for a basic controller (UP, DOWN, LEFT, RIGHT, SELECT, A, B)
Within said multidimensional array, you can apply values to read keys from the keyboard as well as from the joystick. Updating the array once a frame, allows you to get data stating whether or not said button press is held.
if PlayerButtonHeld(0, INPUT_UP)
print "holding up"
endif
Shows that if player 0 is holding up, then print "holding up" to the screen. It doesn't matter whether or not the person is using a keyboard or joystick, just run this code and it will return 0 for false or 1 for true.
if PlayerButtonReleased(0, INPUT_UP)
print "released up"
endif
This here shows whether or not a button was released. For instance, if you wanted to do something specific when the player let go of UP, then you can test this. 1 for just released, 0 for false.
In addition, I also supplied a basic function to test to see whether or not a button on the keyboard was pressed, regardless of other keymappings. This includes HELD and RELEASED, so this way you could do a name select screen and add a value to a string depending on which keys were just RELEASED.
I still need to add more functionality, but I only just wrote this in the last couple of hours, but I find it neat for now.
EDIT: To get a character from a scancode, visit: http://forum.thegamecreators.com/?m=forum_view&t=167362&b=1
I'm not sure if there are any problems with this when using an international keyboard layout, but if checking the returned character against a predefined list of characters ("A-Z, space, etc") it should work