summaryrefslogtreecommitdiffstats
path: root/maven/jp4da/jp4da-android/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'maven/jp4da/jp4da-android/src/main')
-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();
+ }
+}