问题描述
我在用DirectX的DirectInput编写游戏的力反馈时,无法实现GUID_Damper,即用DICONDITION参数定义的力反馈,那位牛人有配置的相关参数?我不知道参数该怎么设,网上搜了搜,没有一个例子,光给了一个大概范围,怎么设都出不来!多谢啊
解决方案
解决方案二:
关注,目前我只做到directsound部分的
解决方案三:
up
解决方案四:
DirectInput有一个接口,DIRECTINPUTEFFECT,只要创建了他就可以实现力反馈.具体实现方法如下:1、首先判断设备是否支持力反馈用设备性能参数DIEDFL_FORCEFEEDBACK指定要枚举设备支持力反馈2、枚举类型如果楼主是要持续的力反馈就不用这样枚举了,因为我也不清楚你要的特效,也许对你有帮助
HRESULTEnumEffects(LPDIENUMEFFECTSCALLBACKlpCallback,LPVOIDpvRef,DWORDdwEffType);3、创建力反馈
HRESTLTCreateEffect(REFGUIDrguid,LPCDIEFFECTlpeff,LPDIRECTINPUTEFFECT*ppdeff,//反馈类型LPUNKNOWNpunkOuter);其中力反馈的类型有很多 你可以查阅相关API文档 我这里就给你一中持续力效果GUID_ConstantForce4、播放力反馈//触发键定义diEffect.dwTriggerButton=DIEB_NOTRIGGER;//永不停止diEffect.dwDuration=INFINITE;//开始播放g-lpdiEffect-Start(1,0);//停止他g-lpdiEffect->Stop();//设置他的属性来改变力反馈效果hr=g_lpdiEffect->SetParameters(&diEffect,DIEP_TYPESPECIFICPARAMS);希望对楼主有所帮助,至于楼主说的那个参数定义的力反馈小弟真没尝试过,但是我的方法绝对可行,请楼主多多指教,如果还不清楚,晚些我会写出具体CODE测试!!
解决方案五:
HRESTLTCreateEffect(REFGUIDrguid,LPCDIEFFECTlpeff,//反馈类型LPDIRECTINPUTEFFECT*ppdeff,LPUNKNOWNpunkOuter);刚刚写太快,有个地方注释错误LPCDIEFFECTlpeff便是力反馈的具体效果,可以指定震动的强度、相位、增益、周期等参数楼主所说的风力效果GUID_Damper是定义在lpeff的,应该可行,只是效果改变,无太大妨碍
解决方案六:
该回复于2008-05-11 15:10:00被版主删除
解决方案七:
HRESULTEnumEffects(LPDIENUMEFFECTSCALLBACKlpCallback,LPVOIDpvRef,DWORDdwEffType);ParameterslpCallbackAddressofanapplication-definedcallbackfunction.ThedeclarationofthisfunctionmustconformtothatoftheDIEnumEffectsCallbackprototype.pvRefA32-bitapplication-definedvaluetobepassedtothecallbackfunction.Thisparametercanbeany32-bittype;itisdeclaredasLPVOIDforconvenience.dwEffTypeEffecttypefilter.UseoneoftheDIEFT_*valuestoindicatetheeffecttypetobeenumerated,orDIEFT_ALLtoenumeratealleffecttypes.Foralistofthesevalues,seeDIEFFECTINFO.
解决方案八:
IDirectInputDevice8::CreateEffect[Thisispreliminarydocumentationandissubjecttochange.]CreatesandinitializesaninstanceofaneffectidentifiedbytheeffectGUID.HRESULTCreateEffect(REFGUIDrguid,LPCDIEFFECTlpeff,LPDIRECTINPUTEFFECT*ppdeff,LPUNKNOWNpunkOuter);ParametersrguidReferenceto(C++)oraddressof(C)theGUIDidentifyingtheeffecttobecreated.ThiscanbeapredefinedeffectGUID,oritcanbeaGUIDobtainedfromIDirectInputDevice8::EnumEffects.ThefollowingstandardeffectGUIDsaredefined:GUID_ConstantForceGUID_RampForceGUID_SquareGUID_SineGUID_TriangleGUID_SawtoothUpGUID_SawtoothDownGUID_SpringGUID_DamperGUID_InertiaGUID_FrictionGUID_CustomForcelpeffDIEFFECTstructurethatprovidesparametersforthecreatedeffect.Thisparameterisoptional.IfitisNULL,theeffectobjectiscreatedwithoutparameters.TheapplicationmustthencalltheIDirectInputEffect::SetParametersmethodtosettheparametersoftheeffectbeforeitcandownloadtheeffect.ppdeffAddressofavariabletoreceiveapointertotheIDirectInputEffectinterfaceifsuccessful.punkOuterControllingunknownforCOMaggregation.ThevalueisNULLiftheinterfaceisnotaggregated.MostcallerspassNULL.