logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

SDL_HapticPeriodic - A structure containing a template for a Periodic effect.

Availability

       This struct is available since SDL 3.2.0.

Description

       The struct handles the following effects:

       • SDL_HAPTIC_SINESDL_HAPTIC_SQUARESDL_HAPTIC_TRIANGLESDL_HAPTIC_SAWTOOTHUPSDL_HAPTIC_SAWTOOTHDOWN

       A periodic effect consists in a wave-shaped effect that repeats itself over time. The type determines the
       shape of the wave and the parameters determine the dimensions of the wave.

       Phase  is  given  by hundredth of a degree meaning that giving the phase a value of 9000 will displace it
       25% of its period. Here are sample values:

       • 0: No phase displacement.

       • 9000: Displaced 25% of its period.

       • 18000: Displaced 50% of its period.

       • 27000: Displaced 75% of its period.

       • 36000: Displaced 100% of its period, same as 0, but 0 is preferred.

       Examples:

                SDL_HAPTIC_SINE
                  __      __      __      __
                 /  \    /  \    /  \    /
                /    \__/    \__/    \__/

                SDL_HAPTIC_SQUARE
                 __    __    __    __    __
                |  |  |  |  |  |  |  |  |  |
                |  |__|  |__|  |__|  |__|  |

                SDL_HAPTIC_TRIANGLE
                  /\    /\    /\    /\    /\
                 /  \  /  \  /  \  /  \  /
                /    \/    \/    \/    \/

                SDL_HAPTIC_SAWTOOTHUP
                  /|  /|  /|  /|  /|  /|  /|
                 / | / | / | / | / | / | / |
                /  |/  |/  |/  |/  |/  |/  |

                SDL_HAPTIC_SAWTOOTHDOWN
                \  |\  |\  |\  |\  |\  |\  |
                 \ | \ | \ | \ | \ | \ | \ |
                  \|  \|  \|  \|  \|  \|  \|

Name

       SDL_HapticPeriodic - A structure containing a template for a Periodic effect.

See Also

SDL_HAPTIC_SINE(3),     SDL_HAPTIC_SQUARE(3),      SDL_HAPTIC_TRIANGLE(3),      SDL_HAPTIC_SAWTOOTHUP(3),
       SDL_HAPTIC_SAWTOOTHDOWN(3), SDL_HapticEffect(3type)

Simple Directmedia Layer                           SDL 3.2.20                          SDL_HapticPeriodic(3type)

Synopsis

#include<SDL3/SDL_haptic.h>typedefstructSDL_HapticPeriodic{/*Header*/Uint16type;/**<SDL_HAPTIC_SINE,SDL_HAPTIC_SQUARESDL_HAPTIC_TRIANGLE,SDL_HAPTIC_SAWTOOTHUPorSDL_HAPTIC_SAWTOOTHDOWN*/SDL_HapticDirectiondirection;/**<Directionoftheeffect.*//*Replay*/Uint32length;/**<Durationoftheeffect.*/Uint16delay;/**<Delaybeforestartingtheeffect.*//*Trigger*/Uint16button;/**<Buttonthattriggerstheeffect.*/Uint16interval;/**<Howsoonitcanbetriggeredagainafterbutton.*//*Periodic*/Uint16period;/**<Periodofthewave.*/Sint16magnitude;/**<Peakvalue;ifnegative,equivalentto180degreesextraphaseshift.*/Sint16offset;/**<Meanvalueofthewave.*/Uint16phase;/**<Positivephaseshiftgivenbyhundredthofadegree.*//*Envelope*/Uint16attack_length;/**<Durationoftheattack.*/Uint16attack_level;/**<Levelatthestartoftheattack.*/Uint16fade_length;/**<Durationofthefade.*/Uint16fade_level;/**<Levelattheendofthefade.*/}SDL_HapticPeriodic;

See Also