Retro Game Library Documentation
retrogamelib.button
The button module will check for both key and gamepad presses at the same time. It's extremely easy to use, and quite powerful.
Mapping info
NES/GameBoy |
Keyboard |
Gamepad |
A Button |
Z key |
Button 3 |
B Button |
X key |
Button 2 |
START Button |
Enter/Return |
Button 9 |
SELECT Button |
Right Shift key |
Button 10 |
Up |
Up arrow |
Up Hat |
Down |
Down arrow |
Down Hat |
Left |
Left arrow |
Left Hat |
Right |
Right arrow |
Right Hat |
button.handle_input()
Checks for button presses. Call this in your game loop; without it you'll have no input!
button.is_pressed(button)
Checks to see if a button was just pressed. button
should be any of the button constants.
button.is_held(button)
Checks to see if a button is being held. button
should be any of the button constants.
Copyright © 2009, pymike and saluk