From 216af4399f9e4ce676c399f2ffe72ca6d021d47d Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Sat, 7 Feb 2009 11:39:22 -0500 Subject: Fixed a transition problem --- src/com/fourisland/fourpuzzle/Display.java | 2 -- .../fourpuzzle/transition/DoNotEraseTransition.java | 5 ++++- .../fourisland/fourpuzzle/transition/SlideTransition.java | 2 +- src/com/fourisland/fourpuzzle/transition/Transition.java | 12 ++++++++++++ 4 files changed, 17 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/com/fourisland/fourpuzzle/Display.java b/src/com/fourisland/fourpuzzle/Display.java index f513d31..5f5a891 100644 --- a/src/com/fourisland/fourpuzzle/Display.java +++ b/src/com/fourisland/fourpuzzle/Display.java @@ -71,8 +71,6 @@ public class Display { if (transitionRunning) { - Game.getGameState().render(g); - if (transition != null) { if (transition.render(g)) diff --git a/src/com/fourisland/fourpuzzle/transition/DoNotEraseTransition.java b/src/com/fourisland/fourpuzzle/transition/DoNotEraseTransition.java index 027077c..55fe614 100644 --- a/src/com/fourisland/fourpuzzle/transition/DoNotEraseTransition.java +++ b/src/com/fourisland/fourpuzzle/transition/DoNotEraseTransition.java @@ -16,12 +16,15 @@ public class DoNotEraseTransition implements OutTransition { public boolean render(Graphics2D g) { + g.drawImage(preTransition, 0, 0, null); + return true; } + private BufferedImage preTransition; public void setPreTransition(BufferedImage preTransition) { - // Do nothing + this.preTransition = preTransition; } public Transition copy() diff --git a/src/com/fourisland/fourpuzzle/transition/SlideTransition.java b/src/com/fourisland/fourpuzzle/transition/SlideTransition.java index 81031fe..aa91061 100644 --- a/src/com/fourisland/fourpuzzle/transition/SlideTransition.java +++ b/src/com/fourisland/fourpuzzle/transition/SlideTransition.java @@ -55,7 +55,7 @@ public class SlideTransition implements MultidirectionalTransition { int max; SlideDirection way; public boolean render(Graphics2D g) - { + { if (max > 0) { tick = Math.min(tick + wait, max); diff --git a/src/com/fourisland/fourpuzzle/transition/Transition.java b/src/com/fourisland/fourpuzzle/transition/Transition.java index 8362d1a..e9b6d9f 100644 --- a/src/com/fourisland/fourpuzzle/transition/Transition.java +++ b/src/com/fourisland/fourpuzzle/transition/Transition.java @@ -24,5 +24,17 @@ public interface Transition { public void setPreTransition(BufferedImage preTransition); + /** + * Create another Transition with the same properties + * + * This function is used in the Database where default transitions are + * stored to be used in certain circumstances. When these transitions are + * needed, this function is called on them to create a copy of the + * Transition with the same parameters. Essentially, this function should + * return a new Transition of the same type constructed with the same + * parameters as the Transition this function is being called on. + * + * @return A copy of the specified Transition + */ public Transition copy(); } \ No newline at end of file -- cgit 1.4.1