annotate src/joystick/nds/SDL_sysjoystick.c @ 4834:fd5bb97ec05d

Improving Cocoa implementation and fixed a small bug in SDL_shape.c.
author egottlieb
date Thu, 05 Aug 2010 18:58:45 -0400
parents f7b03b6838cb
children bb2e32f5a556
rev   line source
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
3697
f7b03b6838cb Fixed bug #926
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
3 Copyright (C) 1997-2010 Sam Lantinga
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
3697
f7b03b6838cb Fixed bug #926
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
6 modify it under the terms of the GNU Lesser General Public
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
3697
f7b03b6838cb Fixed bug #926
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3697
f7b03b6838cb Fixed bug #926
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
13 Lesser General Public License for more details.
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
3697
f7b03b6838cb Fixed bug #926
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
15 You should have received a copy of the GNU Lesser General Public
f7b03b6838cb Fixed bug #926
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
16 License along with this library; if not, write to the Free Software
f7b03b6838cb Fixed bug #926
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 Sam Lantinga
3697
f7b03b6838cb Fixed bug #926
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
20 slouken@libsdl.org
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 */
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
22
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23 #include "SDL_config.h"
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 #ifdef SDL_JOYSTICK_NDS
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27 /* This is the system specific header for the SDL joystick API */
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28 #include <nds.h>
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29 #include <stdio.h> /* For the definition of NULL */
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 #include "SDL_error.h"
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 #include "SDL_events.h"
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33 #include "SDL_joystick.h"
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34 #include "SDL_sysjoystick.h"
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 #include "SDL_joystick_c.h"
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37 #include "../../video/nds/SDL_ndsevents_c.h"
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39 /* Function to scan the system for joysticks.
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40 * This function should set SDL_numjoysticks to the number of available
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
41 * joysticks. Joystick 0 should be the system default joystick.
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42 * It should return 0, or -1 on an unrecoverable fatal error.
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43 */
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44 int
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45 SDL_SYS_JoystickInit(void)
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
46 {
2750
e3affc66d963 Fixes to the NDS sprite2 test. Illustrates partially working texture-as-sprite functionality.
Darren Alton <dalton@stevens.edu>
parents: 2749
diff changeset
47 SDL_numjoysticks = 1;
e3affc66d963 Fixes to the NDS sprite2 test. Illustrates partially working texture-as-sprite functionality.
Darren Alton <dalton@stevens.edu>
parents: 2749
diff changeset
48
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
49 return (1);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
50 }
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52 /* Function to get the device-dependent name of a joystick */
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53 const char *
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54 SDL_SYS_JoystickName(int index)
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55 {
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
56 if (!index)
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
57 return "NDS builtin joypad";
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
58 SDL_SetError("No joystick available with that index");
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
59 return (NULL);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
60 }
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62 /* Function to open a joystick for use.
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63 The joystick to open is specified by the index field of the joystick.
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64 This should fill the nbuttons and naxes fields of the joystick structure.
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
65 It returns 0, or -1 if there is an error.
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66 */
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
67 int
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
68 SDL_SYS_JoystickOpen(SDL_Joystick * joystick)
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
69 {
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
70 joystick->nbuttons = 8;
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
71 joystick->nhats = 0;
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
72 joystick->nballs = 0;
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
73 joystick->naxes = 2;
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
74 return 0;
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
75 }
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
76
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
78 /* Function to update the state of a joystick - called as a device poll.
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79 * This function shouldn't update the joystick structure directly,
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80 * but instead should call SDL_PrivateJoystick*() to deliver events
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
81 * and update joystick device state.
2750
e3affc66d963 Fixes to the NDS sprite2 test. Illustrates partially working texture-as-sprite functionality.
Darren Alton <dalton@stevens.edu>
parents: 2749
diff changeset
82 */
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
83 void
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84 SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
85 {
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
86 u32 keysd, keysu;
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
87 int magnitude = 16384;
2750
e3affc66d963 Fixes to the NDS sprite2 test. Illustrates partially working texture-as-sprite functionality.
Darren Alton <dalton@stevens.edu>
parents: 2749
diff changeset
88
e3affc66d963 Fixes to the NDS sprite2 test. Illustrates partially working texture-as-sprite functionality.
Darren Alton <dalton@stevens.edu>
parents: 2749
diff changeset
89 /*scanKeys(); - this is done in PumpEvents, because touch uses it too */
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
90 keysd = keysDown();
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
91 keysu = keysUp();
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
93 if ((keysd & KEY_UP)) {
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 SDL_PrivateJoystickAxis(joystick, 1, -magnitude);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
95 }
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
96 if ((keysd & KEY_DOWN)) {
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
97 SDL_PrivateJoystickAxis(joystick, 1, magnitude);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
98 }
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
99 if ((keysd & KEY_LEFT)) {
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
100 SDL_PrivateJoystickAxis(joystick, 0, -magnitude);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
101 }
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
102 if ((keysd & KEY_RIGHT)) {
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
103 SDL_PrivateJoystickAxis(joystick, 0, magnitude);
2750
e3affc66d963 Fixes to the NDS sprite2 test. Illustrates partially working texture-as-sprite functionality.
Darren Alton <dalton@stevens.edu>
parents: 2749
diff changeset
104 }
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
105
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
106 if ((keysu & (KEY_UP | KEY_DOWN))) {
2750
e3affc66d963 Fixes to the NDS sprite2 test. Illustrates partially working texture-as-sprite functionality.
Darren Alton <dalton@stevens.edu>
parents: 2749
diff changeset
107 SDL_PrivateJoystickAxis(joystick, 1, 0);
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
108 }
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
109
2750
e3affc66d963 Fixes to the NDS sprite2 test. Illustrates partially working texture-as-sprite functionality.
Darren Alton <dalton@stevens.edu>
parents: 2749
diff changeset
110 if ((keysu & (KEY_LEFT | KEY_RIGHT))) {
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
111 SDL_PrivateJoystickAxis(joystick, 0, 0);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
112 }
2750
e3affc66d963 Fixes to the NDS sprite2 test. Illustrates partially working texture-as-sprite functionality.
Darren Alton <dalton@stevens.edu>
parents: 2749
diff changeset
113
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
114 if ((keysd & KEY_A)) {
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
115 SDL_PrivateJoystickButton(joystick, 0, SDL_PRESSED);
2750
e3affc66d963 Fixes to the NDS sprite2 test. Illustrates partially working texture-as-sprite functionality.
Darren Alton <dalton@stevens.edu>
parents: 2749
diff changeset
116 }
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
117
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
118 if ((keysd & KEY_B)) {
2750
e3affc66d963 Fixes to the NDS sprite2 test. Illustrates partially working texture-as-sprite functionality.
Darren Alton <dalton@stevens.edu>
parents: 2749
diff changeset
119 SDL_PrivateJoystickButton(joystick, 1, SDL_PRESSED);
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
120 }
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
121
2750
e3affc66d963 Fixes to the NDS sprite2 test. Illustrates partially working texture-as-sprite functionality.
Darren Alton <dalton@stevens.edu>
parents: 2749
diff changeset
122 if ((keysd & KEY_X)) {
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
123 SDL_PrivateJoystickButton(joystick, 2, SDL_PRESSED);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
124 }
2750
e3affc66d963 Fixes to the NDS sprite2 test. Illustrates partially working texture-as-sprite functionality.
Darren Alton <dalton@stevens.edu>
parents: 2749
diff changeset
125
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
126 if ((keysd & KEY_Y)) {
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
127 SDL_PrivateJoystickButton(joystick, 3, SDL_PRESSED);
2750
e3affc66d963 Fixes to the NDS sprite2 test. Illustrates partially working texture-as-sprite functionality.
Darren Alton <dalton@stevens.edu>
parents: 2749
diff changeset
128 }
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
129
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
130 if ((keysd & KEY_L)) {
2750
e3affc66d963 Fixes to the NDS sprite2 test. Illustrates partially working texture-as-sprite functionality.
Darren Alton <dalton@stevens.edu>
parents: 2749
diff changeset
131 SDL_PrivateJoystickButton(joystick, 4, SDL_PRESSED);
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
132 }
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
133
2750
e3affc66d963 Fixes to the NDS sprite2 test. Illustrates partially working texture-as-sprite functionality.
Darren Alton <dalton@stevens.edu>
parents: 2749
diff changeset
134 if ((keysd & KEY_R)) {
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
135 SDL_PrivateJoystickButton(joystick, 5, SDL_PRESSED);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
136 }
2750
e3affc66d963 Fixes to the NDS sprite2 test. Illustrates partially working texture-as-sprite functionality.
Darren Alton <dalton@stevens.edu>
parents: 2749
diff changeset
137
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
138 if ((keysd & KEY_SELECT)) {
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
139 SDL_PrivateJoystickButton(joystick, 6, SDL_PRESSED);
2750
e3affc66d963 Fixes to the NDS sprite2 test. Illustrates partially working texture-as-sprite functionality.
Darren Alton <dalton@stevens.edu>
parents: 2749
diff changeset
140 }
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
141
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
142 if ((keysd & KEY_START)) {
2750
e3affc66d963 Fixes to the NDS sprite2 test. Illustrates partially working texture-as-sprite functionality.
Darren Alton <dalton@stevens.edu>
parents: 2749
diff changeset
143 SDL_PrivateJoystickButton(joystick, 7, SDL_PRESSED);
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
144 }
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
145
2750
e3affc66d963 Fixes to the NDS sprite2 test. Illustrates partially working texture-as-sprite functionality.
Darren Alton <dalton@stevens.edu>
parents: 2749
diff changeset
146 if ((keysu & KEY_A)) {
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
147 SDL_PrivateJoystickButton(joystick, 0, SDL_RELEASED);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
148 }
2750
e3affc66d963 Fixes to the NDS sprite2 test. Illustrates partially working texture-as-sprite functionality.
Darren Alton <dalton@stevens.edu>
parents: 2749
diff changeset
149
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
150 if ((keysu & KEY_B)) {
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
151 SDL_PrivateJoystickButton(joystick, 1, SDL_RELEASED);
2750
e3affc66d963 Fixes to the NDS sprite2 test. Illustrates partially working texture-as-sprite functionality.
Darren Alton <dalton@stevens.edu>
parents: 2749
diff changeset
152 }
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
153
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
154 if ((keysu & KEY_X)) {
2750
e3affc66d963 Fixes to the NDS sprite2 test. Illustrates partially working texture-as-sprite functionality.
Darren Alton <dalton@stevens.edu>
parents: 2749
diff changeset
155 SDL_PrivateJoystickButton(joystick, 2, SDL_RELEASED);
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
156 }
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
157
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
158 if ((keysu & KEY_Y)) {
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
159 SDL_PrivateJoystickButton(joystick, 3, SDL_RELEASED);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
160 }
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
161
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
162 if ((keysu & KEY_L)) {
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
163 SDL_PrivateJoystickButton(joystick, 4, SDL_RELEASED);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
164 }
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
165
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
166 if ((keysu & KEY_R)) {
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
167 SDL_PrivateJoystickButton(joystick, 5, SDL_RELEASED);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
168 }
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
169
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
170 if ((keysu & KEY_SELECT)) {
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
171 SDL_PrivateJoystickButton(joystick, 6, SDL_RELEASED);
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
172 }