diff options
author | Rami Santina <[email protected]> | 2011-09-30 19:58:01 +0300 |
---|---|---|
committer | Rami Santina <[email protected]> | 2011-09-30 19:58:01 +0300 |
commit | 836d4824ad20c57155d850d2b3657004b019514d (patch) | |
tree | 7e3065788ee7959877589f4e19172f5044b0ca58 /src/newt | |
parent | 14ec84659f2ef5ba6c74601360adfff0558fc6f0 (diff) | |
parent | 448ad05ea1192a1c3ca8812bf8d3142b2df6c30b (diff) |
Merge branch 'android-tegra-playground' of git://github.com/sgothel/jogl into android-tegra-playground
Diffstat (limited to 'src/newt')
-rw-r--r-- | src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java | 28 | ||||
-rw-r--r-- | src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java | 49 |
2 files changed, 26 insertions, 51 deletions
diff --git a/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java b/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java index 358fcc994..9a2a0ea2c 100644 --- a/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java +++ b/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java @@ -31,15 +31,18 @@ import javax.media.opengl.GLProfile; import com.jogamp.newt.Window; import com.jogamp.newt.opengl.GLWindow; +import com.jogamp.opengl.util.Animator; import jogamp.newt.driver.android.AndroidWindow; import android.app.Activity; -import android.content.Context; import android.os.Bundle; import android.util.Log; public class NewtBaseActivity extends Activity { + AndroidWindow window = null; + Animator animator = null; + boolean isInvokedByExternalActivity = false; Activity extActivity = this; @@ -56,16 +59,21 @@ public class NewtBaseActivity extends Activity { window = ((GLWindow)window).getWindow(); } if(window instanceof AndroidWindow) { + this.window = (AndroidWindow)window; if(isInvokedByExternalActivity) { - extActivity.setContentView(((AndroidWindow)window).getView()); + extActivity.setContentView(this.window.getView()); } else { - super.setContentView(((AndroidWindow)window).getView()); + super.setContentView(this.window.getView()); } } else { throw new IllegalArgumentException("Given NEWT Window is not an Android Window: "+window.getClass()); } } + public void setAnimator(Animator animator) { + this.animator = animator; + } + @Override public void onCreate(Bundle savedInstanceState) { Log.d(MD.TAG, "onCreate"); @@ -103,11 +111,17 @@ public class NewtBaseActivity extends Activity { if(!isInvokedByExternalActivity) { super.onResume(); } + if(null != animator) { + animator.start(); + } } @Override public void onPause() { Log.d(MD.TAG, "onPause"); + if(null != animator) { + animator.pause(); + } if(!isInvokedByExternalActivity) { super.onPause(); } @@ -124,6 +138,14 @@ public class NewtBaseActivity extends Activity { @Override public void onDestroy() { Log.d(MD.TAG, "onDestroy"); + if(null != animator) { + animator.stop(); + animator = null; + } + if(null != window) { + window.destroy(); + window = null; + } if(!isInvokedByExternalActivity) { super.onDestroy(); } diff --git a/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java b/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java index 5842a285d..d37901793 100644 --- a/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java +++ b/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java @@ -30,17 +30,13 @@ package jogamp.newt.driver.android; import com.jogamp.common.GlueGenVersion; import com.jogamp.common.os.Platform; import com.jogamp.common.util.VersionUtil; -import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.JoglVersion; -import com.jogamp.opengl.util.Animator; import android.os.Bundle; import android.util.Log; import android.widget.TextView; public class NewtVersionActivity extends NewtBaseActivity { - GLWindow glWindow = null; - Animator animator = null; TextView tv = null; @Override @@ -57,50 +53,7 @@ public class NewtVersionActivity extends NewtBaseActivity { tv = new TextView(this); tv.setText(VersionUtil.getPlatformInfo()+Platform.NEWLINE+GlueGenVersion.getInstance()+Platform.NEWLINE+JoglVersion.getInstance()+Platform.NEWLINE); setContentView(tv); - /** - // create GLWindow (-> incl. underlying NEWT Display, Screen & Window) - GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES1)); - glWindow = GLWindow.create(caps); - setContentView(glWindow); - - glWindow.addGLEventListener(new GearsES1(1)); - glWindow.getWindow().getScreen().addScreenModeListener(new ScreenModeListener() { - public void screenModeChangeNotify(ScreenMode sm) { } - public void screenModeChanged(ScreenMode sm, boolean success) { - System.err.println("ScreenMode Changed: "+sm); - } - }); - glWindow.setVisible(true); - animator = new Animator(glWindow); - animator.setUpdateFPSFrames(60, System.err); */ - - Log.d(MD.TAG, "onCreate - X"); - } - - @Override - public void onResume() { - super.onResume(); - if(null != animator) { - animator.start(); - } - } - @Override - public void onPause() { - super.onPause(); - if(null != animator) { - animator.pause(); - } - } - - @Override - public void onDestroy() { - super.onDestroy(); - if(null != animator) { - animator.stop(); - } - if(null != glWindow) { - glWindow.destroy(); - } + Log.d(MD.TAG, "onCreate - X"); } } |