示例#1
0
        //ForceFeedbackEnvelope envelope;
        //uint gain = nominalMaxGain;
        //float samplePeriod;

        //

        internal ForceFeedbackEffect(ForceFeedbackController owner, ForceFeedbackEffectTypes effectType,
                                     JoystickAxes[] axes)
        {
            this.owner      = owner;
            this.effectType = effectType;

            this.axes = new JoystickAxes[axes.Length];
            for (int n = 0; n < axes.Length; n++)
            {
                this.axes[n] = axes[n];
            }
            this.axesAsReadOnly = new ReadOnlyCollection <JoystickAxes>(this.axes);

            //if( axes.Length > 1 )
            //{
            //   direction = new float[ this.axes.Length ];
            //   directionAsReadOnly = new ReadOnlyCollection<float>( direction );
            //}

            //envelope = new ForceFeedbackEnvelope( this );
        }
示例#2
0
 internal ForceFeedbackRampEffect(ForceFeedbackController owner, JoystickAxes[] axes)
     : base(owner, ForceFeedbackEffectTypes.Ramp, axes)
 {
 }
示例#3
0
 internal ForceFeedbackConstantForceEffect(ForceFeedbackController owner, JoystickAxes[] axes)
     : base(owner, ForceFeedbackEffectTypes.ConstantForce, axes)
 {
 }
示例#4
0
 internal ForceFeedbackPeriodicEffect(ForceFeedbackController owner,
                                      ForceFeedbackEffectTypes effectType, JoystickAxes[] axes)
     : base(owner, effectType, axes)
 {
 }
        protected void InitDeviceData(Button[] buttons, Axis[] axes, POV[] povs, Slider[] sliders,
                                      ForceFeedbackController forceFeedbackController)
        {
            //buttons
            {
                foreach (Button button in buttons)
                {
                    if (button == null)
                    {
                        Log.Fatal("JoystickInputDevice: SetButtons: " +
                                  "Button in the array is not initialized.");
                    }
                }

                this.buttons = buttons;

                //buttonsDictionary
                {
                    int count = 0;
                    foreach (Button button in buttons)
                    {
                        int key = (int)button.Name;
                        if (key >= count)
                        {
                            count = key + 1;
                        }
                    }

                    buttonsDictionary = new Button[count];

                    foreach (Button button in buttons)
                    {
                        int key = (int)button.Name;
                        buttonsDictionary[key] = button;
                    }
                }
            }

            //axes
            {
                foreach (Axis axis in axes)
                {
                    if (axis == null)
                    {
                        Log.Fatal("JoystickInputDevice: SetAxes: " +
                                  "Axis in the array is not initialized.");
                    }
                }

                this.axes = axes;

                //axesDictionary
                {
                    int count = 0;
                    foreach (Axis axis in axes)
                    {
                        int key = (int)axis.Name;
                        if (key >= count)
                        {
                            count = key + 1;
                        }
                    }

                    axesDictionary = new Axis[count];

                    foreach (Axis axis in axes)
                    {
                        int key = (int)axis.Name;
                        axesDictionary[key] = axis;
                    }
                }
            }

            //povs
            {
                foreach (POV pov in povs)
                {
                    if (pov == null)
                    {
                        Log.Fatal("JoystickInputDevice: SetPOVs: " +
                                  "POV in the array is not initialized.");
                    }
                }

                this.povs = povs;

                //povsDictionary
                {
                    int count = 0;
                    foreach (POV pov in povs)
                    {
                        int key = (int)pov.Name;
                        if (key >= count)
                        {
                            count = key + 1;
                        }
                    }

                    povsDictionary = new POV[count];

                    foreach (POV pov in povs)
                    {
                        int key = (int)pov.Name;
                        povsDictionary[key] = pov;
                    }
                }
            }

            //sliders
            {
                foreach (Slider slider in sliders)
                {
                    if (slider == null)
                    {
                        Log.Fatal("JoystickInputDevice: SetSliders: " +
                                  "Slider in the array is not initialized.");
                    }
                }

                this.sliders = sliders;

                //slidersDictionary
                {
                    int count = 0;
                    foreach (Slider slider in sliders)
                    {
                        int key = (int)slider.Name;
                        if (key >= count)
                        {
                            count = key + 1;
                        }
                    }

                    slidersDictionary = new Slider[count];

                    foreach (Slider slider in sliders)
                    {
                        int key = (int)slider.Name;
                        slidersDictionary[key] = slider;
                    }
                }
            }

            //forceFeedbackController
            this.forceFeedbackController = forceFeedbackController;
        }