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)); }
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); }
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) { if (!state.Mouse.HasMainButtonPressed) { ActiveCursor.ScaleTo(1, 200, EasingTypes.OutQuad); } return(base.OnMouseUp(state, args)); }
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)); }
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); }
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)); }
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); }
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)); }
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); }
protected override void LoadComplete() { base.LoadComplete(); showCursor.BindValueChanged(v => { if (v.NewValue) { ActiveCursor.Show(); } else { ActiveCursor.Hide(); } }, true); }
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; }
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)); }
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)); }
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)); }
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); }
protected override void PopOut() { fadeContainer.FadeTo(0.05f, 450, Easing.OutQuint); ActiveCursor.ScaleTo(0.8f, 450, Easing.OutQuint); }
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)); }
protected override void PopOut() { ActiveCursor.FadeTo(0, 250, Easing.OutQuint); ActiveCursor.ScaleTo(0.6f, 250, Easing.In); }
protected override void PopIn() { ActiveCursor.FadeTo(1, 250, Easing.OutQuint); ActiveCursor.ScaleTo(1, 400, Easing.OutQuint); }
protected override void PopIn() { ActiveCursor.FadeTo(1, 250, EasingTypes.OutQuint); ActiveCursor.ScaleTo(1, 1000, EasingTypes.OutElastic); }
protected override void PopOut() { ActiveCursor.FadeTo(0, 900, EasingTypes.OutQuint); ActiveCursor.ScaleTo(0, 500, EasingTypes.In); }