diff options
author | Sven Gothel <[email protected]> | 2023-03-21 10:38:14 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-03-21 10:38:14 +0100 |
commit | d4bab2edea41a67438a62c04074c2aad855bedcd (patch) | |
tree | 1b404ec7f1f19699d4ae2726dfca2ab941f04ff0 /src/demos/com/jogamp/opengl | |
parent | 7ae5fc44a1661f4bd800018ea8882fe62c884094 (diff) |
GraphUI UISceneDemo*: Stop animation loop if window got destroyed
Diffstat (limited to 'src/demos/com/jogamp/opengl')
-rw-r--r-- | src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo00.java | 4 | ||||
-rw-r--r-- | src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo00.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo00.java index 5a3fc3a65..8f8eac1cf 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo00.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo00.java @@ -103,7 +103,7 @@ public class UISceneDemo00 { window.setTitle(UISceneDemo00.class.getSimpleName()+": "+window.getSurfaceWidth()+" x "+window.getSurfaceHeight()); } @Override - public void windowDestroyed(final WindowEvent e) { + public void windowDestroyNotify(final WindowEvent e) { animator.stop(); } }); @@ -151,7 +151,7 @@ public class UISceneDemo00 { final long t0_us = Clock.currentNanos() / 1000; // [us] long t1_us = t0_us; shape.moveTo(min_obj, 0f, 0f); // move shape to min start position - while( shape.getPosition()[0] < max_obj ) { + while( shape.getPosition()[0] < max_obj && window.isNativeValid() ) { final long t2_us = Clock.currentNanos() / 1000; final float dt_s = ( t2_us - t1_us ) / 1e6f; t1_us = t2_us; diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java index c4c82cb1c..007a5403b 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java @@ -110,7 +110,7 @@ public class UISceneDemo01 { window.setTitle(UISceneDemo01.class.getSimpleName()+": "+window.getSurfaceWidth()+" x "+window.getSurfaceHeight()); } @Override - public void windowDestroyed(final WindowEvent e) { + public void windowDestroyNotify(final WindowEvent e) { animator.stop(); } }); @@ -159,7 +159,7 @@ public class UISceneDemo01 { final long t0_us = Clock.currentNanos() / 1000; // [us] long t1_us = t0_us; shape.moveTo(min_obj, 0f, 0f); // move shape to min start position - while( shape.getPosition()[0] < max_obj ) { + while( shape.getPosition()[0] < max_obj && window.isNativeValid() ) { final long t2_us = Clock.currentNanos() / 1000; final float dt_s = ( t2_us - t1_us ) / 1e6f; t1_us = t2_us; |