summaryrefslogtreecommitdiffstats
path: root/maven/jp4da/jp4da-android/src/main/java/com
diff options
context:
space:
mode:
authorMark Raynsford <[email protected]>2012-12-02 22:46:30 +0000
committerMark Raynsford <[email protected]>2012-12-02 22:46:30 +0000
commit76da2b16bcb7b760660a9cf91cf6457acf526a6b (patch)
tree42d9e13ec8fc24a84a70e80b67153b7ba3834aec /maven/jp4da/jp4da-android/src/main/java/com
parentf24ce52d7fa62072df918b404cac1b090f92fc45 (diff)
Initial jp4da setup
Diffstat (limited to 'maven/jp4da/jp4da-android/src/main/java/com')
-rw-r--r--maven/jp4da/jp4da-android/src/main/java/com/io7m/examples/jp4da/MainActivity.java67
1 files changed, 67 insertions, 0 deletions
diff --git a/maven/jp4da/jp4da-android/src/main/java/com/io7m/examples/jp4da/MainActivity.java b/maven/jp4da/jp4da-android/src/main/java/com/io7m/examples/jp4da/MainActivity.java
new file mode 100644
index 0000000..9a9dd77
--- /dev/null
+++ b/maven/jp4da/jp4da-android/src/main/java/com/io7m/examples/jp4da/MainActivity.java
@@ -0,0 +1,67 @@
+package com.io7m.examples.jp4da;
+
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLProfile;
+
+import jogamp.newt.driver.android.NewtBaseActivity;
+import android.os.Bundle;
+
+import com.jogamp.newt.ScreenMode;
+import com.jogamp.newt.event.MouseAdapter;
+import com.jogamp.newt.event.MouseEvent;
+import com.jogamp.newt.event.ScreenModeListener;
+import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.opengl.util.Animator;
+
+public class MainActivity extends NewtBaseActivity
+{
+ @Override public void onCreate(
+ final Bundle state)
+ {
+ super.onCreate(state);
+
+ final GLCapabilities caps =
+ new GLCapabilities(GLProfile.get(GLProfile.GLES2));
+ final GLWindow gl_window = GLWindow.create(caps);
+ gl_window.setFullscreen(true);
+
+ this.setContentView(this.getWindow(), gl_window);
+
+ gl_window.addMouseListener(new MouseAdapter() {
+ @Override public void mousePressed(
+ final MouseEvent e)
+ {
+ if (e.getPressure() > 2f) { // show Keyboard
+ ((com.jogamp.newt.Window) e.getSource()).setKeyboardVisible(true);
+ }
+ }
+ });
+
+ final Example example = new Example();
+
+ // demo.enableAndroidTrace(true);
+ gl_window.addGLEventListener(example);
+ gl_window.getScreen().addScreenModeListener(new ScreenModeListener() {
+ @SuppressWarnings("unused") public void screenModeChangeNotify(
+ final ScreenMode sm)
+ {
+ // Nothing.
+ }
+
+ @SuppressWarnings("unused") public void screenModeChanged(
+ final ScreenMode sm,
+ final boolean success)
+ {
+ System.err.println("ScreenMode Changed: " + sm);
+ }
+ });
+
+ final Animator animator = new Animator(gl_window);
+ this.setAnimator(animator);
+
+ gl_window.setVisible(true);
+ animator.setUpdateFPSFrames(60, System.err);
+ animator.resetFPSCounter();
+ gl_window.resetFPSCounter();
+ }
+}