Exemplo n.º 1
0
        private void TickListener()
        {
            float x = mManager.CursorPosition.X;
            float y = mManager.CursorPosition.Y;

            foreach (var axis in mAxes.Where(a => a.Binding == AxisBinding.MouseX || a.Binding == AxisBinding.MouseY))
            {
                //This is the code that moves the mouse!
                if (axis.Binding == AxisBinding.MouseX)
                {
                    x += axis.Delta;
                }
                else
                {
                    y += axis.Delta;
                }
            }
            mManager.UpdateCursor(Math.Max(Math.Min(x, .999999999), 0), Math.Max(Math.Min(y, .999999999), 0));
        }
Exemplo n.º 2
0
        void Nui_Tick()
        {
            float x = mX.Value;
            float y = mY.Value;

            if (Disabled)
            {
                return;
            }

            if (mLocation.X != y || mLocation.Y != y)
            {
                mLocation = new PointF(x, y);

                if (mBounds.Contains(mLocation) && !OnScreen)
                {
                    if (CursorEnter != null && mEnabled)
                    {
                        CursorEnter(this);
                    }
                }
                else if (!mBounds.Contains(mLocation) && OnScreen)
                {
                    if (CursorLeave != null && mEnabled)
                    {
                        CursorLeave(this);
                    }
                }

                if (mEnabled && Nui.HasSkeleton)
                {
                    if (CursorMove != null)
                    {
                        CursorMove(this, x, y);
                    }
                    mManager.UpdateCursor(x, y);
                }
            }
        }