early-access version 2281
This commit is contained in:
24
externals/SDL/test/testhaptic.c
vendored
24
externals/SDL/test/testhaptic.c
vendored
@@ -14,10 +14,6 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
/*
|
||||
* includes
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h> /* strstr */
|
||||
#include <ctype.h> /* isdigit */
|
||||
|
||||
#include "SDL.h"
|
||||
|
||||
#ifndef SDL_HAPTIC_DISABLED
|
||||
@@ -29,7 +25,7 @@ static SDL_Haptic *haptic;
|
||||
* prototypes
|
||||
*/
|
||||
static void abort_execution(void);
|
||||
static void HapticPrintSupported(SDL_Haptic * haptic);
|
||||
static void HapticPrintSupported(SDL_Haptic *);
|
||||
|
||||
|
||||
/**
|
||||
@@ -55,7 +51,7 @@ main(int argc, char **argv)
|
||||
index = -1;
|
||||
if (argc > 1) {
|
||||
name = argv[1];
|
||||
if ((strcmp(name, "--help") == 0) || (strcmp(name, "-h") == 0)) {
|
||||
if ((SDL_strcmp(name, "--help") == 0) || (SDL_strcmp(name, "-h") == 0)) {
|
||||
SDL_Log("USAGE: %s [device]\n"
|
||||
"If device is a two-digit number it'll use it as an index, otherwise\n"
|
||||
"it'll use it as if it were part of the device's name.\n",
|
||||
@@ -63,9 +59,9 @@ main(int argc, char **argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
i = strlen(name);
|
||||
if ((i < 3) && isdigit(name[0]) && ((i == 1) || isdigit(name[1]))) {
|
||||
index = atoi(name);
|
||||
i = SDL_strlen(name);
|
||||
if ((i < 3) && SDL_isdigit(name[0]) && ((i == 1) || SDL_isdigit(name[1]))) {
|
||||
index = SDL_atoi(name);
|
||||
name = NULL;
|
||||
}
|
||||
}
|
||||
@@ -82,7 +78,7 @@ main(int argc, char **argv)
|
||||
/* Try to find matching device */
|
||||
else {
|
||||
for (i = 0; i < SDL_NumHaptics(); i++) {
|
||||
if (strstr(SDL_HapticName(i), name) != NULL)
|
||||
if (SDL_strstr(SDL_HapticName(i), name) != NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -110,7 +106,7 @@ main(int argc, char **argv)
|
||||
SDL_ClearError();
|
||||
|
||||
/* Create effects. */
|
||||
memset(&efx, 0, sizeof(efx));
|
||||
SDL_memset(&efx, 0, sizeof(efx));
|
||||
nefx = 0;
|
||||
supported = SDL_HapticQuery(haptic);
|
||||
|
||||
@@ -314,13 +310,13 @@ abort_execution(void)
|
||||
* Displays information about the haptic device.
|
||||
*/
|
||||
static void
|
||||
HapticPrintSupported(SDL_Haptic * haptic)
|
||||
HapticPrintSupported(SDL_Haptic * ptr)
|
||||
{
|
||||
unsigned int supported;
|
||||
|
||||
supported = SDL_HapticQuery(haptic);
|
||||
supported = SDL_HapticQuery(ptr);
|
||||
SDL_Log(" Supported effects [%d effects, %d playing]:\n",
|
||||
SDL_HapticNumEffects(haptic), SDL_HapticNumEffectsPlaying(haptic));
|
||||
SDL_HapticNumEffects(ptr), SDL_HapticNumEffectsPlaying(ptr));
|
||||
if (supported & SDL_HAPTIC_CONSTANT)
|
||||
SDL_Log(" constant\n");
|
||||
if (supported & SDL_HAPTIC_SINE)
|
||||
|
Reference in New Issue
Block a user