public class FPSAnimator extends AnimatorBase
The Animator execution thread does not run as a daemon thread,
so it is able to keep an application from terminating.
Call stop()
to terminate the animation and it's execution thread.
AnimatorBase.AnimatorImpl, AnimatorBase.UncaughtAnimatorException
GLAnimatorControl.UncaughtExceptionHandler
MODE_EXPECT_AWT_RENDERING_THREAD
DEFAULT_FRAMES_PER_INTERVAL
Constructor and Description |
---|
FPSAnimator(GLAutoDrawable drawable,
int fps)
Creates an FPSAnimator with a given target frames-per-second
value and an initial drawable to animate.
|
FPSAnimator(GLAutoDrawable drawable,
int fps,
boolean scheduleAtFixedRate)
Creates an FPSAnimator with a given target frames-per-second
value, an initial drawable to animate, and a flag indicating
whether to use fixed-rate scheduling.
|
FPSAnimator(int fps)
Creates an FPSAnimator with a given target frames-per-second
value.
|
FPSAnimator(int fps,
boolean scheduleAtFixedRate)
Creates an FPSAnimator with a given target frames-per-second
value and a flag indicating whether to use fixed-rate
scheduling.
|
Modifier and Type | Method and Description |
---|---|
int |
getFPS() |
boolean |
isAnimating()
Indicates whether this animator
is started and is not paused . |
boolean |
isPaused()
Indicates whether this animator
is started
and either manually paused or paused
automatically due to no added GLAutoDrawable s. |
boolean |
pause()
Pauses this animator.
|
boolean |
resume()
Resumes animation if paused.
|
void |
setFPS(int fps) |
boolean |
start()
Starts this animator, if not running.
|
boolean |
stop()
Stops this FPSAnimator.
|
add, getExclusiveContextThread, getFPSStartTime, getLastFPS, getLastFPSPeriod, getLastFPSUpdateTime, getModeBits, getThread, getTotalFPS, getTotalFPSDuration, getTotalFPSFrames, getUncaughtExceptionHandler, getUpdateFPSFrames, isExclusiveContextEnabled, isStarted, remove, resetFPSCounter, setExclusiveContext, setExclusiveContext, setIgnoreExceptions, setModeBits, setPrintExceptions, setUncaughtExceptionHandler, setUpdateFPSFrames, toString
public FPSAnimator(int fps)
FPSAnimator(null, fps)
.public FPSAnimator(int fps, boolean scheduleAtFixedRate)
FPSAnimator(null, fps,
scheduleAtFixedRate)
.public FPSAnimator(GLAutoDrawable drawable, int fps)
FPSAnimator(null, fps, false)
.public FPSAnimator(GLAutoDrawable drawable, int fps, boolean scheduleAtFixedRate)
public final void setFPS(int fps) throws GLException
fps
- GLException
- if the animator has already been startedpublic final int getFPS()
public final boolean isAnimating()
GLAnimatorControl
is started
and is not paused
.public final boolean isPaused()
GLAnimatorControl
is started
and either manually paused
or paused
automatically due to no added
GLAutoDrawable
s.public final boolean start()
GLAnimatorControl
In most situations this method blocks until completion, except when called from the animation thread itself or in some cases from an implementation-internal thread like the AWT event queue thread.
Note that an animator w/o added drawables
will be paused automatically.
If started, all counters (time, frames, ..) are reset to zero.
GLAnimatorControl.stop()
,
GLAnimatorControl.isAnimating()
,
GLAnimatorControl.isPaused()
,
GLAnimatorControl.getThread()
public final boolean stop()
GLAnimatorControl.start()
,
GLAnimatorControl.isAnimating()
,
GLAnimatorControl.getThread()
public final boolean pause()
GLAnimatorControl
In most situations this method blocks until completion, except when called from the animation thread itself or in some cases from an implementation-internal thread like the AWT event queue thread.
GLAnimatorControl.resume()
,
GLAnimatorControl.isAnimating()
public final boolean resume()
GLAnimatorControl
In most situations this method blocks until completion, except when called from the animation thread itself or in some cases from an implementation-internal thread like the AWT event queue thread.
If resumed, all counters (time, frames, ..) are reset to zero.
GLAnimatorControl.pause()
,
GLAnimatorControl.isAnimating()
Copyright 2010 JogAmp Community.