Microsoft DirectX 8.1 (Visual Basic) |
The DirectInputDevice8.GetEffectsEnum method enumerates effects supported by the device. It returns a DirectInputEnumEffects object representing the collection of supported effects. Methods of DirectInputEnumEffects can be used to get information about a particular effect.
It is important to distinguish between supported effects and created effects, or effect objects. A supported effect might be a constant force that can be shaped by an envelope. However, this effect has no properties such as magnitude, direction, duration, attack, or fade. You set these properties when you create an effect object in your application. A supported effect can be represented by many effect objects, each with different parameters—for example, several constant forces, each with different duration, magnitude, and direction.
The following code example shows how an application could enumerate hardware-specific effects, looking for a particular effect supported by the Microsoft® SideWinder® joystick. If the desired effect is not found, the application substitutes one of the standard effects:
Const BasketballDribble = _ "{E84CD1AC-81FA-11D0-94AB-0080C74C7E95}" Dim diEnumEffects As DirectInputEnumEffects Dim EffGuid As String Dim i As Integer ' diDev is a DirectInputDevice object. Set diEnumEffects = didev.GetEffectsEnum(DIEFT_HARDWARE) For i = 1 To diEnumEffects.GetCount If diEnumEffects.GetEffectGuid(i) = BasketballDribble Then EffGuid = BasketballDribble Exit For End If Next i If EffGuid <> BasketballDribble Then EffGuid = "GUID_Sine" ' Set parameters for emulated dribble here . . . End If
Ultimately, EffGuid is passed to DirectInputDevice8.CreateEffect.