SDL/examples/input/01-joystick-polling
..
joystick-polling.c
README.txt

This example code looks for the current joystick state once per frame,
and draws a visual representation of it.