diff options
author | Sven Gothel <[email protected]> | 2010-04-24 05:11:29 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-04-24 05:11:29 +0200 |
commit | 1ad8c39df6b097c80ba7a85badf555e7f669cc3f (patch) | |
tree | 740606f85dafdef5d5958498b080873c7bf188dd /src/jogl/classes/com/jogamp/opengl/util | |
parent | 778225504c00c7ca03386b6eabfbda929542130f (diff) |
NEWT/AWT Interoperability
- Moved all event classes to
com.jogamp.newt.event
and the new AWT event helper to
com.jogamp.newt.awt.event
- Added Newt<Type>Adapter for convenience
- Added AWT<Type>Adapter for
- Using AWT agnostic NEWT event listener
see com.jogamp.test.junit.jogl.demos.gl2.gears.TestGearsNEWT
even for AWT
see com.jogamp.test.junit.jogl.demos.gl2.gears.TestGearsAWT
(Nice idea by mbien)
- Forwarding AWT events to NEWT (refactoring)
Misc
- GLDrawableFactory.shutdown() is now protected and called
by the JVM shutdown hook. Hence removing the validate().
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/util')
-rwxr-xr-x | src/jogl/classes/com/jogamp/opengl/util/Animator.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/Animator.java b/src/jogl/classes/com/jogamp/opengl/util/Animator.java index 30be0bd90..9bef8e9c3 100755 --- a/src/jogl/classes/com/jogamp/opengl/util/Animator.java +++ b/src/jogl/classes/com/jogamp/opengl/util/Animator.java @@ -154,12 +154,19 @@ public class Animator { impl.display(this, ignoreExceptions, printExceptions); } + private long startTime = 0; + private long curTime = 0; + private int totalFrames = 0; + class MainLoop implements Runnable { public void run() { try { if(DEBUG) { System.out.println("Animator started: "+Thread.currentThread()); } + startTime = System.currentTimeMillis(); + curTime = startTime; + while (!shouldStop) { // Don't consume CPU unless there is work to be done if (drawables.size() == 0) { @@ -173,6 +180,8 @@ public class Animator { } } display(); + curTime = System.currentTimeMillis(); + totalFrames++; if (!runAsFastAsPossible) { // Avoid swamping the CPU Thread.yield(); @@ -191,6 +200,11 @@ public class Animator { } } + public long getStartTime() { return startTime; } + public long getCurrentTime() { return curTime; } + public long getDuration() { return curTime-startTime; } + public int getTotalFrames() { return totalFrames; } + /** Starts this animator. */ public synchronized void start() { if (thread != null) { |