summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl/util
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-10-06 16:04:06 +0200
committerSven Gothel <[email protected]>2010-10-06 16:04:06 +0200
commit018c7e8660dc0af68bd129be9af5094d04d0b431 (patch)
treeac17156a48167f4a28e129adfc78b7c746aa6744 /src/jogl/classes/com/jogamp/opengl/util
parent03416ffe040d50b96573930104a78933605ae40d (diff)
NativeWindow/NativeSurface Refactoring ; Added mouseClick NEWT/AWT unit test
NativeWindow/NativeSurface Refactoring - Using NativeSurface interface - NativeWindow extends NativeSurface, adds getLocationOnScreen(Point) - NativeWindow add: getParent() - NativeWindow/Surface: Removed 'invalidate()', use 'destroy()' if you must. - NullWindow -> ProxySurface impl NativeSurface - JOGL: Uses NativeSurface only. - GLDrawable.getNativeWindow() -> GLDrawable.getNativeSurface() Added mouseClick NEWT/AWT unit test JOGL: - GLAnimatorControl add: resetCounter() - NEWT: - GLWindow counters: return GLWindow counters always - WindowImpl - requestFocus() wait until done - reparent: readded requestFocusImpl(true), native impl skips java focusAction if reparented - X11Window: Add XRaiseWindow() in requestFocus()
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/util')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/Animator.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java25
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java9
3 files changed, 21 insertions, 15 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/Animator.java b/src/jogl/classes/com/jogamp/opengl/util/Animator.java
index 5d48405e2..2b8876a91 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/Animator.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/Animator.java
@@ -197,6 +197,7 @@ public class Animator extends AnimatorBase {
if (runnable == null) {
runnable = new MainLoop();
}
+ resetCounter();
int id;
String threadName = Thread.currentThread().getName()+"-"+baseName;
if(null==threadGroup) {
@@ -272,6 +273,7 @@ public class Animator extends AnimatorBase {
}
}
}
+ resetCounter();
}
protected final boolean getShouldPause() {
diff --git a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java
index 279fe33ef..a54f6be57 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java
@@ -49,9 +49,9 @@ public abstract class AnimatorBase implements GLAnimatorControl {
protected Thread thread;
protected boolean ignoreExceptions;
protected boolean printExceptions;
- protected long startTime = 0;
- protected long curTime = 0;
- protected int totalFrames = 0;
+ protected long startTime;
+ protected long curTime;
+ protected int totalFrames;
/** Creates a new, empty Animator. */
public AnimatorBase() {
@@ -69,6 +69,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
animatorCount++;
baseName = baseName.concat("-"+animatorCount);
}
+ resetCounter();
}
protected abstract String getBaseName(String prefix);
@@ -112,10 +113,6 @@ public abstract class AnimatorBase implements GLAnimatorControl {
return curTime - startTime;
}
- protected abstract boolean getShouldPause();
-
- protected abstract boolean getShouldStop();
-
public long getStartTime() {
return startTime;
}
@@ -124,6 +121,12 @@ public abstract class AnimatorBase implements GLAnimatorControl {
return totalFrames;
}
+ public synchronized void resetCounter() {
+ startTime = System.currentTimeMillis(); // overwrite startTime to real init one
+ curTime = startTime;
+ totalFrames = 0;
+ }
+
public final synchronized Thread getThread() {
return thread;
}
@@ -142,4 +145,12 @@ public abstract class AnimatorBase implements GLAnimatorControl {
public void setPrintExceptions(boolean printExceptions) {
this.printExceptions = printExceptions;
}
+
+ public String toString() {
+ return getClass().getName()+"[started "+isStarted()+", animating "+isAnimating()+", paused "+isPaused()+", frames "+getTotalFrames()+"]";
+ }
+
+ protected abstract boolean getShouldPause();
+
+ protected abstract boolean getShouldStop();
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java b/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java
index d098cf1a3..8542000c6 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java
@@ -88,11 +88,6 @@ public class FPSAnimator extends AnimatorBase {
this.scheduleAtFixedRate = scheduleAtFixedRate;
}
- public long getStartTime() { return startTime; }
- public long getCurrentTime() { return curTime; }
- public long getDuration() { return curTime-startTime; }
- public int getTotalFrames() { return totalFrames; }
-
public final synchronized boolean isStarted() {
return (timer != null);
}
@@ -116,9 +111,7 @@ public class FPSAnimator extends AnimatorBase {
}
};
- startTime = System.currentTimeMillis();
- curTime = startTime;
- totalFrames = 0;
+ resetCounter();
shouldRun = true;
if (scheduleAtFixedRate) {