From 2e3a782fdc7073c6be059d843f94ded9b52399a5 Mon Sep 17 00:00:00 2001 From: yugecin Date: Sat, 4 Mar 2017 14:26:55 +0100 Subject: [PATCH] put common hitcircle render code in separate class --- src/itdelatrisu/opsu/objects/Circle.java | 37 ++----- src/itdelatrisu/opsu/objects/Slider.java | 50 ++++----- .../opsu/render/CurveRenderState.java | 4 +- src/itdelatrisu/opsu/states/Game.java | 20 ++-- src/yugecin/opsudance/Dancer.java | 8 +- src/yugecin/opsudance/Pippi.java | 8 +- .../core/inject/OpsuDanceInjector.java | 3 + .../movers/factories/AutoMoverFactory.java | 4 +- .../opsudance/render/GameObjectRenderer.java | 103 ++++++++++++++++++ 9 files changed, 164 insertions(+), 73 deletions(-) create mode 100644 src/yugecin/opsudance/render/GameObjectRenderer.java diff --git a/src/itdelatrisu/opsu/objects/Circle.java b/src/itdelatrisu/opsu/objects/Circle.java index 56d393b2..8fea0fa6 100644 --- a/src/itdelatrisu/opsu/objects/Circle.java +++ b/src/itdelatrisu/opsu/objects/Circle.java @@ -20,7 +20,6 @@ package itdelatrisu.opsu.objects; import itdelatrisu.opsu.GameData; import itdelatrisu.opsu.GameData.HitObjectType; -import itdelatrisu.opsu.GameImage; import itdelatrisu.opsu.GameMod; import itdelatrisu.opsu.Options; import itdelatrisu.opsu.Utils; @@ -30,16 +29,18 @@ import itdelatrisu.opsu.states.Game; import itdelatrisu.opsu.ui.Colors; import org.newdawn.slick.Color; -import org.newdawn.slick.GameContainer; import org.newdawn.slick.Graphics; import yugecin.opsudance.Dancer; +import yugecin.opsudance.core.inject.Inject; +import yugecin.opsudance.render.GameObjectRenderer; /** * Data type representing a circle object. */ public class Circle extends GameObject { - /** The diameter of hit circles. */ - public static float diameter; + + @Inject + private GameObjectRenderer gameObjectRenderer; /** The associated HitObject. */ private HitObject hitObject; @@ -62,18 +63,6 @@ public class Circle extends GameObject { private int comboColorIndex; - /** - * Initializes the Circle data type with map modifiers, images, and dimensions. - * @param circleDiameter the circle diameter - */ - public static void init(float circleDiameter) { - diameter = circleDiameter * HitObject.getXMultiplier(); // convert from Osupixels (640x480) - int diameterInt = (int) diameter; - GameImage.HITCIRCLE.setImage(GameImage.HITCIRCLE.getImage().getScaledCopy(diameterInt, diameterInt)); - GameImage.HITCIRCLE_OVERLAY.setImage(GameImage.HITCIRCLE_OVERLAY.getImage().getScaledCopy(diameterInt, diameterInt)); - GameImage.APPROACHCIRCLE.setImage(GameImage.APPROACHCIRCLE.getImage().getScaledCopy(diameterInt, diameterInt)); - } - /** * Constructor. * @param hitObject the associated HitObject @@ -129,16 +118,10 @@ public class Circle extends GameObject { float oldAlpha = Colors.WHITE_FADE.a; Colors.WHITE_FADE.a = color.a = alpha; - if (timeDiff >= 0 && !GameMod.HIDDEN.isActive() && Options.isDrawApproach()) - GameImage.APPROACHCIRCLE.getImage().getScaledCopy(approachScale).drawCentered(x, y, color); - GameImage.HITCIRCLE.getImage().drawCentered(x, y, color); - boolean overlayAboveNumber = Options.getSkin().isHitCircleOverlayAboveNumber(); - if (!overlayAboveNumber) - GameImage.HITCIRCLE_OVERLAY.getImage().drawCentered(x, y, Colors.WHITE_FADE); - data.drawSymbolNumber(hitObject.getComboNumber(), x, y, - GameImage.HITCIRCLE.getImage().getWidth() * 0.40f / data.getDefaultSymbolImage(0).getHeight(), alpha); - if (overlayAboveNumber) - GameImage.HITCIRCLE_OVERLAY.getImage().drawCentered(x, y, Colors.WHITE_FADE); + if (timeDiff >= 0) { + gameObjectRenderer.renderApproachCircle(x, y, color, approachScale); + } + gameObjectRenderer.renderHitCircle(x, y, color, hitObject.getComboNumber(), alpha); Colors.WHITE_FADE.a = oldAlpha; @@ -172,7 +155,7 @@ public class Circle extends GameObject { @Override public boolean mousePressed(int x, int y, int trackPosition) { double distance = Math.hypot(this.x - x, this.y - y); - if (distance < diameter / 2) { + if (distance < gameObjectRenderer.getCircleDiameter() / 2) { int timeDiff = trackPosition - hitObject.getTime(); int result = hitResult(timeDiff); diff --git a/src/itdelatrisu/opsu/objects/Slider.java b/src/itdelatrisu/opsu/objects/Slider.java index f661c523..fbd8e698 100644 --- a/src/itdelatrisu/opsu/objects/Slider.java +++ b/src/itdelatrisu/opsu/objects/Slider.java @@ -37,11 +37,20 @@ import org.newdawn.slick.Graphics; import org.newdawn.slick.Image; import yugecin.opsudance.Dancer; import yugecin.opsudance.core.DisplayContainer; +import yugecin.opsudance.core.inject.Inject; +import yugecin.opsudance.render.GameObjectRenderer; /** * Data type representing a slider object. */ public class Slider extends GameObject { + + @Inject + private DisplayContainer displayContainer; + + @Inject + private GameObjectRenderer gameObjectRenderer; + /** Slider ball frames. */ private static Image[] sliderBallImages; @@ -54,9 +63,6 @@ public class Slider extends GameObject { /** Follow circle radius. */ private static float followRadius; - /** The diameter of hit circles. */ - private static float diameter; - /** The associated HitObject. */ private HitObject hitObject; @@ -116,9 +122,6 @@ public class Slider extends GameObject { private static final int FOLLOW_EXPAND_TIME = 150; private static final int FOLLOW_SHRINK_TIME = 100; - /** Container dimensions. */ - private static int containerWidth, containerHeight; - private int repeats; private static Color curveColor = new Color(0, 0, 0, 20); @@ -134,14 +137,9 @@ public class Slider extends GameObject { * @param circleDiameter the circle diameter * @param beatmap the associated beatmap */ - public static void init(DisplayContainer displayContainer, float circleDiameter, Beatmap beatmap) { - containerWidth = displayContainer.width; - containerHeight = displayContainer.height; - - diameter = circleDiameter * HitObject.getXMultiplier(); // convert from Osupixels (640x480) - int diameterInt = (int) diameter; - - followRadius = diameter / 2 * 3f; + public static void init(float circleDiameter, Beatmap beatmap) { + followRadius = circleDiameter / 2 * 3f; + int diameterInt = (int) circleDiameter; // slider ball if (GameImage.SLIDER_BALL.hasBeatmapSkinImages() || @@ -219,8 +217,6 @@ public class Slider extends GameObject { boolean overlayAboveNumber = Options.getSkin().isHitCircleOverlayAboveNumber(); float oldAlpha = Colors.WHITE_FADE.a; Colors.WHITE_FADE.a = color.a = alpha; - Image hitCircleOverlay = GameImage.HITCIRCLE_OVERLAY.getImage(); - Image hitCircle = GameImage.HITCIRCLE.getImage(); Vec2f endPos = curve.pointAt(1); float oldWhiteFadeAlpha = Colors.WHITE_FADE.a; @@ -249,8 +245,8 @@ public class Slider extends GameObject { circleColor.a = overlayColor.a = sliderAlpha * getCircleAlphaAfterRepeat(trackPosition, true); } Vec2f endCircPos = curve.pointAt(1f); - hitCircle.drawCentered(endCircPos.x, endCircPos.y, circleColor); - hitCircleOverlay.drawCentered(endCircPos.x, endCircPos.y, overlayColor); + gameObjectRenderer.renderHitCircleOnly(endCircPos.x, endCircPos.y, circleColor); + gameObjectRenderer.renderHitCircleOverlayOnly(endCircPos.x, endCircPos.y, overlayColor); } g.pushTransform(); @@ -268,9 +264,10 @@ public class Slider extends GameObject { // start circle, only draw if ball still has to go there if (!sliderClickedInitial || (Options.isDrawSliderEndCircles() && currentRepeats < repeatCount - (repeatCount % 2 == 1 ? 1 : 0))) { - hitCircle.drawCentered(x, y, firstCircleColor); - if (!overlayAboveNumber || sliderClickedInitial) - hitCircleOverlay.drawCentered(x, y, startCircleOverlayColor); + gameObjectRenderer.renderHitCircleOnly(x, y, firstCircleColor); + if (!overlayAboveNumber || sliderClickedInitial) { + gameObjectRenderer.renderHitCircleOverlayOnly(x, y, startCircleOverlayColor); + } } g.popTransform(); @@ -297,12 +294,11 @@ public class Slider extends GameObject { // draw combo number and overlay if not initially clicked if (!sliderClickedInitial) { - data.drawSymbolNumber(hitObject.getComboNumber(), x, y, - hitCircle.getWidth() * 0.40f / data.getDefaultSymbolImage(0).getHeight(), alpha); + gameObjectRenderer.renderComboNumberOnly(x, y, hitObject.getComboNumber(), alpha); if (overlayAboveNumber) { startCircleOverlayColor.a = sliderAlpha; - hitCircleOverlay.drawCentered(x, y, startCircleOverlayColor); + gameObjectRenderer.renderHitCircleOverlayOnly(x, y, startCircleOverlayColor); } } @@ -340,7 +336,7 @@ public class Slider extends GameObject { g.rotate(x, y, -180f); } if (!GameMod.HIDDEN.isActive() && Options.isDrawApproach()) { - GameImage.APPROACHCIRCLE.getImage().getScaledCopy(approachScale).drawCentered(x, y, color); + gameObjectRenderer.renderApproachCircle(x, y, color, approachScale); } g.popTransform(); } else { @@ -394,7 +390,7 @@ public class Slider extends GameObject { float oldAlphaBlack = Colors.BLACK_ALPHA.a; Colors.BLACK_ALPHA.a = 0.75f; g.setColor(Colors.BLACK_ALPHA); - g.fillRect(0, 0, containerWidth, containerHeight); + g.fillRect(0, 0, displayContainer.width, displayContainer.height); Colors.BLACK_ALPHA.a = oldAlphaBlack; } } @@ -606,7 +602,7 @@ public class Slider extends GameObject { return false; double distance = Math.hypot(this.x - x, this.y - y); - if (distance < diameter / 2) { + if (distance < gameObjectRenderer.getCircleDiameter() / 2) { int timeDiff = Math.abs(trackPosition - hitObject.getTime()); int[] hitResultOffset = game.getHitResultOffsets(); diff --git a/src/itdelatrisu/opsu/render/CurveRenderState.java b/src/itdelatrisu/opsu/render/CurveRenderState.java index a70846b6..f2d7e3cb 100644 --- a/src/itdelatrisu/opsu/render/CurveRenderState.java +++ b/src/itdelatrisu/opsu/render/CurveRenderState.java @@ -21,7 +21,6 @@ import itdelatrisu.opsu.GameImage; import itdelatrisu.opsu.Options; import itdelatrisu.opsu.Utils; import itdelatrisu.opsu.beatmap.HitObject; -import itdelatrisu.opsu.objects.Circle; import itdelatrisu.opsu.objects.curves.Vec2f; import java.nio.ByteBuffer; @@ -37,6 +36,7 @@ import org.lwjgl.opengl.GL20; import org.newdawn.slick.Color; import org.newdawn.slick.Image; import org.newdawn.slick.util.Log; +import yugecin.opsudance.render.GameObjectRenderer; /** * Hold the temporary render state that needs to be restored again after the new @@ -303,7 +303,7 @@ public class CurveRenderState { double diff_x = x - last_x; double diff_y = y - last_y; float dist = Utils.distance(x, y, last_x, last_y); - if (dist < Circle.diameter / 8) { + if (dist < GameObjectRenderer.instance.getCircleDiameter() / 8) { x = (float) (x - diff_x / 2); y = (float) (y - diff_y / 2); } else { diff --git a/src/itdelatrisu/opsu/states/Game.java b/src/itdelatrisu/opsu/states/Game.java index 99d2ff69..7e29f88b 100644 --- a/src/itdelatrisu/opsu/states/Game.java +++ b/src/itdelatrisu/opsu/states/Game.java @@ -73,6 +73,7 @@ import yugecin.opsudance.core.state.transitions.FadeOutTransitionState; import yugecin.opsudance.events.BarNotificationEvent; import yugecin.opsudance.events.BubbleNotificationEvent; import yugecin.opsudance.objects.curves.FakeCombinedCurve; +import yugecin.opsudance.render.GameObjectRenderer; import yugecin.opsudance.sbv2.MoveStoryboard; import yugecin.opsudance.ui.OptionsOverlay; import yugecin.opsudance.ui.StoryboardOverlay; @@ -86,6 +87,9 @@ public class Game extends ComplexOpsuState { @Inject private InstanceContainer instanceContainer; + @Inject + private GameObjectRenderer gameObjectRenderer; + public static boolean isInGame; // TODO delete this when #79 is fixed /** Game restart states. */ public enum Restart { @@ -362,6 +366,7 @@ public class Game extends ComplexOpsuState { // create the associated GameData object data = new GameData(displayContainer.width, displayContainer.height); + gameObjectRenderer.setGameData(data); } @@ -1560,12 +1565,13 @@ public class Game extends ComplexOpsuState { } try { - if (hitObject.isCircle()) - gameObjects[i] = new Circle(hitObject, this, data, hitObject.getComboIndex(), comboEnd); - else if (hitObject.isSlider()) - gameObjects[i] = new Slider(hitObject, this, data, hitObject.getComboIndex(), comboEnd); - else if (hitObject.isSpinner()) + if (hitObject.isCircle()) { + gameObjects[i] = instanceContainer.injectFields(new Circle(hitObject, this, data, hitObject.getComboIndex(), comboEnd)); + } else if (hitObject.isSlider()) { + gameObjects[i] = instanceContainer.injectFields(new Slider(hitObject, this, data, hitObject.getComboIndex(), comboEnd)); + } else if (hitObject.isSpinner()) { gameObjects[i] = new Spinner(hitObject, this, data); + } } catch (Exception e) { String message = String.format("Failed to create %s at index %d:\n%s", hitObject.getTypeName(), i, hitObject.toString()); Log.error(message, e); @@ -2036,8 +2042,8 @@ public class Game extends ComplexOpsuState { HitObject.setStackOffset(diameter * STACK_OFFSET_MODIFIER); // initialize objects - Circle.init(diameter); - Slider.init(displayContainer, diameter, beatmap); + gameObjectRenderer.initForGame(data, diameter); + Slider.init(gameObjectRenderer.getCircleDiameter(), beatmap); Spinner.init(displayContainer, overallDifficulty); Curve.init(displayContainer.width, displayContainer.height, diameter, (Options.isBeatmapSkinIgnored()) ? Options.getSkin().getSliderBorderColor() : beatmap.getSliderBorderColor()); diff --git a/src/yugecin/opsudance/Dancer.java b/src/yugecin/opsudance/Dancer.java index 3dbc25f2..9015ebbd 100644 --- a/src/yugecin/opsudance/Dancer.java +++ b/src/yugecin/opsudance/Dancer.java @@ -25,7 +25,6 @@ import awlex.ospu.spinners.SpiralSpinner; import itdelatrisu.opsu.Options; import itdelatrisu.opsu.Utils; import itdelatrisu.opsu.audio.MusicController; -import itdelatrisu.opsu.objects.Circle; import itdelatrisu.opsu.objects.DummyObject; import itdelatrisu.opsu.objects.GameObject; import itdelatrisu.opsu.objects.Slider; @@ -37,6 +36,7 @@ import yugecin.opsudance.movers.factories.*; import yugecin.opsudance.movers.slidermovers.DefaultSliderMoverController; import yugecin.opsudance.movers.slidermovers.InheritedSliderMoverController; import yugecin.opsudance.movers.slidermovers.SliderMoverController; +import yugecin.opsudance.render.GameObjectRenderer; import yugecin.opsudance.spinners.*; import java.awt.*; @@ -193,12 +193,12 @@ public class Dancer { } isCurrentLazySlider = false; // detect lazy sliders, should work pretty good - if (c.isSlider() && Options.isLazySliders() && Utils.distance(c.start.x, c.start.y, c.end.x, c.end.y) <= Circle.diameter * 0.8f) { + if (c.isSlider() && Options.isLazySliders() && Utils.distance(c.start.x, c.start.y, c.end.x, c.end.y) <= GameObjectRenderer.instance.getCircleDiameter() * 0.8f) { Slider s = (Slider) c; Vec2f mid = s.getCurve().pointAt(1f); - if (s.getRepeats() == 1 || Utils.distance(c.start.x, c.start.y, mid.x, mid.y) <= Circle.diameter * 0.8f) { + if (s.getRepeats() == 1 || Utils.distance(c.start.x, c.start.y, mid.x, mid.y) <= GameObjectRenderer.instance.getCircleDiameter() * 0.8f) { mid = s.getCurve().pointAt(0.5f); - if (Utils.distance(c.start.x, c.start.y, mid.x, mid.y) <= Circle.diameter * 0.8f) { + if (Utils.distance(c.start.x, c.start.y, mid.x, mid.y) <= GameObjectRenderer.instance.getCircleDiameter() * 0.8f) { isCurrentLazySlider = true; } } diff --git a/src/yugecin/opsudance/Pippi.java b/src/yugecin/opsudance/Pippi.java index 2130c6a7..6455d9c8 100644 --- a/src/yugecin/opsudance/Pippi.java +++ b/src/yugecin/opsudance/Pippi.java @@ -18,9 +18,9 @@ package yugecin.opsudance; import itdelatrisu.opsu.Options; -import itdelatrisu.opsu.objects.Circle; import itdelatrisu.opsu.objects.GameObject; import itdelatrisu.opsu.objects.Slider; +import yugecin.opsudance.render.GameObjectRenderer; public class Pippi { @@ -37,14 +37,14 @@ public class Pippi { public static void setRadiusPercent(int radiusPercent) { Pippi.radiusPercent = radiusPercent; - pippiminrad = pippirad = (Circle.diameter / 2d - 10d) * radiusPercent / 100d; + pippiminrad = pippirad = (GameObjectRenderer.instance.getCircleDiameter() / 2d - 10d) * radiusPercent / 100d; } public static void reset() { angle = 0; currentdelta = 0; setRadiusPercent(radiusPercent); - pippimaxrad = Circle.diameter - 10d; + pippimaxrad = GameObjectRenderer.instance.getCircleDiameter() - 10d; } public static void dance(int time, GameObject c, boolean isCurrentLazySlider) { @@ -91,7 +91,7 @@ public class Pippi { } public static boolean shouldPreventWobblyStream(double distance) { - return Options.isPippiEnabled() && distance < Circle.diameter * 0.93f && Options.isPippiPreventWobblyStreams(); + return Options.isPippiEnabled() && distance < GameObjectRenderer.instance.getCircleDiameter() * 0.93f && Options.isPippiPreventWobblyStreams(); } } diff --git a/src/yugecin/opsudance/core/inject/OpsuDanceInjector.java b/src/yugecin/opsudance/core/inject/OpsuDanceInjector.java index 9c9d4479..341b0810 100644 --- a/src/yugecin/opsudance/core/inject/OpsuDanceInjector.java +++ b/src/yugecin/opsudance/core/inject/OpsuDanceInjector.java @@ -27,6 +27,7 @@ import yugecin.opsudance.core.state.transitions.EmptyTransitionState; import yugecin.opsudance.core.state.transitions.FadeInTransitionState; import yugecin.opsudance.core.state.transitions.FadeOutTransitionState; import yugecin.opsudance.core.errorhandling.ErrorHandler; +import yugecin.opsudance.render.GameObjectRenderer; public class OpsuDanceInjector extends Injector { @@ -44,6 +45,8 @@ public class OpsuDanceInjector extends Injector { bind(FadeInTransitionState.class).asEagerSingleton(); bind(FadeOutTransitionState.class).asEagerSingleton(); + bind(GameObjectRenderer.class).asEagerSingleton(); + bind(Splash.class).asEagerSingleton(); bind(MainMenu.class).asEagerSingleton(); bind(ButtonMenu.class).asEagerSingleton(); diff --git a/src/yugecin/opsudance/movers/factories/AutoMoverFactory.java b/src/yugecin/opsudance/movers/factories/AutoMoverFactory.java index 2a904833..40c09600 100644 --- a/src/yugecin/opsudance/movers/factories/AutoMoverFactory.java +++ b/src/yugecin/opsudance/movers/factories/AutoMoverFactory.java @@ -20,10 +20,10 @@ package yugecin.opsudance.movers.factories; import itdelatrisu.opsu.Options; import itdelatrisu.opsu.Utils; import itdelatrisu.opsu.beatmap.HitObject; -import itdelatrisu.opsu.objects.Circle; import itdelatrisu.opsu.objects.GameObject; import yugecin.opsudance.Pippi; import yugecin.opsudance.movers.*; +import yugecin.opsudance.render.GameObjectRenderer; public class AutoMoverFactory implements MoverFactory { @@ -43,7 +43,7 @@ public class AutoMoverFactory implements MoverFactory { // stacked: circles if not too quick int circle_stream = Options.isCircleStreams() ? 58: 85; - if (distance < Circle.diameter && ((dt > circle_stream && !Options.isOnlyCircleStacks()) || distance < HitObject.getStackOffset() * 5.2f)) { // TODO get the correct multiplier for stackoffsets + if (distance < GameObjectRenderer.instance.getCircleDiameter() && ((dt > circle_stream && !Options.isOnlyCircleStacks()) || distance < HitObject.getStackOffset() * 5.2f)) { // TODO get the correct multiplier for stackoffsets return new CircleMover(start, end, dir); } diff --git a/src/yugecin/opsudance/render/GameObjectRenderer.java b/src/yugecin/opsudance/render/GameObjectRenderer.java new file mode 100644 index 00000000..86622f0b --- /dev/null +++ b/src/yugecin/opsudance/render/GameObjectRenderer.java @@ -0,0 +1,103 @@ +/* + * opsu!dance - fork of opsu! with cursordance auto + * Copyright (C) 2017 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.render; + +import itdelatrisu.opsu.GameData; +import itdelatrisu.opsu.GameImage; +import itdelatrisu.opsu.GameMod; +import itdelatrisu.opsu.Options; +import itdelatrisu.opsu.beatmap.HitObject; +import itdelatrisu.opsu.ui.Colors; +import org.newdawn.slick.Color; +import org.newdawn.slick.Image; +import yugecin.opsudance.core.DisplayContainer; +import yugecin.opsudance.core.inject.Inject; + +public class GameObjectRenderer { + + @Inject + private DisplayContainer displayContainer; + + private GameData gameData; + + private float circleDiameter; + + private Image hitcircle; + private Image hitcircleOverlay; + private Image approachCircle; + + @Deprecated + public static GameObjectRenderer instance; + + public GameObjectRenderer() { + instance = this; // TODO get rid of this + } + + public void initForGame(GameData gameData, float circleDiameter) { + this.gameData = gameData; + this.circleDiameter = circleDiameter * HitObject.getXMultiplier(); // convert from Osupixels (640x480) + int diameterInt = (int) this.circleDiameter; + GameImage.HITCIRCLE.setImage(GameImage.HITCIRCLE.getImage().getScaledCopy(diameterInt, diameterInt)); + GameImage.HITCIRCLE_OVERLAY.setImage(GameImage.HITCIRCLE_OVERLAY.getImage().getScaledCopy(diameterInt, diameterInt)); + GameImage.APPROACHCIRCLE.setImage(GameImage.APPROACHCIRCLE.getImage().getScaledCopy(diameterInt, diameterInt)); + hitcircle = GameImage.HITCIRCLE.getImage(); + hitcircleOverlay = GameImage.HITCIRCLE_OVERLAY.getImage(); + approachCircle = GameImage.APPROACHCIRCLE.getImage(); + } + + public float getCircleDiameter() { + return circleDiameter; + } + + public void setGameData(GameData gameData) { + this.gameData = gameData; + } + + public void renderHitCircle(float x, float y, Color color, int comboNumber, float comboNumberAlpha) { + renderHitCircleOnly(x, y, color); + boolean overlayAboveNumber = Options.getSkin().isHitCircleOverlayAboveNumber(); + if (!overlayAboveNumber) { + renderHitCircleOverlayOnly(x, y, Colors.WHITE_FADE); + } + renderComboNumberOnly(x, y, comboNumber, comboNumberAlpha); + if (overlayAboveNumber) { + renderHitCircleOverlayOnly(x, y, Colors.WHITE_FADE); + } + } + + public void renderHitCircleOnly(float x, float y, Color color) { + hitcircle.drawCentered(x, y, color); + } + + public void renderHitCircleOverlayOnly(float x, float y, Color color) { + hitcircleOverlay.drawCentered(x, y, color); + } + + public void renderComboNumberOnly(float x, float y, int number, float alpha) { + if (number > 0) { + gameData.drawSymbolNumber(number, x, y, GameImage.HITCIRCLE.getImage().getWidth() * 0.40f / gameData.getDefaultSymbolImage(0).getHeight(), alpha); + } + } + + public void renderApproachCircle(float x, float y, Color color, float approachScale) { + if (!GameMod.HIDDEN.isActive() && Options.isDrawApproach()) { + approachCircle.getScaledCopy(approachScale).drawCentered(x, y, color); + } + } + +}