コード例 #1
0
ファイル: TwoDAxis.cs プロジェクト: veyvin/ChimeraClean
 public TwoDAxis(VerticalAxis axis, bool x, bool right)
     : base((right ? "Right" : "Left") + (x ? "X" : "Y"))
 {
     mX           = x;
     mWrappedAxis = axis;
     foreach (var source in mWrappedAxis.Sources)
     {
         source.OnPress += i => {
             mDown          = true;
             mCurrentlyDown = source;
         };
         source.OnRelease += i => {
             mDown          = false;
             mCurrentlyDown = null;
         };
     }
     if (!mX)
     {
         Deadzone.Changed += v => mWrappedAxis.Deadzone.Value = v;
         Scale.Changed    += v => mWrappedAxis.Scale.Value = v;
     }
     else
     {
         Deadzone.Changed += v => mWrappedAxis.Change();
     }
 }
コード例 #2
0
        void input_FrameAdded(Frame rame, EventArgs args)
        {
            if (mConfig.Frame == null || rame.Name.Equals(mConfig.Frame))
            {
                mFrame = rame;

                List <ITouchSource> sources = new List <ITouchSource>();
                sources.Add(this);
                if (mOverlayPlugin != null)
                {
                    sources.Add(new OverlayTouchSource(mOverlayPlugin[rame.Name]));
                }

                mL      = new VerticalAxis(sources.ToArray());
                mR      = new VerticalAxis(sources.ToArray());
                mLeftX  = new TwoDAxis(mL, true, false);
                mLeftY  = new TwoDAxis(mL, false, false);
                mRightX = new TwoDAxis(mR, true, true);
                mRightY = new TwoDAxis(mR, false, true);
                mSingle = new VerticalAxis(sources.ToArray());

                mL.W        = mConfig.LeftW;
                mL.H        = mConfig.LeftH;
                mL.PaddingH = mConfig.LeftPaddingH;
                mL.PaddingV = mConfig.LeftPaddingV;

                mR.W        = mConfig.RightW;
                mR.H        = mConfig.RightH;
                mR.PaddingH = mConfig.RightPaddingH;
                mR.PaddingV = mConfig.RightPaddingV;

                mSingle.W        = mConfig.SingleW;
                mSingle.H        = mConfig.SingleH;
                mSingle.PaddingH = mConfig.SinglePaddingH;
                mSingle.PaddingV = mConfig.SinglePaddingV;

                mSinglePos = mConfig.SinglePos;

                mL.SizeChanged      += OnChange;
                mR.SizeChanged      += OnChange;
                mSingle.SizeChanged += OnChange;
                OnChange();

                AddAxis(mLeftX);
                AddAxis(mLeftY);
                AddAxis(mRightX);
                AddAxis(mRightY);
                AddAxis(mSingle);

                Core input = rame.Core;

                if (Enabled)
                {
                    Enabled = true;
                }
            }
        }
コード例 #3
0
 public TwoDAxis(VerticalAxis axis, bool x, bool right)
     : base((right ? "Right" : "Left") + (x ? "X" : "Y"))
 {
     mX = x;
     mWrappedAxis = axis;
     foreach (var source in mWrappedAxis.Sources) {
         source.OnPress += i => {
             mDown = true;
             mCurrentlyDown = source;
         };
         source.OnRelease += i => {
             mDown = false;
             mCurrentlyDown = null;
         };
     }
     if (!mX) {
         Deadzone.Changed += v => mWrappedAxis.Deadzone.Value = v;
         Scale.Changed += v => mWrappedAxis.Scale.Value = v;
     } else
         Deadzone.Changed += v => mWrappedAxis.Change();
 }
コード例 #4
0
        void input_FrameAdded(Frame rame, EventArgs args)
        {
            if (mConfig.Frame == null || rame.Name.Equals(mConfig.Frame)) {
                mFrame = rame;

                List<ITouchSource> sources = new List<ITouchSource>();
                sources.Add(this);
                if (mOverlayPlugin != null)
                    sources.Add(new OverlayTouchSource(mOverlayPlugin[rame.Name]));

                mL = new VerticalAxis(sources.ToArray());
                mR = new VerticalAxis(sources.ToArray());
                mLeftX = new TwoDAxis(mL, true, false);
                mLeftY = new TwoDAxis(mL, false, false);
                mRightX = new TwoDAxis(mR, true, true);
                mRightY = new TwoDAxis(mR, false, true);
                mSingle = new VerticalAxis(sources.ToArray());

                mL.W = mConfig.LeftW;
                mL.H = mConfig.LeftH;
                mL.PaddingH = mConfig.LeftPaddingH;
                mL.PaddingV = mConfig.LeftPaddingV;

                mR.W = mConfig.RightW;
                mR.H = mConfig.RightH;
                mR.PaddingH = mConfig.RightPaddingH;
                mR.PaddingV = mConfig.RightPaddingV;

                mSingle.W = mConfig.SingleW;
                mSingle.H = mConfig.SingleH;
                mSingle.PaddingH = mConfig.SinglePaddingH;
                mSingle.PaddingV = mConfig.SinglePaddingV;

                mSinglePos = mConfig.SinglePos;

                mL.SizeChanged += OnChange;
                mR.SizeChanged += OnChange;
                mSingle.SizeChanged += OnChange;
                OnChange();

                AddAxis(mLeftX);
                AddAxis(mLeftY);
                AddAxis(mRightX);
                AddAxis(mRightY);
                AddAxis(mSingle);

                Core input = rame.Core;

                if (Enabled)
                    Enabled = true;
            }
        }