From 8421930f277b19e04df91f946312f0a6b6b357de Mon Sep 17 00:00:00 2001 From: yugecin Date: Sun, 20 Nov 2016 22:38:05 +0100 Subject: [PATCH] add star approach circle --- src/yugecin/opsudance/Dancer.java | 1 + .../FivePointStarApproachSpinner.java | 56 +++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 src/yugecin/opsudance/spinners/FivePointStarApproachSpinner.java diff --git a/src/yugecin/opsudance/Dancer.java b/src/yugecin/opsudance/Dancer.java index a1810519..59dbe028 100644 --- a/src/yugecin/opsudance/Dancer.java +++ b/src/yugecin/opsudance/Dancer.java @@ -69,6 +69,7 @@ public class Dancer { new ApproachCircleSpinner(), new SpiralSpinner(), new FivePointStarSpinner(), + new FivePointStarApproachSpinner(), }; public static SliderMoverController[] sliderMovers = new SliderMoverController[] { diff --git a/src/yugecin/opsudance/spinners/FivePointStarApproachSpinner.java b/src/yugecin/opsudance/spinners/FivePointStarApproachSpinner.java new file mode 100644 index 00000000..aee97dee --- /dev/null +++ b/src/yugecin/opsudance/spinners/FivePointStarApproachSpinner.java @@ -0,0 +1,56 @@ +/* + * opsu!dance - fork of opsu! with cursordance auto + * Copyright (C) 2016 yugecin + * + * opsu!dance is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * opsu!dance is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with opsu!dance. If not, see . + */ +package yugecin.opsudance.spinners; + +import itdelatrisu.opsu.Options; + +public class FivePointStarApproachSpinner extends Spinner { + + final double angleIncRads = Math.PI * 36d / 180d; + double ang; + final double[] point = new double[2]; + boolean odd; + + @Override + public void init() { + ang = -Math.PI / 2d; + odd = true; + } + + @Override + public double[] getPoint() { + if (waitForDelay()) { + ang += angleIncRads; + odd = !odd; + } + + double rad = Options.width / 4.0f * (1d - Spinner.PROGRESS); + if (!odd) { + rad /= 3d; + } + point[0] = Options.width / 2d + Math.cos(ang) * rad; + point[1] = Options.height / 2d + Math.sin(ang) * rad; + return point; + } + + @Override + public String toString() { + return "5-point approach star"; + } + +}