本文整理汇总了C#中Effect.Start方法的典型用法代码示例。如果您正苦于以下问题:C# Effect.Start方法的具体用法?C# Effect.Start怎么用?C# Effect.Start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Effect
的用法示例。
在下文中一共展示了Effect.Start方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StartFFBEffect
/// <summary>
/// Starts playback of an effect.
/// </summary>
/// <param name="ef">
/// Effect which is to be played.
/// </param>
/// <returns>
/// Returns true if successful, otherwise returns false.
/// </returns>
private bool StartFFBEffect(Effect ef)
{
SlimDX.Result res;
if (ef == null)
{
MessageBox.Show("NULL pointer to effect in \"DInputHandler::StartFFBEffect()\"",
FFBInspector.Properties.Resources.errCap_effError,
MessageBoxButtons.OK, MessageBoxIcon.Stop);
return false;
}
res = ffbDevice.Acquire();
if (!(res != ResultCode.Success || res != ResultCode.Failure))
{
MessageBox.Show("Cannot acquire the device.\n" +
"Make sure no other application is using the device\n" +
res.ToString(), FFBInspector.Properties.Resources.errCap_devError,
MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
res = ef.Start();
if (res != ResultCode.Success)
{
MessageBox.Show("Cannot start the effect.\n", FFBInspector.Properties.Resources.errCap_effError,
MessageBoxButtons.OK, MessageBoxIcon.Stop);
return false;
}
return true;
}
示例2: SetVibration
// Note that this does not appear to work at this time. I probably need to have more infos.
public void SetVibration(int left, int right)
{
int[] temp1, temp2;
// my first clue that it doesnt work is that LEFT and RIGHT _ARENT USED_
// I should just look for C++ examples instead of trying to look for SlimDX examples
var parameters = new EffectParameters
{
Duration = 0x2710,
Gain = 0x2710,
SamplePeriod = 0,
TriggerButton = 0,
TriggerRepeatInterval = 0x2710,
Flags = EffectFlags.None
};
parameters.GetAxes(out temp1, out temp2);
parameters.SetAxes(temp1, temp2);
var effect = new Effect(joystick, EffectGuid.ConstantForce);
effect.SetParameters(parameters);
effect.Start(1);
}