On a raspberry pi there are many ways to connect buttons to it, but the two easiest ways are either using the Raspberry Pi's GPIO pins as button presses or using a usb hid device device like a teensy or arduino pro micro.
Benefits of using the Raspberry Pi's GPIO pins is it's free and uses less power. Downside you are stuck with only digital buttons (no analog joystick) unless you add additional hardware like a comparator or analog to digital converter. Here is an easy video tutorial to set up buttons using the gpio pins
GPIOnext
Benefits of using a teensy or arduino you can easily set up both analog joysticks and digital buttons. Downside additional hardware, higher power consumption, and takes up an usb port on the Pi. Here is a good video tutorial if you choose to go this route
Arduino Gamepad