diff options
author | Sven Gothel <sgothel@jausoft.com> | 2010-11-22 12:46:19 +0100 |
---|---|---|
committer | Sven Gothel <sgothel@jausoft.com> | 2010-11-22 12:46:19 +0100 |
commit | 4c3e9e258fae1161949dd14828c09f387bfd53d9 (patch) | |
tree | a8b287153f6afbf166db85506af4c3790590663d /src/jogl/classes/javax/media/opengl | |
parent | 6a3ccca96e6d4c27c372b4b9ba1e8fcee6def402 (diff) |
GLAnimatorControl pause()/resume() don't fail fast, return a boolean instead to simplify usage.
Diffstat (limited to 'src/jogl/classes/javax/media/opengl')
-rw-r--r-- | src/jogl/classes/javax/media/opengl/GLAnimatorControl.java | 14 | ||||
-rw-r--r-- | src/jogl/classes/javax/media/opengl/awt/GLCanvas.java | 5 |
2 files changed, 9 insertions, 10 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLAnimatorControl.java b/src/jogl/classes/javax/media/opengl/GLAnimatorControl.java index 98d7bc48b..0282b3ad0 100644 --- a/src/jogl/classes/javax/media/opengl/GLAnimatorControl.java +++ b/src/jogl/classes/javax/media/opengl/GLAnimatorControl.java @@ -32,8 +32,8 @@ package javax.media.opengl; * An animator control interface, * which implementation may drive a {@link javax.media.opengl.GLAutoDrawable} animation. * <P> - * Note that the methods {@link #start()}, {@link #stop()}, {@link #pause()} and {@link #resume()} - * shall be implemented to fail-fast, ie {@link #start()} fails if not started, etc. + * Note that the methods {@link #start()} and {@link #stop()} + * shall be implemented fail-fast, ie {@link #start()} fails if not started, etc. * This way an implementation can find implementation errors faster. */ public interface GLAnimatorControl { @@ -157,11 +157,12 @@ public interface GLAnimatorControl { * or in some cases from an implementation-internal thread like the * AWT event queue thread. * + * @return false if if not started or already paused, otherwise true + * * @see #resume() * @see #isAnimating() - * @throws GLException if not started or already paused */ - void pause(); + boolean pause(); /** * Resumes animation if paused. @@ -173,11 +174,12 @@ public interface GLAnimatorControl { * <P> * If resumed, all counters (time, frames, ..) are reset to zero. * + * @return false if if not started or not paused, otherwise true + * * @see #pause() * @see #isAnimating() - * @throws GLException if not started or not paused */ - void resume(); + boolean resume(); /** * Removes a drawable from the animator's list of rendering drawables.<br> diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java index 265c7ff49..b2d919eaf 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java @@ -351,10 +351,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable { GLAnimatorControl animator = getAnimator(); if(null!=animator) { if(regenerate) { - if(animator.isStarted() && !animator.isPaused()) { - animator.pause(); - animatorPaused = true; - } + animatorPaused = animator.pause(); } else { animator.remove(this); } |