mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 00:05:40 +00:00
Update to SDL2.0.10
This commit is contained in:
parent
600859bd63
commit
c932bda8dd
915 changed files with 116675 additions and 21754 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
@ -26,7 +26,11 @@
|
|||
#include "SDL_assert.h"
|
||||
|
||||
/* Global for SDL_windowshaptic.c */
|
||||
#if (defined(SDL_HAPTIC_DINPUT) && SDL_HAPTIC_DINPUT) || (defined(SDL_HAPTIC_XINPUT) && SDL_HAPTIC_XINPUT)
|
||||
SDL_Haptic *SDL_haptics = NULL;
|
||||
#else
|
||||
static SDL_Haptic *SDL_haptics = NULL;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initializes the Haptic devices.
|
||||
|
|
@ -389,9 +393,11 @@ SDL_HapticClose(SDL_Haptic * haptic)
|
|||
void
|
||||
SDL_HapticQuit(void)
|
||||
{
|
||||
while (SDL_haptics) {
|
||||
SDL_HapticClose(SDL_haptics);
|
||||
}
|
||||
|
||||
SDL_SYS_HapticQuit();
|
||||
SDL_assert(SDL_haptics == NULL);
|
||||
SDL_haptics = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -765,6 +771,7 @@ SDL_HapticRumbleInit(SDL_Haptic * haptic)
|
|||
SDL_zerop(efx);
|
||||
if (haptic->supported & SDL_HAPTIC_SINE) {
|
||||
efx->type = SDL_HAPTIC_SINE;
|
||||
efx->periodic.direction.type = SDL_HAPTIC_CARTESIAN;
|
||||
efx->periodic.period = 1000;
|
||||
efx->periodic.magnitude = 0x4000;
|
||||
efx->periodic.length = 5000;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
@ -19,7 +19,12 @@
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef SDL_haptic_c_h_
|
||||
#define SDL_haptic_c_h_
|
||||
|
||||
extern int SDL_HapticInit(void);
|
||||
extern void SDL_HapticQuit(void);
|
||||
|
||||
#endif /* SDL_haptic_c_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
@ -195,6 +195,10 @@ SDL_SYS_HapticClose(SDL_Haptic * haptic)
|
|||
void
|
||||
SDL_SYS_HapticQuit(void)
|
||||
{
|
||||
/* We don't have any way to scan for joysticks (and their vibrators) at init, so don't wipe the list
|
||||
* of joysticks here in case this is a reinit.
|
||||
*/
|
||||
#if 0
|
||||
SDL_hapticlist_item *item = NULL;
|
||||
SDL_hapticlist_item *next = NULL;
|
||||
|
||||
|
|
@ -206,6 +210,7 @@ SDL_SYS_HapticQuit(void)
|
|||
SDL_hapticlist = SDL_hapticlist_tail = NULL;
|
||||
numhaptics = 0;
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -230,7 +235,12 @@ int
|
|||
SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect *effect,
|
||||
Uint32 iterations)
|
||||
{
|
||||
Android_JNI_HapticRun (((SDL_hapticlist_item *)haptic->hwdata)->device_id, effect->effect.leftright.length);
|
||||
float large = effect->effect.leftright.large_magnitude / 32767.0f;
|
||||
float small = effect->effect.leftright.small_magnitude / 32767.0f;
|
||||
|
||||
float total = (large * 0.6f) + (small * 0.4f);
|
||||
|
||||
Android_JNI_HapticRun (((SDL_hapticlist_item *)haptic->hwdata)->device_id, total, effect->effect.leftright.length);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -238,6 +248,7 @@ SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect *effect,
|
|||
int
|
||||
SDL_SYS_HapticStopEffect(SDL_Haptic * haptic, struct haptic_effect *effect)
|
||||
{
|
||||
Android_JNI_HapticStop (((SDL_hapticlist_item *)haptic->hwdata)->device_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
@ -181,6 +181,9 @@ SDL_SYS_HapticInit(void)
|
|||
SDL_UDEV_Quit();
|
||||
return SDL_SetError("Could not setup haptic <-> udev callback");
|
||||
}
|
||||
|
||||
/* Force a scan to build the initial device list */
|
||||
SDL_UDEV_Scan();
|
||||
#endif /* SDL_USE_LIBUDEV */
|
||||
|
||||
return numhaptics;
|
||||
|
|
@ -905,9 +908,9 @@ SDL_SYS_ToFFEffect(struct ff_effect *dest, SDL_HapticEffect * src)
|
|||
dest->trigger.button = 0;
|
||||
dest->trigger.interval = 0;
|
||||
|
||||
/* Rumble */
|
||||
dest->u.rumble.strong_magnitude = leftright->large_magnitude;
|
||||
dest->u.rumble.weak_magnitude = leftright->small_magnitude;
|
||||
/* Rumble (Linux expects 0-65535, so multiply by 2) */
|
||||
dest->u.rumble.strong_magnitude = CLAMP(leftright->large_magnitude) * 2;
|
||||
dest->u.rumble.weak_magnitude = CLAMP(leftright->small_magnitude) * 2;
|
||||
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
@ -157,7 +157,7 @@ SDL_SYS_HapticMouse(void)
|
|||
|
||||
/* Grab the first mouse haptic device we find. */
|
||||
for (item = SDL_hapticlist; item != NULL; item = item->next) {
|
||||
if (item->capabilities.dwDevType == DI8DEVCLASS_POINTER ) {
|
||||
if (item->capabilities.dwDevType == DI8DEVCLASS_POINTER) {
|
||||
return index;
|
||||
}
|
||||
++index;
|
||||
|
|
@ -173,14 +173,16 @@ SDL_SYS_HapticMouse(void)
|
|||
int
|
||||
SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick)
|
||||
{
|
||||
const struct joystick_hwdata *hwdata = joystick->hwdata;
|
||||
if (joystick->driver != &SDL_WINDOWS_JoystickDriver) {
|
||||
return 0;
|
||||
}
|
||||
#if SDL_HAPTIC_XINPUT
|
||||
if (hwdata->bXInputHaptic) {
|
||||
if (joystick->hwdata->bXInputHaptic) {
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
#if SDL_HAPTIC_DINPUT
|
||||
if (hwdata->Capabilities.dwFlags & DIDC_FORCEFEEDBACK) {
|
||||
if (joystick->hwdata->Capabilities.dwFlags & DIDC_FORCEFEEDBACK) {
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -193,6 +195,9 @@ SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick)
|
|||
int
|
||||
SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
|
||||
{
|
||||
if (joystick->driver != &SDL_WINDOWS_JoystickDriver) {
|
||||
return 0;
|
||||
}
|
||||
if (joystick->hwdata->bXInputHaptic != haptic->hwdata->bXInputHaptic) {
|
||||
return 0; /* one is XInput, one is not; not the same device. */
|
||||
} else if (joystick->hwdata->bXInputHaptic) {
|
||||
|
|
@ -208,6 +213,8 @@ SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
|
|||
int
|
||||
SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
|
||||
{
|
||||
SDL_assert(joystick->driver == &SDL_WINDOWS_JoystickDriver);
|
||||
|
||||
if (joystick->hwdata->bXInputDevice) {
|
||||
return SDL_XINPUT_HapticOpenFromJoystick(haptic, joystick);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue