コード例 #1
0
        void _UpdateDPad(DirectInputDPad dPad, DPadGaugeUC gauge, int dPadIndex)
        {
            gauge.Vector.Text = dPad.Vector.ToStringF4();
            gauge.Lenght.Text = dPad.Vector.Length().ToString("F4");
#if DEBUG
            gauge.VectorRaw.Text =
                //dPad.ParentDevice.RawDPadsStates[dPadIndex].ToString();
                dPad.AngleRad.ToString();
#endif
            _X            = Cmn.RangeConversion(-1, 0, DPadGaugeUC.RatioX, dPad.Vector.X);
            _Y            = Cmn.RangeConversion(1, 0, DPadGaugeUC.RatioY, dPad.Vector.Y);
            gauge.Line.X2 = _X;
            gauge.Line.Y2 = _Y;

            gauge.Thumb.Margin = new Thickness(_X - 10d, _Y - 10d, 0d, 0d);

            if (dPad.Up == ButtonState.Pressed)
            {
                gauge.ButtonUp.Background = Brushes.YellowGreen;
            }
            else
            {
                gauge.ButtonUp.Background = null;
            }

            _UpdateButtonIndicator(gauge.ButtonUp, dPad.Up);
            _UpdateButtonIndicator(gauge.ButtonDown, dPad.Down);
            _UpdateButtonIndicator(gauge.ButtonLeft, dPad.Left);
            _UpdateButtonIndicator(gauge.ButtonRight, dPad.Right);
        }
コード例 #2
0
        void _SetDPadsGaugeControls(DirectInputDPad[] dPads)
        {
            int index = Stack_DPads.Children.Count - 1;

            while (Stack_DPads.Children.Count > dPads.Length)
            {
                _GUI_DPadsGauges.RemoveAt(index);
                Stack_DPads.Children.RemoveAt(index);
                index--;
            }

            index = Stack_DPads.Children.Count;
            DPadGaugeUC gaugeControl;

            while (Stack_DPads.Children.Count < dPads.Length)
            {
                gaugeControl            = new DPadGaugeUC();
                gaugeControl.Label.Text = index.ToString();
                _GUI_DPadsGauges.Add(gaugeControl);
                Stack_DPads.Children.Add(gaugeControl);
                index++;
            }
        }