Fixes to the NDS sprite2 test. Illustrates partially working texture-as-sprite functionality.
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403203
This commit is contained in:
parent
a2947b8889
commit
e5621bf196
5 changed files with 95 additions and 159 deletions
|
@ -44,7 +44,8 @@
|
|||
int
|
||||
SDL_SYS_JoystickInit(void)
|
||||
{
|
||||
SDL_numjoysticks = 1;
return (1);
|
||||
SDL_numjoysticks = 1;
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* Function to get the device-dependent name of a joystick */
|
||||
|
@ -78,14 +79,14 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick)
|
|||
* but instead should call SDL_PrivateJoystick*() to deliver events
|
||||
* and update joystick device state.
|
||||
*/
|
||||
void
|
||||
void
|
||||
SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
|
||||
{
|
||||
u32 keysd, keysu;
|
||||
int magnitude = 16384;
|
||||
|
||||
/*scanKeys(); - this is done in PumpEvents, because touch uses it too */
|
||||
keysd = keysDown();
|
||||
/*scanKeys(); - this is done in PumpEvents, because touch uses it too */
|
||||
keysd = keysDown();
|
||||
keysu = keysUp();
|
||||
|
||||
if ((keysd & KEY_UP)) {
|
||||
|
@ -100,58 +101,58 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
|
|||
if ((keysd & KEY_RIGHT)) {
|
||||
SDL_PrivateJoystickAxis(joystick, 0, magnitude);
|
||||
}
|
||||
if ((keysu & (KEY_UP | KEY_DOWN))) {
|
||||
if ((keysu & (KEY_UP | KEY_DOWN))) {
|
||||
SDL_PrivateJoystickAxis(joystick, 1, 0);
|
||||
}
|
||||
if ((keysu & (KEY_LEFT | KEY_RIGHT))) {
|
||||
if ((keysu & (KEY_LEFT | KEY_RIGHT))) {
|
||||
SDL_PrivateJoystickAxis(joystick, 0, 0);
|
||||
}
|
||||
if ((keysd & KEY_A)) {
|
||||
if ((keysd & KEY_A)) {
|
||||
SDL_PrivateJoystickButton(joystick, 0, SDL_PRESSED);
|
||||
}
|
||||
if ((keysd & KEY_B)) {
|
||||
if ((keysd & KEY_B)) {
|
||||
SDL_PrivateJoystickButton(joystick, 1, SDL_PRESSED);
|
||||
}
|
||||
if ((keysd & KEY_X)) {
|
||||
if ((keysd & KEY_X)) {
|
||||
SDL_PrivateJoystickButton(joystick, 2, SDL_PRESSED);
|
||||
}
|
||||
if ((keysd & KEY_Y)) {
|
||||
if ((keysd & KEY_Y)) {
|
||||
SDL_PrivateJoystickButton(joystick, 3, SDL_PRESSED);
|
||||
}
|
||||
if ((keysd & KEY_L)) {
|
||||
if ((keysd & KEY_L)) {
|
||||
SDL_PrivateJoystickButton(joystick, 4, SDL_PRESSED);
|
||||
}
|
||||
if ((keysd & KEY_R)) {
|
||||
if ((keysd & KEY_R)) {
|
||||
SDL_PrivateJoystickButton(joystick, 5, SDL_PRESSED);
|
||||
}
|
||||
if ((keysd & KEY_SELECT)) {
|
||||
if ((keysd & KEY_SELECT)) {
|
||||
SDL_PrivateJoystickButton(joystick, 6, SDL_PRESSED);
|
||||
}
|
||||
if ((keysd & KEY_START)) {
|
||||
if ((keysd & KEY_START)) {
|
||||
SDL_PrivateJoystickButton(joystick, 7, SDL_PRESSED);
|
||||
}
|
||||
if ((keysu & KEY_A)) {
|
||||
if ((keysu & KEY_A)) {
|
||||
SDL_PrivateJoystickButton(joystick, 0, SDL_RELEASED);
|
||||
}
|
||||
if ((keysu & KEY_B)) {
|
||||
if ((keysu & KEY_B)) {
|
||||
SDL_PrivateJoystickButton(joystick, 1, SDL_RELEASED);
|
||||
}
|
||||
if ((keysu & KEY_X)) {
|
||||
if ((keysu & KEY_X)) {
|
||||
SDL_PrivateJoystickButton(joystick, 2, SDL_RELEASED);
|
||||
}
|
||||
if ((keysu & KEY_Y)) {
|
||||
if ((keysu & KEY_Y)) {
|
||||
SDL_PrivateJoystickButton(joystick, 3, SDL_RELEASED);
|
||||
}
|
||||
if ((keysu & KEY_L)) {
|
||||
if ((keysu & KEY_L)) {
|
||||
SDL_PrivateJoystickButton(joystick, 4, SDL_RELEASED);
|
||||
}
|
||||
if ((keysu & KEY_R)) {
|
||||
if ((keysu & KEY_R)) {
|
||||
SDL_PrivateJoystickButton(joystick, 5, SDL_RELEASED);
|
||||
}
|
||||
if ((keysu & KEY_SELECT)) {
|
||||
if ((keysu & KEY_SELECT)) {
|
||||
SDL_PrivateJoystickButton(joystick, 6, SDL_RELEASED);
|
||||
}
|
||||
if ((keysu & KEY_START)) {
|
||||
if ((keysu & KEY_START)) {
|
||||
SDL_PrivateJoystickButton(joystick, 7, SDL_RELEASED);
|
||||
}
|
||||
}
|
||||
|
@ -169,4 +170,3 @@ SDL_SYS_JoystickQuit(void)
|
|||
}
|
||||
|
||||
#endif /* SDL_JOYSTICK_NDS */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue