SDL_HapticConstant(3type)

✨ SDL_HapticConstant ✨

okay bestie, welcome to the SDL_HapticConstant page of the SDL3 datatypes manual πŸ’– (yes, that's the (3type) section, we're doing types today, stay with me).

This one is a struct β€” a whole template for a Constant effect. And when I say constant I mean it literally applies one steady force. No cap. πŸ‘‘


🌸 NAME 🌸

SDL_HapticConstant β€” a structure containing a template for a Constant effect.


πŸŽ€ SYNOPSIS πŸŽ€

#include <SDL3/SDL_haptic.h>

typedef struct SDL_HapticConstant
{
    /* Header */
    SDL_HapticEffectType type;      /**< SDL_HAPTIC_CONSTANT */
    SDL_HapticDirection direction;  /**< Direction of the effect. */

    /* Replay */
    Uint32 length;          /**< Duration of the effect. */
    Uint16 delay;           /**< Delay before starting the effect. */

    /* Trigger */
    Uint16 button;          /**< Button that triggers the effect. */
    Uint16 interval;        /**< How soon it can be triggered again after button. */

    /* Constant */
    Sint16 level;           /**< Strength of the constant effect. */

    /* Envelope */
    Uint16 attack_length;   /**< Duration of the attack. */
    Uint16 attack_level;    /**< Level at the start of the attack. */
    Uint16 fade_length;     /**< Duration of the fade. */
    Uint16 fade_level;      /**< Level at the end of the fade. */
} SDL_HapticConstant;

like. look at her. she's structured. she's organized. she has comments in every single field. main character energy fr fr. 🫢


πŸ’… DESCRIPTION πŸ’…

so here's the tea: this struct is exclusively for the SDL_HAPTIC_CONSTANT effect. like, don't try to use it for anything else, it's not that girl. πŸ™ˆ

What's a constant effect? It applies a constant force in the direction you specified, straight to the joystick. That's it. That's the whole vibe. Steady, unbothered, consistent. ✨


πŸ¦‹ AVAILABILITY πŸ¦‹

This struct has been available since SDL 3.2.0. so she's not ancient, she's fresh. ⭐


πŸ‘‘ SEE ALSO πŸ‘‘

go read those next bestie, iykyk πŸ’œ


okay that's the page!! πŸ˜­πŸ’– she was written by the fine folks over at Simple Directmedia Layer, and this is version SDL 3.4.18, dated right there in the SDL_HapticConstant(3type) footer. slay, go make something rumble. πŸŒˆπŸ“

πŸ“¦ where this page comes from