Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Added SDL_HapticOpened().

  • Loading branch information
bobbens committed Jul 8, 2008
1 parent fe47286 commit e46b791ba1f780934997e645ef6724c0bb5d2493
Showing with 32 additions and 0 deletions.
  1. +13 −0 include/SDL_haptic.h
  2. +19 −0 src/haptic/SDL_haptic.c
@@ -642,6 +642,18 @@ extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index);
*/
extern DECLSPEC SDL_Haptic * SDL_HapticOpen(int device_index);

/**
* \fn int SDL_HapticOpened(int device_index)
*
* \brief Checks if the haptic device at index has been opened.
*
* \param device_index Index to check to see if it has been opened.
* \return 1 if it has been opened or 0 if it hasn't.
*
* \sa SDL_HapticOpen
* \sa SDL_HapticIndex
*/
extern DECLSPEC int SDL_HapticOpened(int device_index);

/**
* \fn int SDL_HapticIndex(SDL_Haptic * haptic)
@@ -652,6 +664,7 @@ extern DECLSPEC SDL_Haptic * SDL_HapticOpen(int device_index);
* \return The index of the haptic device or -1 on error.
*
* \sa SDL_HapticOpen
* \sa SDL_HapticOpened
*/
extern DECLSPEC int SDL_HapticIndex(SDL_Haptic * haptic);

@@ -148,6 +148,25 @@ SDL_HapticOpen(int device_index)
}


/*
* Returns 1 if the device has been opened.
*/
int
SDL_HapticOpened(int device_index)
{
int i, opened;

opened = 0;
for (i=0; SDL_haptics[i]; i++) {
if (SDL_haptics[i]->index == (Uint8) device_index) {
opened = 1;
break;
}
}
return opened;
}


/*
* Returns the index to a haptic device.
*/

0 comments on commit e46b791

Please sign in to comment.