---
name: "SDL_CreateHapticEffect"
section: "3"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_CreateHapticEffect"
---

# SDL\_CreateHapticEffect(3)

Create a new haptic effect on a specified device.

## NAME

SDL\_CreateHapticEffect - Create a new haptic effect on a specified device.

## HEADER FILE

Defined in SDL3/SDL\_haptic.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**int SDL\_CreateHapticEffect(SDL\_Haptic \*haptic, const SDL\_HapticEffect \*effect);**

## FUNCTION PARAMETERS

- *haptic*

  an  **SDL\_Haptic**\
    device to create the effect on.

- *effect*

  an  **SDL\_HapticEffect**\
    structure containing the properties of the effect to create.

## RETURN VALUE

Returns the ID of the effect on success or -1 on failure; call

**SDL\_GetError** () for more information.

## AVAILABILITY

This function is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_DestroyHapticEffect**(3)](/SDL_DestroyHapticEffect/3.md), **•**(3), [**SDL\_RunHapticEffect**(3)](/SDL_RunHapticEffect/3.md), **•**(3), [**SDL\_UpdateHapticEffect**(3)](/SDL_UpdateHapticEffect/3.md)
