Mercurial > sdl-ios-xcode
annotate src/joystick/SDL_joystick.c @ 5135:5f09cb749d75
Added vim spacing hints
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 01 Feb 2011 09:00:47 -0800 |
parents | dc0dfdd58f27 |
children | b530ef003506 |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
3697 | 3 Copyright (C) 1997-2010 Sam Lantinga |
0 | 4 |
5 This library is free software; you can redistribute it and/or | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
0 | 7 License as published by the Free Software Foundation; either |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
0 | 9 |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
13 Lesser General Public License for more details. |
0 | 14 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
0 | 18 |
19 Sam Lantinga | |
252
e8157fcb3114
Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
0
diff
changeset
|
20 slouken@libsdl.org |
0 | 21 */ |
1402
d910939febfa
Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents:
1379
diff
changeset
|
22 #include "SDL_config.h" |
0 | 23 |
24 /* This is the joystick API for Simple DirectMedia Layer */ | |
25 | |
26 #include "SDL_events.h" | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
27 #include "SDL_sysjoystick.h" |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
28 #include "SDL_joystick_c.h" |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
29 #if !SDL_EVENTS_DISABLED |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
30 #include "../events/SDL_events_c.h" |
0 | 31 #endif |
32 | |
33 Uint8 SDL_numjoysticks = 0; | |
34 SDL_Joystick **SDL_joysticks = NULL; | |
35 static SDL_Joystick *default_joystick = NULL; | |
36 | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
37 int |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
38 SDL_JoystickInit(void) |
0 | 39 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
40 int arraylen; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
41 int status; |
0 | 42 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
43 SDL_numjoysticks = 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
44 status = SDL_SYS_JoystickInit(); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
45 if (status >= 0) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
46 arraylen = (status + 1) * sizeof(*SDL_joysticks); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
47 SDL_joysticks = (SDL_Joystick **) SDL_malloc(arraylen); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
48 if (SDL_joysticks == NULL) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
49 SDL_numjoysticks = 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
50 } else { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
51 SDL_memset(SDL_joysticks, 0, arraylen); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
52 SDL_numjoysticks = status; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
53 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
54 status = 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
55 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
56 default_joystick = NULL; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
57 return (status); |
0 | 58 } |
59 | |
60 /* | |
61 * Count the number of joysticks attached to the system | |
62 */ | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
63 int |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
64 SDL_NumJoysticks(void) |
0 | 65 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
66 return SDL_numjoysticks; |
0 | 67 } |
68 | |
69 /* | |
70 * Get the implementation dependent name of a joystick | |
71 */ | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
72 const char * |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
73 SDL_JoystickName(int device_index) |
0 | 74 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
75 if ((device_index < 0) || (device_index >= SDL_numjoysticks)) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
76 SDL_SetError("There are %d joysticks available", SDL_numjoysticks); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
77 return (NULL); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
78 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
79 return (SDL_SYS_JoystickName(device_index)); |
0 | 80 } |
81 | |
82 /* | |
83 * Open a joystick for use - the index passed as an argument refers to | |
84 * the N'th joystick on the system. This index is the value which will | |
85 * identify this joystick in future joystick events. | |
86 * | |
87 * This function returns a joystick identifier, or NULL if an error occurred. | |
88 */ | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
89 SDL_Joystick * |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
90 SDL_JoystickOpen(int device_index) |
0 | 91 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
92 int i; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
93 SDL_Joystick *joystick; |
0 | 94 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
95 if ((device_index < 0) || (device_index >= SDL_numjoysticks)) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
96 SDL_SetError("There are %d joysticks available", SDL_numjoysticks); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
97 return (NULL); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
98 } |
0 | 99 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
100 /* If the joystick is already open, return it */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
101 for (i = 0; SDL_joysticks[i]; ++i) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
102 if (device_index == SDL_joysticks[i]->index) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
103 joystick = SDL_joysticks[i]; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
104 ++joystick->ref_count; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
105 return (joystick); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
106 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
107 } |
0 | 108 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
109 /* Create and initialize the joystick */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
110 joystick = (SDL_Joystick *) SDL_malloc((sizeof *joystick)); |
3608
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
111 if (joystick == NULL) { |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
112 SDL_OutOfMemory(); |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
113 return NULL; |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
114 } |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
115 |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
116 SDL_memset(joystick, 0, (sizeof *joystick)); |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
117 joystick->index = device_index; |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
118 if (SDL_SYS_JoystickOpen(joystick) < 0) { |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
119 SDL_free(joystick); |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
120 return NULL; |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
121 } |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
122 if (joystick->naxes > 0) { |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
123 joystick->axes = (Sint16 *) SDL_malloc |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
124 (joystick->naxes * sizeof(Sint16)); |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
125 } |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
126 if (joystick->nhats > 0) { |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
127 joystick->hats = (Uint8 *) SDL_malloc |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
128 (joystick->nhats * sizeof(Uint8)); |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
129 } |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
130 if (joystick->nballs > 0) { |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
131 joystick->balls = (struct balldelta *) SDL_malloc |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
132 (joystick->nballs * sizeof(*joystick->balls)); |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
133 } |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
134 if (joystick->nbuttons > 0) { |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
135 joystick->buttons = (Uint8 *) SDL_malloc |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
136 (joystick->nbuttons * sizeof(Uint8)); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
137 } |
3608
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
138 if (((joystick->naxes > 0) && !joystick->axes) |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
139 || ((joystick->nhats > 0) && !joystick->hats) |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
140 || ((joystick->nballs > 0) && !joystick->balls) |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
141 || ((joystick->nbuttons > 0) && !joystick->buttons)) { |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
142 SDL_OutOfMemory(); |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
143 SDL_JoystickClose(joystick); |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
144 return NULL; |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
145 } |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
146 if (joystick->axes) { |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
147 SDL_memset(joystick->axes, 0, joystick->naxes * sizeof(Sint16)); |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
148 } |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
149 if (joystick->hats) { |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
150 SDL_memset(joystick->hats, 0, joystick->nhats * sizeof(Uint8)); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
151 } |
3608
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
152 if (joystick->balls) { |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
153 SDL_memset(joystick->balls, 0, |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
154 joystick->nballs * sizeof(*joystick->balls)); |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
155 } |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
156 if (joystick->buttons) { |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
157 SDL_memset(joystick->buttons, 0, joystick->nbuttons * sizeof(Uint8)); |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
158 } |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
159 |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
160 /* Add joystick to list */ |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
161 ++joystick->ref_count; |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
162 for (i = 0; SDL_joysticks[i]; ++i) |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
163 /* Skip to next joystick */ ; |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
164 SDL_joysticks[i] = joystick; |
a5a37f850d83
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
Ryan C. Gordon <icculus@icculus.org>
parents:
3369
diff
changeset
|
165 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
166 return (joystick); |
0 | 167 } |
168 | |
169 /* | |
170 * Returns 1 if the joystick has been opened, or 0 if it has not. | |
171 */ | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
172 int |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
173 SDL_JoystickOpened(int device_index) |
0 | 174 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
175 int i, opened; |
0 | 176 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
177 opened = 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
178 for (i = 0; SDL_joysticks[i]; ++i) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
179 if (SDL_joysticks[i]->index == (Uint8) device_index) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
180 opened = 1; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
181 break; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
182 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
183 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
184 return (opened); |
0 | 185 } |
186 | |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
187 |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
188 /* |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
189 * Checks to make sure the joystick is valid. |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
190 */ |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
191 int |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
192 SDL_PrivateJoystickValid(SDL_Joystick ** joystick) |
0 | 193 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
194 int valid; |
0 | 195 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
196 if (*joystick == NULL) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
197 *joystick = default_joystick; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
198 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
199 if (*joystick == NULL) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
200 SDL_SetError("Joystick hasn't been opened yet"); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
201 valid = 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
202 } else { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
203 valid = 1; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
204 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
205 return valid; |
0 | 206 } |
207 | |
208 /* | |
209 * Get the device index of an opened joystick. | |
210 */ | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
211 int |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
212 SDL_JoystickIndex(SDL_Joystick * joystick) |
0 | 213 { |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
214 if (!SDL_PrivateJoystickValid(&joystick)) { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
215 return (-1); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
216 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
217 return (joystick->index); |
0 | 218 } |
219 | |
220 /* | |
221 * Get the number of multi-dimensional axis controls on a joystick | |
222 */ | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
223 int |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
224 SDL_JoystickNumAxes(SDL_Joystick * joystick) |
0 | 225 { |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
226 if (!SDL_PrivateJoystickValid(&joystick)) { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
227 return (-1); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
228 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
229 return (joystick->naxes); |
0 | 230 } |
231 | |
232 /* | |
233 * Get the number of hats on a joystick | |
234 */ | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
235 int |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
236 SDL_JoystickNumHats(SDL_Joystick * joystick) |
0 | 237 { |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
238 if (!SDL_PrivateJoystickValid(&joystick)) { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
239 return (-1); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
240 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
241 return (joystick->nhats); |
0 | 242 } |
243 | |
244 /* | |
245 * Get the number of trackballs on a joystick | |
246 */ | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
247 int |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
248 SDL_JoystickNumBalls(SDL_Joystick * joystick) |
0 | 249 { |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
250 if (!SDL_PrivateJoystickValid(&joystick)) { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
251 return (-1); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
252 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
253 return (joystick->nballs); |
0 | 254 } |
255 | |
256 /* | |
257 * Get the number of buttons on a joystick | |
258 */ | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
259 int |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
260 SDL_JoystickNumButtons(SDL_Joystick * joystick) |
0 | 261 { |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
262 if (!SDL_PrivateJoystickValid(&joystick)) { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
263 return (-1); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
264 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
265 return (joystick->nbuttons); |
0 | 266 } |
267 | |
268 /* | |
269 * Get the current state of an axis control on a joystick | |
270 */ | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
271 Sint16 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
272 SDL_JoystickGetAxis(SDL_Joystick * joystick, int axis) |
0 | 273 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
274 Sint16 state; |
0 | 275 |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
276 if (!SDL_PrivateJoystickValid(&joystick)) { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
277 return (0); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
278 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
279 if (axis < joystick->naxes) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
280 state = joystick->axes[axis]; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
281 } else { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
282 SDL_SetError("Joystick only has %d axes", joystick->naxes); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
283 state = 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
284 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
285 return (state); |
0 | 286 } |
287 | |
288 /* | |
289 * Get the current state of a hat on a joystick | |
290 */ | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
291 Uint8 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
292 SDL_JoystickGetHat(SDL_Joystick * joystick, int hat) |
0 | 293 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
294 Uint8 state; |
0 | 295 |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
296 if (!SDL_PrivateJoystickValid(&joystick)) { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
297 return (0); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
298 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
299 if (hat < joystick->nhats) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
300 state = joystick->hats[hat]; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
301 } else { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
302 SDL_SetError("Joystick only has %d hats", joystick->nhats); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
303 state = 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
304 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
305 return (state); |
0 | 306 } |
307 | |
308 /* | |
309 * Get the ball axis change since the last poll | |
310 */ | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
311 int |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
312 SDL_JoystickGetBall(SDL_Joystick * joystick, int ball, int *dx, int *dy) |
0 | 313 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
314 int retval; |
0 | 315 |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
316 if (!SDL_PrivateJoystickValid(&joystick)) { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
317 return (-1); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
318 } |
0 | 319 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
320 retval = 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
321 if (ball < joystick->nballs) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
322 if (dx) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
323 *dx = joystick->balls[ball].dx; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
324 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
325 if (dy) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
326 *dy = joystick->balls[ball].dy; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
327 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
328 joystick->balls[ball].dx = 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
329 joystick->balls[ball].dy = 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
330 } else { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
331 SDL_SetError("Joystick only has %d balls", joystick->nballs); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
332 retval = -1; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
333 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
334 return (retval); |
0 | 335 } |
336 | |
337 /* | |
338 * Get the current state of a button on a joystick | |
339 */ | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
340 Uint8 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
341 SDL_JoystickGetButton(SDL_Joystick * joystick, int button) |
0 | 342 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
343 Uint8 state; |
0 | 344 |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
345 if (!SDL_PrivateJoystickValid(&joystick)) { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
346 return (0); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
347 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
348 if (button < joystick->nbuttons) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
349 state = joystick->buttons[button]; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
350 } else { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
351 SDL_SetError("Joystick only has %d buttons", joystick->nbuttons); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
352 state = 0; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
353 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
354 return (state); |
0 | 355 } |
356 | |
357 /* | |
358 * Close a joystick previously opened with SDL_JoystickOpen() | |
359 */ | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
360 void |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
361 SDL_JoystickClose(SDL_Joystick * joystick) |
0 | 362 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
363 int i; |
0 | 364 |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
365 if (!SDL_PrivateJoystickValid(&joystick)) { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
366 return; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
367 } |
0 | 368 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
369 /* First decrement ref count */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
370 if (--joystick->ref_count > 0) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
371 return; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
372 } |
0 | 373 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
374 if (joystick == default_joystick) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
375 default_joystick = NULL; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
376 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
377 SDL_SYS_JoystickClose(joystick); |
0 | 378 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
379 /* Remove joystick from list */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
380 for (i = 0; SDL_joysticks[i]; ++i) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
381 if (joystick == SDL_joysticks[i]) { |
3369
71bb88152e3f
Debian patch: 218_joystick_memmove.diff
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
382 SDL_memmove(&SDL_joysticks[i], &SDL_joysticks[i + 1], |
71bb88152e3f
Debian patch: 218_joystick_memmove.diff
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
383 (SDL_numjoysticks - i) * sizeof(joystick)); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
384 break; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
385 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
386 } |
0 | 387 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
388 /* Free the data associated with this joystick */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
389 if (joystick->axes) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
390 SDL_free(joystick->axes); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
391 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
392 if (joystick->hats) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
393 SDL_free(joystick->hats); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
394 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
395 if (joystick->balls) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
396 SDL_free(joystick->balls); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
397 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
398 if (joystick->buttons) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
399 SDL_free(joystick->buttons); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
400 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
401 SDL_free(joystick); |
0 | 402 } |
403 | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
404 void |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
405 SDL_JoystickQuit(void) |
0 | 406 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
407 /* Stop the event polling */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
408 SDL_numjoysticks = 0; |
0 | 409 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
410 /* Quit the joystick setup */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
411 SDL_SYS_JoystickQuit(); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
412 if (SDL_joysticks) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
413 SDL_free(SDL_joysticks); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
414 SDL_joysticks = NULL; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
415 } |
0 | 416 } |
417 | |
418 | |
419 /* These are global for SDL_sysjoystick.c and SDL_events.c */ | |
420 | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
421 int |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
422 SDL_PrivateJoystickAxis(SDL_Joystick * joystick, Uint8 axis, Sint16 value) |
0 | 423 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
424 int posted; |
0 | 425 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
426 /* Update internal joystick state */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
427 joystick->axes[axis] = value; |
0 | 428 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
429 /* Post the event, if desired */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
430 posted = 0; |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
431 #if !SDL_EVENTS_DISABLED |
4429
faa9fc8e7f67
General improvements for user custom event registration
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
432 if (SDL_GetEventState(SDL_JOYAXISMOTION) == SDL_ENABLE) { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
433 SDL_Event event; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
434 event.type = SDL_JOYAXISMOTION; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
435 event.jaxis.which = joystick->index; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
436 event.jaxis.axis = axis; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
437 event.jaxis.value = value; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
438 if ((SDL_EventOK == NULL) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
439 || (*SDL_EventOK) (SDL_EventOKParam, &event)) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
440 posted = 1; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
441 SDL_PushEvent(&event); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
442 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
443 } |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
444 #endif /* !SDL_EVENTS_DISABLED */ |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
445 return (posted); |
0 | 446 } |
447 | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
448 int |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
449 SDL_PrivateJoystickHat(SDL_Joystick * joystick, Uint8 hat, Uint8 value) |
0 | 450 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
451 int posted; |
0 | 452 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
453 /* Update internal joystick state */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
454 joystick->hats[hat] = value; |
0 | 455 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
456 /* Post the event, if desired */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
457 posted = 0; |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
458 #if !SDL_EVENTS_DISABLED |
4429
faa9fc8e7f67
General improvements for user custom event registration
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
459 if (SDL_GetEventState(SDL_JOYHATMOTION) == SDL_ENABLE) { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
460 SDL_Event event; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
461 event.jhat.type = SDL_JOYHATMOTION; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
462 event.jhat.which = joystick->index; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
463 event.jhat.hat = hat; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
464 event.jhat.value = value; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
465 if ((SDL_EventOK == NULL) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
466 || (*SDL_EventOK) (SDL_EventOKParam, &event)) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
467 posted = 1; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
468 SDL_PushEvent(&event); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
469 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
470 } |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
471 #endif /* !SDL_EVENTS_DISABLED */ |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
472 return (posted); |
0 | 473 } |
474 | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
475 int |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
476 SDL_PrivateJoystickBall(SDL_Joystick * joystick, Uint8 ball, |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
477 Sint16 xrel, Sint16 yrel) |
0 | 478 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
479 int posted; |
0 | 480 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
481 /* Update internal mouse state */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
482 joystick->balls[ball].dx += xrel; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
483 joystick->balls[ball].dy += yrel; |
0 | 484 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
485 /* Post the event, if desired */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
486 posted = 0; |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
487 #if !SDL_EVENTS_DISABLED |
4429
faa9fc8e7f67
General improvements for user custom event registration
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
488 if (SDL_GetEventState(SDL_JOYBALLMOTION) == SDL_ENABLE) { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
489 SDL_Event event; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
490 event.jball.type = SDL_JOYBALLMOTION; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
491 event.jball.which = joystick->index; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
492 event.jball.ball = ball; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
493 event.jball.xrel = xrel; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
494 event.jball.yrel = yrel; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
495 if ((SDL_EventOK == NULL) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
496 || (*SDL_EventOK) (SDL_EventOKParam, &event)) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
497 posted = 1; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
498 SDL_PushEvent(&event); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
499 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
500 } |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
501 #endif /* !SDL_EVENTS_DISABLED */ |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
502 return (posted); |
0 | 503 } |
504 | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
505 int |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
506 SDL_PrivateJoystickButton(SDL_Joystick * joystick, Uint8 button, Uint8 state) |
0 | 507 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
508 int posted; |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
509 #if !SDL_EVENTS_DISABLED |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
510 SDL_Event event; |
0 | 511 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
512 switch (state) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
513 case SDL_PRESSED: |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
514 event.type = SDL_JOYBUTTONDOWN; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
515 break; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
516 case SDL_RELEASED: |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
517 event.type = SDL_JOYBUTTONUP; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
518 break; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
519 default: |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
520 /* Invalid state -- bail */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
521 return (0); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
522 } |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
523 #endif /* !SDL_EVENTS_DISABLED */ |
0 | 524 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
525 /* Update internal joystick state */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
526 joystick->buttons[button] = state; |
0 | 527 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
528 /* Post the event, if desired */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
529 posted = 0; |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
530 #if !SDL_EVENTS_DISABLED |
4429
faa9fc8e7f67
General improvements for user custom event registration
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
531 if (SDL_GetEventState(event.type) == SDL_ENABLE) { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
532 event.jbutton.which = joystick->index; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
533 event.jbutton.button = button; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
534 event.jbutton.state = state; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
535 if ((SDL_EventOK == NULL) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
536 || (*SDL_EventOK) (SDL_EventOKParam, &event)) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
537 posted = 1; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
538 SDL_PushEvent(&event); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
539 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
540 } |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
541 #endif /* !SDL_EVENTS_DISABLED */ |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
542 return (posted); |
0 | 543 } |
544 | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
545 void |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
546 SDL_JoystickUpdate(void) |
0 | 547 { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
548 int i; |
0 | 549 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
550 for (i = 0; SDL_joysticks[i]; ++i) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
551 SDL_SYS_JoystickUpdate(SDL_joysticks[i]); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
552 } |
0 | 553 } |
554 | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
555 int |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
556 SDL_JoystickEventState(int state) |
0 | 557 { |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
558 #if SDL_EVENTS_DISABLED |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
559 return SDL_IGNORE; |
0 | 560 #else |
4429
faa9fc8e7f67
General improvements for user custom event registration
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
561 const Uint32 event_list[] = { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
562 SDL_JOYAXISMOTION, SDL_JOYBALLMOTION, SDL_JOYHATMOTION, |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
563 SDL_JOYBUTTONDOWN, SDL_JOYBUTTONUP, |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
564 }; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
565 unsigned int i; |
0 | 566 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
567 switch (state) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
568 case SDL_QUERY: |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
569 state = SDL_IGNORE; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
570 for (i = 0; i < SDL_arraysize(event_list); ++i) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
571 state = SDL_EventState(event_list[i], SDL_QUERY); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
572 if (state == SDL_ENABLE) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
573 break; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
574 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
575 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
576 break; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
577 default: |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
578 for (i = 0; i < SDL_arraysize(event_list); ++i) { |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
579 SDL_EventState(event_list[i], state); |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
580 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
581 break; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
582 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
583 return (state); |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
584 #endif /* SDL_EVENTS_DISABLED */ |
0 | 585 } |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
586 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1612
diff
changeset
|
587 /* vi: set ts=4 sw=4 expandtab: */ |