Jump to content
  • Advertisement
Sign in to follow this  

SharpDX help with exmaples.

This topic is 1069 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Looks like SharpDX is still around. I was able to do much basic stuff on my own with it but I need some help. Are there no forums left for shrapDX? I'm trying something simple like created a new force effect but I can not find a single code example on the matter.


Normally you do something like this with managed code.

e = new Effect();
                    e.SetDirection( new int[Axis.Length] );
                    e.SetAxes( new int[1] ); 
                    e.EffectType = Type;
                    e.ConditionStruct = new Condition[Axis.Length];
                    e.Duration = INFINITE;
                    e.Gain = 10000;
                    e.Constant = new ConstantForce();
                    e.Constant.Magnitude = Magnitude;
                    e.SamplePeriod = 0;
                    e.TriggerButton = (int)Microsoft.DirectX.DirectInput.Button.NoTrigger;
                    e.TriggerRepeatInterval = (int)DI.Infinite;
                    e.Flags = Flags;
                    e.UsesEnvelope = false;

                    // Create the effect, using the passed in guid.
                    eo = new EffectObject( ei.EffectGuid, e, Dev );

but I can not even create the effect with SharpDX as its expecting one of two constructors. I'm not even able to find a doc that has the right classes for SharpDX 3. Does anyone have a simple constant force example I could sample from?

Edited by ulao

Share this post

Link to post
Share on other sites

Well I learned much on my own here.  But I get ;


An unhandled exception of type 'SharpDX.SharpDXException' occurred in SharpDX.dll
Additional information: HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect.


on the marked line below. My guess is I didn't get the data correct. Its quite difficult with no example.


EffectParameters ep = new EffectParameters();
            foreach (var ei in allEffects)  
                Console.WriteLine("Effect available {0}", ei.Name);
                if (ei.Type.HasFlag( EffectType.ConstantForce ))
                    ep.Flags = EffectFlags.Cartesian | EffectFlags.ObjectOffsets;
                    ep.Directions= new int[1]{0};//MaxValue
                    ep.Gain = 10000;
                    ep.Duration = int.MaxValue;
                    ep.SetAxes (new int[1],new int[1]);
                    ep.SamplePeriod =0;
                   // ep.TriggerRepeatInterval = int.MaxValue;
                    Effect e = new Effect(joystick, ei.Guid, ep); <-- error

Edited by ulao

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!