]> git.sur5r.net Git - cc65/blob - include/joystick.h
Fixed _textcolor definition.
[cc65] / include / joystick.h
1 /*****************************************************************************/
2 /*                                                                           */
3 /*                                joystick.h                                 */
4 /*                                                                           */
5 /*               Read the joystick on systems that support it                */
6 /*                                                                           */
7 /*                                                                           */
8 /*                                                                           */
9 /* (C) 1998-2011, Ullrich von Bassewitz                                      */
10 /*                Roemerstrasse 52                                           */
11 /*                D-70794 Filderstadt                                        */
12 /* EMail:         uz@cc65.org                                                */
13 /*                                                                           */
14 /*                                                                           */
15 /* This software is provided 'as-is', without any expressed or implied       */
16 /* warranty.  In no event will the authors be held liable for any damages    */
17 /* arising from the use of this software.                                    */
18 /*                                                                           */
19 /* Permission is granted to anyone to use this software for any purpose,     */
20 /* including commercial applications, and to alter it and redistribute it    */
21 /* freely, subject to the following restrictions:                            */
22 /*                                                                           */
23 /* 1. The origin of this software must not be misrepresented; you must not   */
24 /*    claim that you wrote the original software. If you use this software   */
25 /*    in a product, an acknowledgment in the product documentation would be  */
26 /*    appreciated but is not required.                                       */
27 /* 2. Altered source versions must be plainly marked as such, and must not   */
28 /*    be misrepresented as being the original software.                      */
29 /* 3. This notice may not be removed or altered from any source              */
30 /*    distribution.                                                          */
31 /*                                                                           */
32 /*****************************************************************************/
33
34
35
36 #ifndef _JOYSTICK_H
37 #define _JOYSTICK_H
38
39
40
41 #include <target.h>
42
43
44
45 /*****************************************************************************/
46 /*                                  Definitions                              */
47 /*****************************************************************************/
48
49
50
51 /* Error codes */
52 #define JOY_ERR_OK              0       /* No error */
53 #define JOY_ERR_NO_DRIVER       1       /* No driver available */
54 #define JOY_ERR_CANNOT_LOAD     2       /* Error loading driver */
55 #define JOY_ERR_INV_DRIVER      3       /* Invalid driver */
56 #define JOY_ERR_NO_DEVICE       4       /* Device (hardware) not found */
57
58 /* Argument for the joy_read function */
59 #define JOY_1                   0
60 #define JOY_2                   1
61
62 /* Macros that evaluate the return code of joy_read */
63 #define JOY_UP(v)               ((v) & JOY_UP_MASK)
64 #define JOY_DOWN(v)             ((v) & JOY_DOWN_MASK)
65 #define JOY_LEFT(v)             ((v) & JOY_LEFT_MASK)
66 #define JOY_RIGHT(v)            ((v) & JOY_RIGHT_MASK)
67 #define JOY_BTN_1(v)            ((v) & JOY_BTN_1_MASK)      /* Universally available */
68 #define JOY_BTN_2(v)            ((v) & JOY_BTN_2_MASK)      /* Second button if available */
69 #define JOY_BTN_3(v)            ((v) & JOY_BTN_3_MASK)      /* Third button if available  */
70 #define JOY_BTN_4(v)            ((v) & JOY_BTN_4_MASK)      /* Fourth button if available */
71
72 /* The name of the standard joystick driver for a platform */
73 extern const char joy_stddrv[];
74
75 /* The address of the static standard joystick driver for a platform */
76 extern const void joy_static_stddrv[];
77
78
79
80 /*****************************************************************************/
81 /*                                 Functions                                 */
82 /*****************************************************************************/
83
84
85
86 unsigned char __fastcall__ joy_load_driver (const char* driver);
87 /* Load and install a joystick driver. Return an error code. */
88
89 unsigned char joy_unload (void);
90 /* Uninstall, then unload the currently loaded driver. */
91
92 unsigned char __fastcall__ joy_install (void* driver);
93 /* Install an already loaded driver. Return an error code. */
94
95 unsigned char joy_uninstall (void);
96 /* Uninstall the currently loaded driver and return an error code.
97 ** Note: This call does not free allocated memory.
98 */
99
100 unsigned char joy_count (void);
101 /* Return the number of joysticks supported by the driver */
102
103 unsigned char __fastcall__ joy_read (unsigned char joystick);
104 /* Read a particular joystick */
105
106
107
108 /* End of joystick.h */
109 #endif