]> git.sur5r.net Git - cc65/blobdiff - include/joystick.h
Removed a "cc65_" prefix.
[cc65] / include / joystick.h
index 710d9b5a6b65852ae65101a72647a0888388f763..b6771c38158cf2eec3b7159981fb52b24b7c910c 100644 (file)
 
 
 
+#include <target.h>
+
+
+
 /*****************************************************************************/
 /*                                  Definitions                              */
 /*****************************************************************************/
 #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[];
@@ -112,6 +107,3 @@ unsigned char __fastcall__ joy_read (unsigned char joystick);
 
 /* End of joystick.h */
 #endif
-
-
-