1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129 |
- ' Copyright (c) 2015-2022 Bruce A Henderson
- '
- ' This software is provided 'as-is', without any express or implied
- ' warranty. In no event will the authors be held liable for any damages
- ' arising from the use of this software.
- '
- ' Permission is granted to anyone to use this software for any purpose,
- ' including commercial applications, and to alter it and redistribute it
- ' freely, subject to the following restrictions:
- '
- ' 1. The origin of this software must not be misrepresented; you must not
- ' claim that you wrote the original software. If you use this software
- ' in a product, an acknowledgment in the product documentation would be
- ' appreciated but is not required.
- '
- ' 2. Altered source versions must be plainly marked as such, and must not be
- ' misrepresented as being the original software.
- '
- ' 3. This notice may not be removed or altered from any source
- ' distribution.
- '
- SuperStrict
- Rem
- bbdoc: Control of haptic (force feedback) devices.
- End Rem
- Module SDL.SDLHaptic
- Import SDL.SDLJoystick
- Import "common.bmx"
- Rem
- bbdoc: A haptic device.
- End Rem
- Type TSDLHaptic
- Field hapticPtr:Byte Ptr
-
- Function _create:TSDLHaptic(hapticPtr:Byte Ptr)
- If hapticPtr Then
- Local this:TSDLHaptic = New TSDLHaptic
- this.hapticPtr = hapticPtr
- Return this
- End If
- End Function
-
- Rem
- bbdoc: Opens a haptic device for use.
- about: The device passed as an argument refers to the N'th haptic device on this system.
- When opening a haptic device, its gain will be set to maximum and autocenter will be disabled.
- To modify these values use SetGain() and SetAutocenter().
- End Rem
- Function Open:TSDLHaptic(device:Int)
- Return _create(SDL_HapticOpen(device))
- End Function
-
- Rem
- bbdoc: Opens a haptic device for use from a joystick device.
- returns:Aa valid haptic device on success or NULL on failure.
- about: You must still close the haptic device separately. It will not be closed with the joystick.
- When opened from a joystick you should first close the haptic device before closing the joystick device.
- If not, on some implementations the haptic device will also get unallocated and you'll be unable to use force feedback on that device.
- End Rem
- Function OpenFromJoystick:TSDLHaptic(joystick:TSDLJoystick)
- Return _create(SDL_HapticOpenFromJoystick(joystick.joystickPtr))
- End Function
-
- Rem
- bbdoc: Gets whether or not the current mouse has haptic capabilities.
- End Rem
- Function MouseIsHaptic:Int()
- Return SDL_MouseIsHaptic()
- End Function
-
- Rem
- bbdoc: Opens a haptic device from the current mouse.
- returns: The haptic device or NULL on failure.
- End Rem
- Function OpenFromMouse:TSDLHaptic()
- Return _create(SDL_HapticOpenFromMouse())
- End Function
-
- Rem
- bbdoc: Counts the number of haptic devices attached to the system.
- End Rem
- Function NumHaptics:Int()
- Return SDL_NumHaptics()
- End Function
-
- Rem
- bbdoc: Gets the haptic device's supported features in bitwise manner.
- returns: A list of supported haptic features in bitwise manner (OR'd), or 0 on failure.
- End Rem
- Method Query:UInt()
- Return SDL_HapticQuery(hapticPtr)
- End Method
-
- Rem
- bbdoc: Gets the implementation dependent name of the haptic device.
- End Rem
- Function Name:String(device:Int)
- Return String.FromUTF8String(SDL_HapticName(device))
- End Function
-
- Rem
- bbdoc: Gets the index of the haptic device.
- End Rem
- Method Index:Int()
- Return SDL_HapticIndex(hapticPtr)
- End Method
-
- Rem
- bbdoc: Checks if the haptic device at the designated index has been opened.
- returns: Returns True if it has been opened, False if it hasn't or on failure.
- End Rem
- Function Opened:Int(device:Int)
- Return SDL_HapticOpened(device)
- End Function
-
- Rem
- bbdoc: Pauses the haptic device.
- returns: 0 on success or a negative error code on failure.
- End Rem
- Method Pause:Int()
- Return SDL_HapticPause(hapticPtr)
- End Method
-
- Rem
- bbdoc: Unpauses the haptic device.
- about: 0 on success or a negative error code on failure.
- End Rem
- Method Unpause:Int()
- Return SDL_HapticUnpause(hapticPtr)
- End Method
-
- Rem
- bbdoc: Stops all the currently playing effects on the haptic device.
- returns: 0 on success or a negative error code on failure.
- End Rem
- Method StopAll:Int()
- Return SDL_HapticStopAll(hapticPtr)
- End Method
-
- Rem
- bbdoc: Gets the number of haptic axes the device has.
- about: The number of haptic axes might be useful if working with the #Direction effect.
- End Rem
- Method NumAxes:Int()
- Return SDL_HapticNumAxes(hapticPtr)
- End Method
-
- Rem
- bbdoc: Checks to see if an effect is supported by a haptic device.
- about: True if effect is supported, False if it isn't, or a negative error code on failure.
- End Rem
- Method EffectSupported:Int(effect:TSDLHapticEffect)
- Return SDL_HapticEffectSupported(hapticPtr, effect.effectPtr)
- End Method
-
- Rem
- bbdoc: Gets the number of effects a haptic device can store.
- about: On some platforms this isn't fully supported, and therefore is an approximation.
- Always check to see if your created effect was actually created and do not rely solely on #NumEffects().
- End Rem
- Method NumEffects:Int()
- Return SDL_HapticNumEffects(hapticPtr)
- End Method
-
- Rem
- bbdoc: Gets the number of effects a haptic device can play at the same time.
- about: This is not supported on all platforms, but will always return a value. Added here for the sake of completeness.
- End Rem
- Method NumEffectsPlaying:Int()
- Return SDL_HapticNumEffectsPlaying(hapticPtr)
- End Method
-
- Rem
- bbdoc: Creates a new haptic effect on the device.
- returns: The ID of the effect on success or a negative error code on failure.
- End Rem
- Method NewEffect:Int(effect:TSDLHapticEffect)
- Return SDL_HapticNewEffect(hapticPtr, effect.effectPtr)
- End Method
-
- Rem
- bbdoc: Runs the effect on the device.
- returns: 0 on success or a negative error code on failure.
- about: If iterations are SDL_HAPTIC_INFINITY, it'll run the effect over and over repeating the envelope (attack and fade) every time.
- If you only want the effect to last forever, set SDL_HAPTIC_INFINITY in the effect's length parameter.
- End Rem
- Method RunEffect:Int(effect:Int, iterations:UInt)
- Return SDL_HapticRunEffect(hapticPtr, effect, iterations)
- End Method
-
- Rem
- bbdoc: Stops the haptic effect on the device.
- returns: 0 on success or a negative error code on failure.
- End Rem
- Method StopEffect:Int(effect:Int)
- Return SDL_HapticStopEffect(hapticPtr, effect)
- End Method
-
- Rem
- bbdoc: Gets the status of the current effect on the haptic device.
- returns: 0 if it isn't playing, 1 if it is playing, or a negative error code on failure.
- about: Device must support the #SDL_HAPTIC_STATUS feature.
- End Rem
- Method EffectStatus:Int(effect:Int)
- Return SDL_HapticGetEffectStatus(hapticPtr, effect)
- End Method
-
- Rem
- bbdoc: Destroys the haptic effect on the device.
- about: This will stop the effect if it's running. Effects are automatically destroyed when the device is closed.
- End Rem
- Method DestroyEffect(effect:Int)
- SDL_HapticDestroyEffect(hapticPtr, effect)
- End Method
-
- Rem
- bbdoc: Initializes the haptic device for simple rumble playback.
- returns: 0 on success or a negative error code on failure.
- End Rem
- Method RumbleInit:Int()
- Return SDL_HapticRumbleInit(hapticPtr)
- End Method
-
- Rem
- bbdoc: Runs a simple rumble effect on a haptic device.
- End Rem
- Method RumblePlay:Int(strength:Float, length:UInt)
- Return SDL_HapticRumblePlay(hapticPtr, strength, length)
- End Method
-
- Rem
- bbdoc: Stops the simple rumble on the haptic device.
- returns: 0 on success or a negative error code on failure.
- End Rem
- Method RumbleStop:Int()
- Return SDL_HapticRumbleStop(hapticPtr)
- End Method
-
- Rem
- bbdoc: Checks whether rumble is supported on the haptic device.
- End Rem
- Method RumbleSupported:Int()
- Return SDL_HapticRumbleSupported(hapticPtr)
- End Method
-
- Rem
- bbdoc: Sets the global autocenter of the haptic device.
- returns: 0 on success or a negative error code on failure.
- End Rem
- Method SetAutocenter:Int(value:Int)
- Return SDL_HapticSetAutocenter(hapticPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the global gain of the haptic device.
- End Rem
- Method SetGain:Int(value:Int)
- Return SDL_HapticSetGain(hapticPtr, value)
- End Method
-
- Rem
- bbdoc: Closes the haptic device.
- End Rem
- Method Close()
- If hapticPtr Then
- SDL_HapticClose(hapticPtr)
- hapticPtr = Null
- End If
- End Method
-
- Method Delete()
- If hapticPtr Then
- Close()
- End If
- End Method
-
- End Type
- Rem
- bbdoc: The direction where the force comes from, instead of the direction in which the force is exerted.
- about: Cardinal directions of the haptic device are relative to the positioning of the device. North is
- considered to be away from the user. South is toward the user, east is right, and west is left of the user.
- End Rem
- Type TSDLHapticDirection
-
- Field dirPtr:Byte Ptr
-
- Function _create:TSDLHapticDirection(dirPtr:Byte Ptr)
- If dirPtr Then
- Local this:TSDLHapticDirection = New TSDLHapticDirection
- this.dirPtr = dirPtr
- Return this
- End If
- End Function
-
- Rem
- bbdoc: Sets the type of encoding.
- about: One of #SDL_HAPTIC_POLAR, #SDL_HAPTIC_CARTESIAN or #SDL_HAPTIC_SPHERICAL.
- End Rem
- Method SetType(value:Int)
- bmx_sdl_haptic_SDLHapticDirection_SetType(dirPtr, value)
- End Method
-
- Rem
- bbdoc:
- End Rem
- Method SetDir(x:Short, y:Short = 0, z:Short = 0)
- bmx_sdl_haptic_SDLHapticDirection_SetDir(dirPtr, x, y, z)
- End Method
-
- End Type
- Rem
- bbdoc: A generic template for any haptic effect.
- End Rem
- Type TSDLHapticEffect
- Field effectPtr:Byte Ptr
-
- Rem
- bbdoc: Frees the effect.
- End Rem
- Method Free()
- If effectPtr Then
- bmx_sdl_haptic_SDLHapticEffect_free(effectPtr)
- effectPtr = Null
- End If
- End Method
-
- Method Delete()
- Free()
- End Method
-
- End Type
- Rem
- bbdoc: A constant effect applies a constant force to the joystick in the specified direction.
- End Rem
- Type TSDLHapticConstant Extends TSDLHapticEffect
-
- Rem
- bbdoc: Creates a new instance of the effect.
- End Rem
- Method New()
- effectPtr = bmx_sdl_haptic_SDLHapticConstant_new()
- End Method
- Rem
- bbdoc: Returns the duration of effect (ms).
- End Rem
- Method GetLength:UInt()
- Return bmx_sdl_haptic_SDLHapticConstant_GetLength(effectPtr)
- End Method
- Rem
- bbdoc: Returns the delay before starting effect.
- End Rem
- Method GetDelay:Short()
- Return bmx_sdl_haptic_SDLHapticConstant_GetDelay(effectPtr)
- End Method
-
- Rem
- bbdoc: Returns the button that triggers effect.
- End Rem
- Method GetButton:Short()
- Return bmx_sdl_haptic_SDLHapticConstant_GetButton(effectPtr)
- End Method
-
- Rem
- bbdoc: Returns how soon before effect can be triggered again.
- End Rem
- Method GetInterval:Short()
- Return bmx_sdl_haptic_SDLHapticConstant_GetInterval(effectPtr)
- End Method
-
- Rem
- bbdoc: Returns the duration of the attack (ms).
- End Rem
- Method GetAttackLength:Short()
- Return bmx_sdl_haptic_SDLHapticConstant_GetAttackLength(effectPtr)
- End Method
-
- Rem
- bbdoc: Returns the level at the start of the attack.
- End Rem
- Method GetAttackLevel:Short()
- Return bmx_sdl_haptic_SDLHapticConstant_GetAttackLevel(effectPtr)
- End Method
-
- Rem
- bbdoc: Returns the duration of the fade out (ms).
- End Rem
- Method GetFadeLength:Short()
- Return bmx_sdl_haptic_SDLHapticConstant_GetFadeLength(effectPtr)
- End Method
-
- Rem
- bbdoc: Returns the level at the end of the fade.
- End Rem
- Method GetFadeLevel:Short()
- Return bmx_sdl_haptic_SDLHapticConstant_GetFadeLevel(effectPtr)
- End Method
-
- Rem
- bbdoc: Returns the effect direction.
- about: This instance is owned by the effect, and any changes will apply only to this effect.
- End Rem
- Method Direction:TSDLHapticDirection()
- Return TSDLHapticDirection._create(bmx_sdl_haptic_SDLHapticConstant_Direction(effectPtr))
- End Method
-
- Rem
- bbdoc: Sets the duration of the effect.
- about: You can pass SDL_HAPTIC_INFINITY to length instead of a 0-32767 value.
- End Rem
- Method SetLength(value:UInt)
- bmx_sdl_haptic_SDLHapticConstant_SetLength(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the delay before starting the effect.
- End Rem
- Method SetDelay(value:Short)
- bmx_sdl_haptic_SDLHapticConstant_SetDelay(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the button that triggers the effect.
- End Rem
- Method SetButton(value:Short)
- bmx_sdl_haptic_SDLHapticConstant_SetButton(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets how soon it can be triggered again after button.
- End Rem
- Method SetInterval(value:Short)
- bmx_sdl_haptic_SDLHapticConstant_SetInterval(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the strength of the constant effect.
- End Rem
- Method SetLevel(value:Int)
- bmx_sdl_haptic_SDLHapticConstant_SetLevel(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the duration of the attack.
- End Rem
- Method SetAttackLength(value:Short)
- bmx_sdl_haptic_SDLHapticConstant_SetAttackLength(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the level at the start of the attack.
- End Rem
- Method SetAttackLevel(value:Short)
- bmx_sdl_haptic_SDLHapticConstant_SetAttackLevel(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the duration of the fade.
- End Rem
- Method SetFadeLength(value:Short)
- bmx_sdl_haptic_SDLHapticConstant_SetFadeLength(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the level at the end of the fade.
- End Rem
- Method SetFadeLevel(value:Short)
- bmx_sdl_haptic_SDLHapticConstant_SetFadeLevel(effectPtr, value)
- End Method
-
- End Type
- Rem
- bbdoc: A wave-shaped effect that repeats itself over time.
- about: The type determines the shape of the wave and the other parameters determine the dimensions of the wave.
- End Rem
- Type TSDLHapticPeriodic Extends TSDLHapticEffect
- Rem
- bbdoc: Creates a new instance of the effect.
- about: @waveType one of #SDL_HAPTIC_SINE, #SDL_HAPTIC_LEFTRIGHT, #SDL_HAPTIC_TRIANGLE, #SDL_HAPTIC_SAWTOOTHUP or #SDL_HAPTIC_SAWTOOTHDOWN.
- End Rem
- Method New(waveType:Int)
- effectPtr = bmx_sdl_haptic_SDLHapticPeriodic_new(waveType)
- End Method
- Rem
- bbdoc: Returns the duration of effect (ms).
- End Rem
- Method GetLength:UInt()
- Return bmx_sdl_haptic_SDLHapticPeriodic_GetLength(effectPtr)
- End Method
- Rem
- bbdoc: Returns the delay before starting effect.
- End Rem
- Method GetDelay:Short()
- Return bmx_sdl_haptic_SDLHapticPeriodic_GetDelay(effectPtr)
- End Method
-
- Rem
- bbdoc: Returns the button that triggers effect.
- End Rem
- Method GetButton:Short()
- Return bmx_sdl_haptic_SDLHapticPeriodic_GetButton(effectPtr)
- End Method
-
- Rem
- bbdoc: Returns how soon before effect can be triggered again.
- End Rem
- Method GetInterval:Short()
- Return bmx_sdl_haptic_SDLHapticPeriodic_GetInterval(effectPtr)
- End Method
-
- Rem
- bbdoc: Returns the duration of the attack (ms).
- End Rem
- Method GetAttackLength:Short()
- Return bmx_sdl_haptic_SDLHapticPeriodic_GetAttackLength(effectPtr)
- End Method
-
- Rem
- bbdoc: Returns the level at the start of the attack.
- End Rem
- Method GetAttackLevel:Short()
- Return bmx_sdl_haptic_SDLHapticPeriodic_GetAttackLevel(effectPtr)
- End Method
-
- Rem
- bbdoc: Returns the duration of the fade out (ms).
- End Rem
- Method GetFadeLength:Short()
- Return bmx_sdl_haptic_SDLHapticPeriodic_GetFadeLength(effectPtr)
- End Method
-
- Rem
- bbdoc: Returns the level at the end of the fade.
- End Rem
- Method GetFadeLevel:Short()
- Return bmx_sdl_haptic_SDLHapticPeriodic_GetFadeLevel(effectPtr)
- End Method
-
- Rem
- bbdoc: Returns the effect direction.
- about: This instance is owned by the effect, and any changes will apply only to this effect.
- End Rem
- Method Direction:TSDLHapticDirection()
- Return TSDLHapticDirection._create(bmx_sdl_haptic_SDLHapticPeriodic_Direction(effectPtr))
- End Method
- Rem
- bbdoc: Sets the duration of the effect.
- about: You can pass SDL_HAPTIC_INFINITY to length instead of a 0-32767 value.
- End Rem
- Method SetLength(value:UInt)
- bmx_sdl_haptic_SDLHapticPeriodic_SetLength(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the delay before starting the effect.
- End Rem
- Method SetDelay(value:Short)
- bmx_sdl_haptic_SDLHapticPeriodic_SetDelay(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the button that triggers the effect.
- End Rem
- Method SetButton(value:Short)
- bmx_sdl_haptic_SDLHapticPeriodic_SetButton(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets how soon it can be triggered again after button.
- End Rem
- Method SetInterval(value:Short)
- bmx_sdl_haptic_SDLHapticPeriodic_SetInterval(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the period of the wave.
- End Rem
- Method SetPeriod(value:Short)
- bmx_sdl_haptic_SDLHapticPeriodic_SetPeriod(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the peak value
- about: Ff negative, equivalent to 180 degrees extra phase shift
- End Rem
- Method SetMagnitude(value:Int)
- bmx_sdl_haptic_SDLHapticPeriodic_SetMagnitude(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the mean value of the wave.
- End Rem
- Method SetOffset(value:Int)
- bmx_sdl_haptic_SDLHapticPeriodic_SetOffset(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the positive phase shift given by hundredth of a degree.
- about: Phase is given by hundredths of a degree, meaning that giving the phase a value of 9000
- will displace it 25% of its period. Here are sample values:
- <p>0 - No phase displacement</p>
- <p>9000 - Displaced 25% of its period</p>
- <p>18000 - Displaced 50% of its period</p>
- <p>27000 - Displaced 75% of its period</p>
- <p>36000 - Displaced 100% of its period, same as 0, but 0 is preferred</p>
- End Rem
- Method SetPhase(value:Short)
- bmx_sdl_haptic_SDLHapticPeriodic_SetPhase(effectPtr, value)
- End Method
- Rem
- bbdoc: Sets the duration of the attack.
- End Rem
- Method SetAttackLength(value:Short)
- bmx_sdl_haptic_SDLHapticPeriodic_SetAttackLength(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the level at the start of the attack.
- End Rem
- Method SetAttackLevel(value:Short)
- bmx_sdl_haptic_SDLHapticPeriodic_SetAttackLevel(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the duration of the fade.
- End Rem
- Method SetFadeLength(value:Short)
- bmx_sdl_haptic_SDLHapticPeriodic_SetFadeLength(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the level at the end of the fade.
- End Rem
- Method SetFadeLevel(value:Short)
- bmx_sdl_haptic_SDLHapticPeriodic_SetFadeLevel(effectPtr, value)
- End Method
- End Type
- Rem
- bbdoc: A template for a condition effect.
- End Rem
- Type TSDLHapticCondition Extends TSDLHapticEffect
- Rem
- bbdoc: Creates a new instance of the effect.
- about: @effectType one of #SDL_HAPTIC_SPRING, #SDL_HAPTIC_DAMPER, #SDL_HAPTIC_INERTIA, #SDL_HAPTIC_FRICTION
- End Rem
- Method New(effectType:Int)
- effectPtr = bmx_sdl_haptic_SDLHapticCondition_new(effectType)
- End Method
- Rem
- bbdoc: Returns the duration of effect (ms).
- End Rem
- Method GetLength:UInt()
- Return bmx_sdl_haptic_SDLHapticCondition_GetLength(effectPtr)
- End Method
- Rem
- bbdoc: Returns the delay before starting effect.
- End Rem
- Method GetDelay:Short()
- Return bmx_sdl_haptic_SDLHapticCondition_GetDelay(effectPtr)
- End Method
-
- Rem
- bbdoc: Returns the button that triggers effect.
- End Rem
- Method GetButton:Short()
- Return bmx_sdl_haptic_SDLHapticCondition_GetButton(effectPtr)
- End Method
-
- Rem
- bbdoc: Returns how soon before effect can be triggered again.
- End Rem
- Method GetInterval:Short()
- Return bmx_sdl_haptic_SDLHapticCondition_GetInterval(effectPtr)
- End Method
- Rem
- bbdoc: Returns the effect direction.
- about: This instance is owned by the effect, and any changes will apply only to this effect.
- End Rem
- Method Direction:TSDLHapticDirection()
- Return TSDLHapticDirection._create(bmx_sdl_haptic_SDLHapticCondition_Direction(effectPtr))
- End Method
- Rem
- bbdoc: Sets the duration of the effect.
- about: You can pass SDL_HAPTIC_INFINITY to length instead of a 0-32767 value.
- End Rem
- Method SetLength(value:UInt)
- bmx_sdl_haptic_SDLHapticCondition_SetLength(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the delay before starting the effect.
- End Rem
- Method SetDelay(value:Short)
- bmx_sdl_haptic_SDLHapticCondition_SetDelay(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the button that triggers the effect.
- End Rem
- Method SetButton(value:Short)
- bmx_sdl_haptic_SDLHapticCondition_SetButton(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets how soon it can be triggered again after button.
- End Rem
- Method SetInterval(value:Short)
- bmx_sdl_haptic_SDLHapticCondition_SetInterval(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets level when joystick is to the positive side.
- about: max = $FFFF
- End Rem
- Method SetRightSat(x:Short, y:Short = 0, z:Short = 0)
- bmx_sdl_haptic_SDLHapticCondition_SetRightSat(effectPtr, x, y, z)
- End Method
-
- Rem
- bbdoc: Sets level when joystick is to the negative side.
- about: max = $FFFF
- End Rem
- Method SetLeftSat(x:Short, y:Short = 0, z:Short = 0)
- bmx_sdl_haptic_SDLHapticCondition_SetLeftSat(effectPtr, x, y, z)
- End Method
-
- Rem
- bbdoc: Sets how fast to increase the force towards the positive side.
- End Rem
- Method SetRightCoeff(x:Int, y:Int = 0, z:Int = 0)
- bmx_sdl_haptic_SDLHapticCondition_SetRightCoeff(effectPtr, x, y, z)
- End Method
-
- Rem
- bbdoc: Sets how fast to increase the force towards the negative side.
- End Rem
- Method SetLeftCoeff(x:Int, y:Int = 0, z:Int = 0)
- bmx_sdl_haptic_SDLHapticCondition_SetLeftCoeff(effectPtr, x, y, z)
- End Method
-
- Rem
- bbdoc: Sets the size of the dead zone.
- about: max = $FFFF: whole axis-range when 0-centered
- End Rem
- Method SetDeadband(x:Short, y:Short = 0, z:Short = 0)
- bmx_sdl_haptic_SDLHapticCondition_SetDeadband(effectPtr, x, y, z)
- End Method
-
- Rem
- bbdoc: Sets the position of the dead zone.
- End Rem
- Method SetCenter(x:Int, y:Int = 0, z:Int = 0)
- bmx_sdl_haptic_SDLHapticCondition_SetCenter(effectPtr, x, y, z)
- End Method
-
- End Type
- Rem
- bbdoc: A template for a ramp effect.
- about: The ramp effect starts at start strength and ends at end strength.
- It augments in linear fashion. If you use attack and fade with a ramp the effects get added to the ramp effect
- making the effect become quadratic instead of linear.
- End Rem
- Type TSDLHapticRamp Extends TSDLHapticEffect
- Rem
- bbdoc: Creates a new instance of the effect.
- End Rem
- Method New()
- effectPtr = bmx_sdl_haptic_SDLHapticRamp_new()
- End Method
- Rem
- bbdoc: Returns the duration of effect (ms).
- End Rem
- Method GetLength:UInt()
- Return bmx_sdl_haptic_SDLHapticRamp_GetLength(effectPtr)
- End Method
- Rem
- bbdoc: Returns the delay before starting effect.
- End Rem
- Method GetDelay:Short()
- Return bmx_sdl_haptic_SDLHapticRamp_GetDelay(effectPtr)
- End Method
-
- Rem
- bbdoc: Returns the button that triggers effect.
- End Rem
- Method GetButton:Short()
- Return bmx_sdl_haptic_SDLHapticRamp_GetButton(effectPtr)
- End Method
-
- Rem
- bbdoc: Returns how soon before effect can be triggered again.
- End Rem
- Method GetInterval:Short()
- Return bmx_sdl_haptic_SDLHapticRamp_GetInterval(effectPtr)
- End Method
-
- Rem
- bbdoc: Returns the duration of the attack (ms).
- End Rem
- Method GetAttackLength:Short()
- Return bmx_sdl_haptic_SDLHapticRamp_GetAttackLength(effectPtr)
- End Method
-
- Rem
- bbdoc: Returns the level at the start of the attack.
- End Rem
- Method GetAttackLevel:Short()
- Return bmx_sdl_haptic_SDLHapticRamp_GetAttackLevel(effectPtr)
- End Method
-
- Rem
- bbdoc: Returns the duration of the fade out (ms).
- End Rem
- Method GetFadeLength:Short()
- Return bmx_sdl_haptic_SDLHapticRamp_GetFadeLength(effectPtr)
- End Method
-
- Rem
- bbdoc: Returns the level at the end of the fade.
- End Rem
- Method GetFadeLevel:Short()
- Return bmx_sdl_haptic_SDLHapticRamp_GetFadeLevel(effectPtr)
- End Method
- Rem
- bbdoc: Returns the effect direction.
- about: This instance is owned by the effect, and any changes will apply only to this effect.
- End Rem
- Method Direction:TSDLHapticDirection()
- Return TSDLHapticDirection._create(bmx_sdl_haptic_SDLHapticRamp_Direction(effectPtr))
- End Method
- Rem
- bbdoc: Sets the duration of the effect.
- about: This effect does not support a duration of SDL_HAPTIC_INFINITY.
- End Rem
- Method SetLength(value:UInt)
- bmx_sdl_haptic_SDLHapticRamp_SetLength(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the delay before starting the effect.
- End Rem
- Method SetDelay(value:Short)
- bmx_sdl_haptic_SDLHapticRamp_SetDelay(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the button that triggers the effect.
- End Rem
- Method SetButton(value:Short)
- bmx_sdl_haptic_SDLHapticRamp_SetButton(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets how soon it can be triggered again after button.
- End Rem
- Method SetInterval(value:Short)
- bmx_sdl_haptic_SDLHapticRamp_SetInterval(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the beginning strength level.
- End Rem
- Method SetStart(value:Int)
- bmx_sdl_haptic_SDLHapticRamp_SetStart(effectPtr, value)
- End Method
- Rem
- bbdoc: Sets the ending strength level.
- End Rem
- Method SetEnd(value:Int)
- bmx_sdl_haptic_SDLHapticRamp_SetEnd(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the duration of the attack.
- End Rem
- Method SetAttackLength(value:Short)
- bmx_sdl_haptic_SDLHapticRamp_SetAttackLength(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the level at the start of the attack.
- End Rem
- Method SetAttackLevel(value:Short)
- bmx_sdl_haptic_SDLHapticRamp_SetAttackLevel(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the duration of the fade.
- End Rem
- Method SetFadeLength(value:Short)
- bmx_sdl_haptic_SDLHapticRamp_SetFadeLength(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the level at the end of the fade.
- End Rem
- Method SetFadeLevel(value:Short)
- bmx_sdl_haptic_SDLHapticRamp_SetFadeLevel(effectPtr, value)
- End Method
- End Type
- Rem
- bbdoc: Controls the large and small motors, commonly found in modern game controllers.
- about: One motor is high frequency, the other is low frequency.
- End Rem
- Type TSDLHapticLeftRight Extends TSDLHapticEffect
- Rem
- bbdoc: Creates a new instance of the effect.
- End Rem
- Method New()
- effectPtr = bmx_sdl_haptic_SDLHapticLeftRight_new()
- End Method
- Rem
- bbdoc: Sets the duration of the effect.
- End Rem
- Method SetLength(value:UInt)
- bmx_sdl_haptic_SDLHapticLeftRight_SetLength(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the control of the large controller motor.
- End Rem
- Method SetLargeMagnitude(value:Short)
- bmx_sdl_haptic_SDLHapticLeftRight_SetLargeMagnitude(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the control of the small controller motor.
- End Rem
- Method SetSmallMagnitude(value:Short)
- bmx_sdl_haptic_SDLHapticLeftRight_SetSmallMagnitude(effectPtr, value)
- End Method
-
- End Type
- Rem
- bbdoc: A custom force feedback effect.
- about: The effect is much like a periodic effect, where the application can define its exact shape.
- You will have to allocate the data yourself. data should consist of channels * samples Short samples.
- If channels is 1, the effect is rotated using the defined direction. Otherwise it uses the samples in data for the different axes.
- End Rem
- Type TSDLHapticCustom Extends TSDLHapticEffect
- Rem
- bbdoc: Creates a new instance of the effect.
- End Rem
- Method New()
- effectPtr = bmx_sdl_haptic_SDLHapticCustom_new()
- End Method
- Rem
- bbdoc: Returns the duration of effect (ms).
- End Rem
- Method GetLength:UInt()
- Return bmx_sdl_haptic_SDLHapticCustom_GetLength(effectPtr)
- End Method
- Rem
- bbdoc: Returns the delay before starting effect.
- End Rem
- Method GetDelay:Short()
- Return bmx_sdl_haptic_SDLHapticCustom_GetDelay(effectPtr)
- End Method
-
- Rem
- bbdoc: Returns the button that triggers effect.
- End Rem
- Method GetButton:Short()
- Return bmx_sdl_haptic_SDLHapticCustom_GetButton(effectPtr)
- End Method
-
- Rem
- bbdoc: Returns how soon before effect can be triggered again.
- End Rem
- Method GetInterval:Short()
- Return bmx_sdl_haptic_SDLHapticCustom_GetInterval(effectPtr)
- End Method
-
- Rem
- bbdoc: Returns the duration of the attack (ms).
- End Rem
- Method GetAttackLength:Short()
- Return bmx_sdl_haptic_SDLHapticCustom_GetAttackLength(effectPtr)
- End Method
-
- Rem
- bbdoc: Returns the level at the start of the attack.
- End Rem
- Method GetAttackLevel:Short()
- Return bmx_sdl_haptic_SDLHapticCustom_GetAttackLevel(effectPtr)
- End Method
-
- Rem
- bbdoc: Returns the duration of the fade out (ms).
- End Rem
- Method GetFadeLength:Short()
- Return bmx_sdl_haptic_SDLHapticCustom_GetFadeLength(effectPtr)
- End Method
-
- Rem
- bbdoc: Returns the level at the end of the fade.
- End Rem
- Method GetFadeLevel:Short()
- Return bmx_sdl_haptic_SDLHapticCustom_GetFadeLevel(effectPtr)
- End Method
- Rem
- bbdoc: Returns the effect direction.
- about: This instance is owned by the effect, and any changes will apply only to this effect.
- End Rem
- Method Direction:TSDLHapticDirection()
- Return TSDLHapticDirection._create(bmx_sdl_haptic_SDLHapticCustom_Direction(effectPtr))
- End Method
- Rem
- bbdoc: Sets the duration of the effect.
- about: You can pass SDL_HAPTIC_INFINITY to length instead of a 0-32767 value.
- End Rem
- Method SetLength(value:UInt)
- bmx_sdl_haptic_SDLHapticCustom_SetLength(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the delay before starting the effect.
- End Rem
- Method SetDelay(value:Short)
- bmx_sdl_haptic_SDLHapticCustom_SetDelay(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the button that triggers the effect.
- End Rem
- Method SetButton(value:Short)
- bmx_sdl_haptic_SDLHapticCustom_SetButton(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets how soon it can be triggered again after button.
- End Rem
- Method SetInterval(value:Short)
- bmx_sdl_haptic_SDLHapticCustom_SetInterval(effectPtr, value)
- End Method
- Rem
- bbdoc: Sets the axes to use, minimum of 1.
- about: If channels is 1, the effect is rotated using the defined direction. Otherwise it uses the samples in data for the different axes.
- End Rem
- Method SetChannels(value:Byte)
- bmx_sdl_haptic_SDLHapticCustom_SetChannels(effectPtr, value)
- End Method
- Rem
- bbdoc: Sets the sample periods.
- End Rem
- Method SetPeriod(value:Byte)
- bmx_sdl_haptic_SDLHapticCustom_SetChannels(effectPtr, value)
- End Method
- Rem
- bbdoc: Sets the samples data.
- End Rem
- Method SetData(data:Short[])
- bmx_sdl_haptic_SDLHapticCustom_SetData(effectPtr, data, data.length)
- End Method
- Rem
- bbdoc: Sets the duration of the attack.
- End Rem
- Method SetAttackLength(value:Short)
- bmx_sdl_haptic_SDLHapticCustom_SetAttackLength(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the level at the start of the attack.
- End Rem
- Method SetAttackLevel(value:Short)
- bmx_sdl_haptic_SDLHapticCustom_SetAttackLevel(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the duration of the fade.
- End Rem
- Method SetFadeLength(value:Short)
- bmx_sdl_haptic_SDLHapticCustom_SetFadeLength(effectPtr, value)
- End Method
-
- Rem
- bbdoc: Sets the level at the end of the fade.
- End Rem
- Method SetFadeLevel(value:Short)
- bmx_sdl_haptic_SDLHapticCustom_SetFadeLevel(effectPtr, value)
- End Method
- End Type
- SDL_InitSubSystem(SDL_INIT_HAPTIC)
|