Ejemplo n.º 1
0
        protected override bool OnMouseMove(InputState state)
        {
            if (dragging)
            {
                Debug.Assert(state.Mouse.PositionMouseDown != null);

                // don't start rotating until we're moved a minimum distance away from the mouse down location,
                // else it can have an annoying effect.
                startRotation |= Vector2Extensions.Distance(state.Mouse.Position, state.Mouse.PositionMouseDown.Value) > 30;

                if (startRotation)
                {
                    Vector2 offset  = state.Mouse.Position - state.Mouse.PositionMouseDown.Value;
                    float   degrees = (float)MathHelper.RadiansToDegrees(Math.Atan2(-offset.X, offset.Y)) + 24.3f;

                    // Always rotate in the direction of least distance
                    float diff = (degrees - ActiveCursor.Rotation) % 360;
                    if (diff < -180)
                    {
                        diff += 360;
                    }
                    if (diff > 180)
                    {
                        diff -= 360;
                    }
                    degrees = ActiveCursor.Rotation + diff;

                    ActiveCursor.RotateTo(degrees, 600, Easing.OutQuint);
                }
            }

            return(base.OnMouseMove(state));
        }
Ejemplo n.º 2
0
 protected override void PopOut()
 {
     ActiveCursor.FadeTo(0, 1400, EasingTypes.OutQuint);
     ActiveCursor.ScaleTo(1.1f, 100, EasingTypes.Out);
     ActiveCursor.Delay(100);
     ActiveCursor.ScaleTo(0, 500, EasingTypes.In);
 }
Ejemplo n.º 3
0
 protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
 {
     if (!state.Mouse.HasMainButtonPressed)
     {
         ActiveCursor.ScaleTo(1, 200, EasingTypes.OutQuad);
     }
     return(base.OnMouseUp(state, args));
 }
Ejemplo n.º 4
0
        protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
        {
            ActiveCursor.Scale = new Vector2(1);
            ActiveCursor.ScaleTo(0.90f, 800, EasingTypes.OutQuint);

            ((Cursor)ActiveCursor).AdditiveLayer.Alpha = 0;
            ((Cursor)ActiveCursor).AdditiveLayer.FadeInFromZero(800, EasingTypes.OutQuint);
            return(base.OnMouseDown(state, args));
        }
Ejemplo n.º 5
0
 protected override void OnCreated()
 {
     Device             = this;
     FO                 = new Drawing3d.Font("Arial");
     ActiveC            = new ActiveCursor();
     ActiveC.xAxisColor = Color.Red;
     ActiveC.yAxisColor = Color.Red;
     ActiveC.zAxisColor = Color.Red;
     ActiveC.PenWidth   = 3;
     SetEntityKind(Entitykind.Boxentity);
 }
Ejemplo n.º 6
0
        protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
        {
            if (!state.Mouse.HasMainButtonPressed)
            {
                ((Cursor)ActiveCursor).AdditiveLayer.FadeOut(500, EasingTypes.OutQuint);
                ActiveCursor.RotateTo(0, 600 * (1 + Math.Abs(ActiveCursor.Rotation / 720)), EasingTypes.OutElasticHalf);
                ActiveCursor.ScaleTo(1, 500, EasingTypes.OutElastic);
            }

            return(base.OnMouseUp(state, args));
        }
Ejemplo n.º 7
0
        public bool OnPressed(OsuAction action)
        {
            switch (action)
            {
            case OsuAction.LeftButton:
            case OsuAction.RightButton:
                downCount++;
                ActiveCursor.ScaleTo(1).ScaleTo(1.2f, 100, Easing.OutQuad);
                break;
            }

            return(false);
        }
Ejemplo n.º 8
0
        protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
        {
            ActiveCursor.Scale = new Vector2(1);
            ActiveCursor.ScaleTo(0.90f, 800, Easing.OutQuint);

            ((Cursor)ActiveCursor).AdditiveLayer.Alpha = 0;
            ((Cursor)ActiveCursor).AdditiveLayer.FadeInFromZero(800, Easing.OutQuint);

            if (args.Button == MouseButton.Left && cursorRotate)
            {
                dragRotationState = DragRotationState.DragStarted;
                positionMouseDown = state.Mouse.Position;
            }
            return(base.OnMouseDown(state, args));
        }
Ejemplo n.º 9
0
        public bool OnReleased(OsuAction action)
        {
            switch (action)
            {
            case OsuAction.LeftButton:
            case OsuAction.RightButton:
                if (--downCount == 0)
                {
                    ActiveCursor.ScaleTo(1, 200, Easing.OutQuad);
                }
                break;
            }

            return(false);
        }
Ejemplo n.º 10
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            showCursor.BindValueChanged(v =>
            {
                if (v.NewValue)
                {
                    ActiveCursor.Show();
                }
                else
                {
                    ActiveCursor.Hide();
                }
            }, true);
        }
Ejemplo n.º 11
0
        private void calculateScale()
        {
            float scale = userCursorScale.Value;

            if (autoCursorScale.Value && beatmap != null)
            {
                // if we have a beatmap available, let's get its circle size to figure out an automatic cursor scale modifier.
                scale *= GetScaleForCircleSize(beatmap.BeatmapInfo.BaseDifficulty.CircleSize);
            }

            CursorScale.Value = scale;

            var newScale = new Vector2(scale);

            ActiveCursor.ScaleTo(newScale, 400, Easing.OutQuint);
            cursorTrail.Scale = newScale;
        }
Ejemplo n.º 12
0
        protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
        {
            if (!state.Mouse.HasMainButtonPressed)
            {
                ((Cursor)ActiveCursor).AdditiveLayer.FadeOut(500, Easing.OutQuint);
                ActiveCursor.ScaleTo(1, 500, Easing.OutElastic);
            }

            if (args.Button == MouseButton.Left)
            {
                if (dragRotationState == DragRotationState.Rotating)
                {
                    ActiveCursor.RotateTo(0, 600 * (1 + Math.Abs(ActiveCursor.Rotation / 720)), Easing.OutElasticHalf);
                }
                dragRotationState = DragRotationState.NotDragging;
            }
            return(base.OnMouseUp(state, args));
        }
Ejemplo n.º 13
0
        protected override bool OnMouseMove(InputState state)
        {
            if (dragRotationState != DragRotationState.NotDragging)
            {
                var position = state.Mouse.Position;
                var distance = Vector2Extensions.Distance(position, positionMouseDown);
                // don't start rotating until we're moved a minimum distance away from the mouse down location,
                // else it can have an annoying effect.
                if (dragRotationState == DragRotationState.DragStarted && distance > 30)
                {
                    dragRotationState = DragRotationState.Rotating;
                }
                // don't rotate when distance is zero to avoid NaN
                if (dragRotationState == DragRotationState.Rotating && distance > 0)
                {
                    Vector2 offset  = state.Mouse.Position - positionMouseDown;
                    float   degrees = (float)MathHelper.RadiansToDegrees(Math.Atan2(-offset.X, offset.Y)) + 24.3f;

                    // Always rotate in the direction of least distance
                    float diff = (degrees - ActiveCursor.Rotation) % 360;
                    if (diff < -180)
                    {
                        diff += 360;
                    }
                    if (diff > 180)
                    {
                        diff -= 360;
                    }
                    degrees = ActiveCursor.Rotation + diff;

                    ActiveCursor.RotateTo(degrees, 600, Easing.OutQuint);
                }
            }

            return(base.OnMouseMove(state));
        }
Ejemplo n.º 14
0
        protected override bool OnMouseMove(InputState state)
        {
            if (dragging)
            {
                Vector2 offset  = state.Mouse.Position - state.Mouse.PositionMouseDown ?? state.Mouse.Delta;
                float   degrees = (float)MathHelper.RadiansToDegrees(Math.Atan2(-offset.X, offset.Y)) + 24.3f;

                // Always rotate in the direction of least distance
                float diff = (degrees - ActiveCursor.Rotation) % 360;
                if (diff < -180)
                {
                    diff += 360;
                }
                if (diff > 180)
                {
                    diff -= 360;
                }
                degrees = ActiveCursor.Rotation + diff;

                ActiveCursor.RotateTo(degrees, 600, EasingTypes.OutQuint);
            }

            return(base.OnMouseMove(state));
        }
Ejemplo n.º 15
0
        public override bool HandlePositionalInput => true; // OverlayContainer will set this false when we go hidden, but we always want to receive input.

        protected override void PopIn()
        {
            fadeContainer.FadeTo(1, 300, Easing.OutQuint);
            ActiveCursor.ScaleTo(1, 400, Easing.OutQuint);
        }
Ejemplo n.º 16
0
 protected override void PopOut()
 {
     fadeContainer.FadeTo(0.05f, 450, Easing.OutQuint);
     ActiveCursor.ScaleTo(0.8f, 450, Easing.OutQuint);
 }
Ejemplo n.º 17
0
 protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
 {
     ActiveCursor.Scale = new Vector2(1);
     ActiveCursor.ScaleTo(1.2f, 100, EasingTypes.OutQuad);
     return(base.OnMouseDown(state, args));
 }
Ejemplo n.º 18
0
 protected override void PopOut()
 {
     ActiveCursor.FadeTo(0, 250, Easing.OutQuint);
     ActiveCursor.ScaleTo(0.6f, 250, Easing.In);
 }
Ejemplo n.º 19
0
 protected override void PopIn()
 {
     ActiveCursor.FadeTo(1, 250, Easing.OutQuint);
     ActiveCursor.ScaleTo(1, 400, Easing.OutQuint);
 }
Ejemplo n.º 20
0
 protected override void PopIn()
 {
     ActiveCursor.FadeTo(1, 250, EasingTypes.OutQuint);
     ActiveCursor.ScaleTo(1, 1000, EasingTypes.OutElastic);
 }
Ejemplo n.º 21
0
 protected override void PopOut()
 {
     ActiveCursor.FadeTo(0, 900, EasingTypes.OutQuint);
     ActiveCursor.ScaleTo(0, 500, EasingTypes.In);
 }