X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=include%2Fjoystick.h;h=26f339fe4f392227accca399d7f35ee8d424a881;hb=7f52a770d9c6a43dde67689032bb3a4848eb6b30;hp=710d9b5a6b65852ae65101a72647a0888388f763;hpb=0390c34e88e9512b81ce35a9ba36d137d1c80c44;p=cc65 diff --git a/include/joystick.h b/include/joystick.h index 710d9b5a6..26f339fe4 100644 --- a/include/joystick.h +++ b/include/joystick.h @@ -52,27 +52,18 @@ #define JOY_ERR_NO_DEVICE 4 /* Device (hardware) not found */ /* Argument for the joy_read function */ -#define JOY_1 0 -#define JOY_2 1 - -/* The following codes are *indices* into the joy_masks array */ -#define JOY_UP 0 -#define JOY_DOWN 1 -#define JOY_LEFT 2 -#define JOY_RIGHT 3 -#define JOY_FIRE 4 -#define JOY_FIRE2 5 /* Second fire button if available */ - -/* Array of masks used to check the return value of joy_read for a state */ -extern const unsigned char joy_masks[8]; +#define JOY_1 0 +#define JOY_2 1 /* Macros that evaluate the return code of joy_read */ -#define JOY_BTN_UP(v) ((v) & joy_masks[JOY_UP]) -#define JOY_BTN_DOWN(v) ((v) & joy_masks[JOY_DOWN]) -#define JOY_BTN_LEFT(v) ((v) & joy_masks[JOY_LEFT]) -#define JOY_BTN_RIGHT(v) ((v) & joy_masks[JOY_RIGHT]) -#define JOY_BTN_FIRE(v) ((v) & joy_masks[JOY_FIRE]) -#define JOY_BTN_FIRE2(v) ((v) & joy_masks[JOY_FIRE2]) +#define JOY_UP(v) ((v) & JOY_UP_MASK) +#define JOY_DOWN(v) ((v) & JOY_DOWN_MASK) +#define JOY_LEFT(v) ((v) & JOY_LEFT_MASK) +#define JOY_RIGHT(v) ((v) & JOY_RIGHT_MASK) +#define JOY_BTN_1(v) ((v) & JOY_BTN_1_MASK) /* Universally available */ +#define JOY_BTN_2(v) ((v) & JOY_BTN_2_MASK) /* Second button if available */ +#define JOY_BTN_3(v) ((v) & JOY_BTN_3_MASK) /* Third button if available */ +#define JOY_BTN_4(v) ((v) & JOY_BTN_4_MASK) /* Fourth button if available */ /* The name of the standard joystick driver for a platform */ extern const char joy_stddrv[];