diff --git a/android/core/src/processing/core/PApplet.java b/android/core/src/processing/core/PApplet.java index bd00224ae..1f39c84cd 100644 --- a/android/core/src/processing/core/PApplet.java +++ b/android/core/src/processing/core/PApplet.java @@ -26,6 +26,7 @@ package processing.core; import processing.xml.XMLElement; import android.content.*; +import android.content.pm.ActivityInfo; import android.content.res.AssetManager; import android.content.res.Configuration; import android.graphics.*; @@ -59,8 +60,8 @@ public class PApplet extends Activity implements PConstants, Runnable { /** The PGraphics renderer associated with this PApplet */ public PGraphics g; -// static final boolean DEBUG = true; - static final boolean DEBUG = false; + static final boolean DEBUG = true; +// static final boolean DEBUG = false; /** The frame containing this applet (if any) */ // public Frame frame; @@ -721,7 +722,6 @@ public class PApplet extends Activity implements PConstants, Runnable { surfaceHolder.addCallback(this); //surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_GPU); - /* By default, GLSurfaceView() creates a RGB_565 opaque surface. * If we want a translucent one, we should change the surface's * format here, using PixelFormat.TRANSLUCENT for GL Surfaces @@ -906,6 +906,15 @@ public class PApplet extends Activity implements PConstants, Runnable { public String sketchRenderer() { return A2D; } + + + public void orientation(int which) { + if (which == PORTRAIT) { + setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); + } else if (which == LANDSCAPE) { + setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); + } + } // public int sketchOrientation() { diff --git a/android/core/src/processing/core/PConstants.java b/android/core/src/processing/core/PConstants.java index c779efb6b..8efc5b72a 100644 --- a/android/core/src/processing/core/PConstants.java +++ b/android/core/src/processing/core/PConstants.java @@ -471,6 +471,12 @@ public interface PConstants { // static final int MOVE = Cursor.MOVE_CURSOR; // static final int TEXT = Cursor.TEXT_CURSOR; // static final int WAIT = Cursor.WAIT_CURSOR; + + + /** Screen orientation constant for portrait (the hamburger way). */ + static final int PORTRAIT = 1; + /** Screen orientation constant for landscape (the hot dog way). */ + static final int LANDSCAPE = 2; // hints - hint values are positive for the alternate version, diff --git a/android/todo.txt b/android/todo.txt index 059dc19d5..85c73aaee 100644 --- a/android/todo.txt +++ b/android/todo.txt @@ -80,6 +80,11 @@ o might need to just put this in the menu for times when things go weird o http://dev.processing.org/bugs/show_bug.cgi?id=1392 o http://code.google.com/p/processing/issues/detail?id=209 +X added orientation(PORTRAIT) and orientation(LANDSCAPE) +_ need to add documentation +_ update the wiki pages +_ add to keywords.txt + earlier X if sketchRenderer() et al are used in android, need to add to desktop X remove processing.opengl.* classes and finish PGraphicsAndroid3D