com.sun.opengl.util
Class FPSAnimator

java.lang.Object
  extended by com.sun.opengl.util.Animator
      extended by com.sun.opengl.util.FPSAnimator

public class FPSAnimator
extends Animator

An Animator subclass which attempts to achieve a target frames-per-second rate to avoid using all CPU time. The target FPS is only an estimate and is not guaranteed.


Field Summary
 
Fields inherited from class com.sun.opengl.util.Animator
ignoreExceptions, printExceptions, shouldStop, thread
 
Constructor Summary
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.
 
Method Summary
 boolean isAnimating()
          Indicates whether this FPSAnimator is currently running.
 void start()
          Starts this FPSAnimator.
 void stop()
          Stops this FPSAnimator.
 
Methods inherited from class com.sun.opengl.util.Animator
add, display, drawableIterator, remove, setIgnoreExceptions, setPrintExceptions, setRunAsFastAsPossible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FPSAnimator

public FPSAnimator(int fps)
Creates an FPSAnimator with a given target frames-per-second value. Equivalent to FPSAnimator(null, fps).


FPSAnimator

public 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. Equivalent to FPSAnimator(null, fps, scheduleAtFixedRate).


FPSAnimator

public FPSAnimator(GLAutoDrawable drawable,
                   int fps)
Creates an FPSAnimator with a given target frames-per-second value and an initial drawable to animate. Equivalent to FPSAnimator(null, fps, false).


FPSAnimator

public 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.

Method Detail

start

public void start()
Starts this FPSAnimator.

Overrides:
start in class Animator

isAnimating

public boolean isAnimating()
Indicates whether this FPSAnimator is currently running. This should only be used as a heuristic to applications because in some circumstances the FPSAnimator may be in the process of shutting down and this method will still return true.

Overrides:
isAnimating in class Animator

stop

public void stop()
Stops this FPSAnimator. Due to the implementation of the FPSAnimator it is not guaranteed that the FPSAnimator will be completely stopped by the time this method returns.

Overrides:
stop in class Animator


Copyright 2005 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.