www.xiquinho.com/mybooks/file/599/PDF[
^]
This book goes over DirectInput, how to load & play force effect and has demo code. I followed the book, wrote the loading/playing code, and it runs without error. However it is not doing anything with the joystick. So, I followed the demo code also, but I'm having trouble with this part. The Demo is in page 213. Do I continue writing the code after public void Start(int iterations, bool restart), inside public class ForceEffect{}? When I try to do foreach() code in page 214, foreach goes outside of public class ForceEffect.
public class ForceEffect
{
System.Collections.ArrayList effectlist;
string name;
public string Name
{
get { return name; }
}
public ForceEffect( string filename, string name, Device device)
{
// save the name
this.name = name;
effectlist = new System.Collections.ArrayList();
EffectList effects;
effects = device.GetEffects(filename, FileEffectsFlags.ModifyIfNeeded);
foreach( FileEffect e in effects)
{
EffectObject effect = new EffectObject(e.EffectGuid, e.EffectStruct, device);
effectlist.Add(effect);
}
}
public void Start(int iterations, bool restart)
{
foreach(EffectObject effect in effectlist)
{
if(!effect.EffectStatus.Playing || restart)
{
effect.Start(iterations, 0);
}
}
}
/*
ForceEffect[] effects;
string instructions;
int currenteffect;
bool lastfiring = false;
bool lastchanging = false;
*/
}