From c19cc492ccd4910e2f90d873cfd97286847df692 Mon Sep 17 00:00:00 2001 From: yugecin Date: Fri, 28 Apr 2017 22:57:21 +0200 Subject: [PATCH] remove unused transitionclasses --- .../transition/DelayedFadeOutTransition.java | 82 ------------------ .../transition/EasedFadeOutTransition.java | 83 ------------------- 2 files changed, 165 deletions(-) delete mode 100644 src/org/newdawn/slick/state/transition/DelayedFadeOutTransition.java delete mode 100644 src/org/newdawn/slick/state/transition/EasedFadeOutTransition.java diff --git a/src/org/newdawn/slick/state/transition/DelayedFadeOutTransition.java b/src/org/newdawn/slick/state/transition/DelayedFadeOutTransition.java deleted file mode 100644 index b6f9b2db..00000000 --- a/src/org/newdawn/slick/state/transition/DelayedFadeOutTransition.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.newdawn.slick.state.transition; - -import org.newdawn.slick.Color; -import org.newdawn.slick.GameContainer; -import org.newdawn.slick.Graphics; -import org.newdawn.slick.state.GameState; -import org.newdawn.slick.state.StateBasedGame; - -/** - * A transition to fade out to a given colour after a delay. - * - * @author kevin (base) - */ -public class DelayedFadeOutTransition implements Transition { - /** The color to fade to */ - private final Color color; - /** The time it takes the fade to happen */ - private final int fadeTime; - /** The time it takes before the fade starts */ - private final int delay; - /** The elapsed time */ - private int elapsedTime = 0; - - /** - * Create a new delayed fade out transition. - */ - public DelayedFadeOutTransition() { this(Color.black, 500, 0); } - - /** - * Create a new delayed fade out transition. - * - * @param color The color we're going to fade out to - */ - public DelayedFadeOutTransition(Color color) { this(color, 500, 0); } - - /** - * Create a new delayed fade out transition - * - * @param color The color we're going to fade out to - * @param fadeTime The time it takes the fade to occur - * @param delay The time before the fade starts (must be less than {@code fadeTime}) - * @throws IllegalArgumentException if {@code delay} is greater than {@code fadeTime} - */ - public DelayedFadeOutTransition(Color color, int fadeTime, int delay) { - if (delay > fadeTime) - throw new IllegalArgumentException(); - - this.color = new Color(color); - this.color.a = 0; - this.fadeTime = fadeTime; - this.delay = delay; - } - - @Override - public boolean isComplete() { return (color.a >= 1); } - - @Override - public void postRender(StateBasedGame game, GameContainer container, Graphics g) { - Color old = g.getColor(); - g.setColor(color); - g.fillRect(0, 0, container.getWidth() * 2, container.getHeight() * 2); - g.setColor(old); - } - - @Override - public void update(StateBasedGame game, GameContainer container, int delta) { - if (elapsedTime < delay) { - elapsedTime += delta; - return; - } - - color.a += delta * (1.0f / (fadeTime - delay)); - if (color.a > 1) - color.a = 1; - } - - @Override - public void preRender(StateBasedGame game, GameContainer container, Graphics g) {} - - @Override - public void init(GameState firstState, GameState secondState) {} -} diff --git a/src/org/newdawn/slick/state/transition/EasedFadeOutTransition.java b/src/org/newdawn/slick/state/transition/EasedFadeOutTransition.java deleted file mode 100644 index 8a904fd3..00000000 --- a/src/org/newdawn/slick/state/transition/EasedFadeOutTransition.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.newdawn.slick.state.transition; - -import itdelatrisu.opsu.ui.animations.AnimationEquation; - -import org.newdawn.slick.Color; -import org.newdawn.slick.GameContainer; -import org.newdawn.slick.Graphics; -import org.newdawn.slick.state.GameState; -import org.newdawn.slick.state.StateBasedGame; - -/** - * A transition to fade out to a given colour using an easing function. - * - * @author kevin (base) - */ -public class EasedFadeOutTransition implements Transition { - /** The color to fade to */ - private final Color color; - /** The time it takes the fade to happen */ - private final int fadeTime; - /** The easing function */ - private final AnimationEquation eq; - /** The transition progress */ - private float t = 0f; - - /** - * Create a new eased fade out transition. - */ - public EasedFadeOutTransition() { this(Color.black, 500, AnimationEquation.OUT_QUART); } - - /** - * Create a new eased fade out transition. - * - * @param color The color we're going to fade out to - */ - public EasedFadeOutTransition(Color color) { this(color, 500, AnimationEquation.OUT_QUART); } - - /** - * Create a new eased fade out transition. - * - * @param color The color we're going to fade out to - * @param fadeTime The time it takes the fade to occur - */ - public EasedFadeOutTransition(Color color, int fadeTime) { this(color, fadeTime, AnimationEquation.OUT_QUART); } - - /** - * Create a new eased fade out transition. - * - * @param color The color we're going to fade out to - * @param fadeTime The time it takes the fade to occur - * @param eq The easing function to use - */ - public EasedFadeOutTransition(Color color, int fadeTime, AnimationEquation eq) { - this.color = new Color(color); - this.color.a = 0; - this.fadeTime = fadeTime; - this.eq = eq; - } - - @Override - public boolean isComplete() { return (color.a >= 1); } - - @Override - public void postRender(StateBasedGame game, GameContainer container, Graphics g) { - Color old = g.getColor(); - g.setColor(color); - g.fillRect(0, 0, container.getWidth() * 2, container.getHeight() * 2); - g.setColor(old); - } - - @Override - public void update(StateBasedGame game, GameContainer container, int delta) { - t += delta * (1.0f / fadeTime); - float alpha = t > 1f ? 1f : eq.calc(t); - color.a = alpha; - } - - @Override - public void preRender(StateBasedGame game, GameContainer container, Graphics g) {} - - @Override - public void init(GameState firstState, GameState secondState) {} -}