Gamepad Functions
From Archaic Pixels
Contents
Gamepad Functions
joy
??? joy(char num); |
---|
Return the current status of joypad number 'num'. Since version 1.5, it's 6 button compliant. |
joytrg
??? joytrg(char num); |
---|
Return informations about newly pressed buttons and directions of joypad number 'num'. But beware of this function, these informations are refreshed every frame, so if your game loop is not fast enough you could miss some keypresses. In such a case use the joy_events() functions, they do keep trace of all the keypresses. |
set_joy_callback
void set_joy_callback(char num, char mask, char keys, void (*proc)()); |
---|
You can program the library to call one of your function when a certain joypad key as been pressed. The best use of this function is to handle game pause mode when the player press the START button. 'num' is the numero of the callback to install, for now there's only one callback (0), but future versions of the library may have more. 'mask' indicates which joypad to scan (one bit for each joypad, with bit 0 for joypad 0, etc...), and 'keys' indicates which keypresses to look, usualy just JOY_STRT. 'proc' is the address of the function you want to be called by the library. Extended Documentation |
get_joy_events
??? get_joy_events(char num); |
---|
??? get_joy_events(char num, char rst); |
Return all the joypad keypresses for joypad 'num' that has happened since this function was last called. With this function you can't miss any keypress. 'rst' tells the function if the keypress events will be reset after having being read, by default they are reset after each read, but if 'rst' is equal to zero events won't be reset. |
clear_joy_events
void clear_joy_events(char mask); |
---|
Reset the joypad keypress event list(s). 'mask' indicates which joypad event list you want to reset. One bit for each joypad, bit 0 is joypad 0, bit 1 is joypad 1, etc... All the event lists can be reset by setting 'mask' to 0x1F. |