Fixed building joystick code on Android
This commit is contained in:
parent
1e63f1c322
commit
c6918ae961
1 changed files with 48 additions and 5 deletions
|
@ -43,14 +43,12 @@ static const char *accelerometerName = "Android accelerometer";
|
||||||
int
|
int
|
||||||
SDL_SYS_JoystickInit(void)
|
SDL_SYS_JoystickInit(void)
|
||||||
{
|
{
|
||||||
SDL_numjoysticks = 1;
|
|
||||||
|
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Function to get the device-dependent name of a joystick */
|
/* Function to get the device-dependent name of a joystick */
|
||||||
const char *
|
const char *
|
||||||
SDL_SYS_JoystickName(int index)
|
SDL_SYS_JoystickNameForIndex(int index)
|
||||||
{
|
{
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
return accelerometerName;
|
return accelerometerName;
|
||||||
|
@ -66,13 +64,12 @@ SDL_SYS_JoystickName(int index)
|
||||||
It returns 0, or -1 if there is an error.
|
It returns 0, or -1 if there is an error.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
SDL_SYS_JoystickOpen(SDL_Joystick * joystick)
|
SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int index)
|
||||||
{
|
{
|
||||||
joystick->nbuttons = 0;
|
joystick->nbuttons = 0;
|
||||||
joystick->nhats = 0;
|
joystick->nhats = 0;
|
||||||
joystick->nballs = 0;
|
joystick->nballs = 0;
|
||||||
joystick->naxes = 3;
|
joystick->naxes = 3;
|
||||||
joystick->name = accelerometerName;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,6 +106,52 @@ SDL_SYS_JoystickQuit(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Function to perform the mapping from device index to the instance id for this index */
|
||||||
|
SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int index)
|
||||||
|
{
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Function to determine is this joystick is attached to the system right now */
|
||||||
|
int SDL_SYS_JoystickAttached(SDL_Joystick *joystick)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SDL_SYS_NumJoysticks()
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SDL_SYS_JoystickNeedsPolling()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SDL_SYS_JoystickDetect()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
JoystickGUID SDL_SYS_PrivateJoystickGetDeviceGUID( int device_index )
|
||||||
|
{
|
||||||
|
JoystickGUID guid;
|
||||||
|
// the GUID is just the first 16 chars of the name for now
|
||||||
|
const char *name = SDL_SYS_JoystickNameForIndex( device_index );
|
||||||
|
SDL_zero( guid );
|
||||||
|
SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
|
||||||
|
return guid;
|
||||||
|
}
|
||||||
|
|
||||||
|
JoystickGUID SDL_SYS_PrivateJoystickGetGUID(SDL_Joystick * joystick)
|
||||||
|
{
|
||||||
|
JoystickGUID guid;
|
||||||
|
// the GUID is just the first 16 chars of the name for now
|
||||||
|
const char *name = joystick->name;
|
||||||
|
SDL_zero( guid );
|
||||||
|
SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
|
||||||
|
return guid;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* SDL_JOYSTICK_NDS */
|
#endif /* SDL_JOYSTICK_NDS */
|
||||||
|
|
||||||
/* vi: set ts=4 sw=4 expandtab: */
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue