Skip to content

Commit 5b3d682

Browse files
committed
sync with GL updates on desktop
1 parent 4cbb8c0 commit 5b3d682

13 files changed

+3039
-889
lines changed

core/src/processing/core/PApplet.java

Lines changed: 59 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -417,15 +417,20 @@ static public class RendererChangeException extends RuntimeException { }
417417

418418
static final String ERROR_MIN_MAX =
419419
"Cannot use min() or max() on an empty array.";
420-
420+
421421
boolean insideSettings;
422-
422+
423423
String renderer = JAVA2D;
424-
424+
425425
int smooth = 1; // default smoothing (whatever that means for the renderer)
426-
426+
427427
boolean fullScreen = false;
428428

429+
// Background default needs to be different from the default value in
430+
// PGraphics.backgroundColor, otherwise size(100, 100) bg spills over.
431+
// https://github.com/processing/processing/issues/2297
432+
int windowColor = 0xffDDDDDD;
433+
429434

430435
//////////////////////////////////////////////////////////////
431436
//////////////////////////////////////////////////////////////
@@ -456,7 +461,7 @@ public void onCreate(Bundle savedInstanceState) {
456461
getWindowManager().getDefaultDisplay().getMetrics(dm);
457462
displayWidth = dm.widthPixels;
458463
displayHeight = dm.heightPixels;
459-
464+
460465
//Setting the default height and width to be fullscreen
461466
width = displayWidth;
462467
height = displayHeight;
@@ -476,7 +481,7 @@ public void onCreate(Bundle savedInstanceState) {
476481
// RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.FILL_PARENT);
477482
//lp.addRule(RelativeLayout.RIGHT_OF, tv1.getId());
478483
// layout.setGravity(RelativeLayout.CENTER_IN_PARENT);
479-
484+
480485
handleSettings();
481486

482487
int sw = sketchWidth();
@@ -507,7 +512,7 @@ public void onCreate(Bundle savedInstanceState) {
507512
"Error: Unsupported renderer class: %s", rendererName);
508513
throw new RuntimeException(message);
509514
}
510-
515+
511516
//set smooth level
512517
if (smooth == 0) {
513518
g.noSmooth();
@@ -659,8 +664,8 @@ protected void onPause() {
659664
//}
660665
// surfaceView.onPause();
661666
}
662-
663-
667+
668+
664669
/**
665670
* @param method "size" or "fullScreen"
666671
* @param args parameters passed to the function so we can show the user
@@ -681,16 +686,16 @@ boolean insideSettings(String method, Object... args) {
681686
}
682687
throw new IllegalStateException(method + "() cannot be used here, see " + url);
683688
}
684-
685-
689+
690+
686691
void handleSettings() {
687692
insideSettings = true;
688693
//Do stuff
689694
settings();
690695
insideSettings = false;
691696
}
692-
693-
697+
698+
694699
public void settings() {
695700
//It'll be empty. Will be overridden by user's sketch class.
696701
}
@@ -1095,27 +1100,33 @@ public int sketchQuality() {
10951100
}
10961101

10971102

1098-
public int sketchWidth() {
1103+
final public int sketchWidth() {
10991104
if (fullScreen) {
11001105
return displayWidth;
11011106
}
11021107
return width;
11031108
}
11041109

11051110

1106-
public int sketchHeight() {
1111+
final public int sketchHeight() {
11071112
if (fullScreen) {
11081113
return displayHeight;
11091114
}
11101115
return height;
11111116
}
11121117

11131118

1114-
public String sketchRenderer() {
1119+
final public String sketchRenderer() {
11151120
return renderer;
11161121
}
11171122

11181123

1124+
final public int sketchWindowColor() {
1125+
return windowColor;
1126+
}
1127+
1128+
1129+
11191130
public void orientation(int which) {
11201131
if (which == PORTRAIT) {
11211132
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
@@ -1527,8 +1538,8 @@ public void draw() {
15271538
// layout.invalidate();
15281539
// }
15291540
// }
1530-
1531-
1541+
1542+
15321543
/**
15331544
* Create a full-screen sketch using the default renderer.
15341545
*/
@@ -1606,8 +1617,8 @@ public void size(int iwidth, int iheight, String irenderer) {
16061617
}
16071618
}
16081619
}
1609-
1610-
1620+
1621+
16111622
//. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16121623

16131624

@@ -1681,7 +1692,7 @@ public void size(final int iwidth, final int iheight,
16811692
final String irenderer, final String ipath) {
16821693
if (iwidth != this.width || iheight != this.height ||
16831694
!this.renderer.equals(irenderer)) {
1684-
if (insideSettings("size", iwidth, iheight, irenderer,
1695+
if (insideSettings("size", iwidth, iheight, irenderer,
16851696
ipath)) {
16861697
this.width = iwidth;
16871698
this.height = iheight;
@@ -3635,8 +3646,8 @@ static public void println(Object what) {
36353646
}
36363647
}
36373648
}
3638-
3639-
3649+
3650+
36403651
/**
36413652
* @webref output:text_area
36423653
* @param what one-dimensional array
@@ -8128,6 +8139,21 @@ public void normal(float nx, float ny, float nz) {
81288139
}
81298140

81308141

8142+
public void attrib(String name, float... values) {
8143+
g.attrib(name, values);
8144+
}
8145+
8146+
8147+
public void attrib(String name, int... values) {
8148+
g.attrib(name, values);
8149+
}
8150+
8151+
8152+
public void attrib(String name, boolean... values) {
8153+
g.attrib(name, values);
8154+
}
8155+
8156+
81318157
/**
81328158
* Set texture mode to either to use coordinates based on the IMAGE
81338159
* (more intuitive for new users) or NORMALIZED (better for advanced chaps)
@@ -8239,11 +8265,12 @@ public PShape loadShape(String filename) {
82398265
}
82408266

82418267

8242-
public PShape createShape(PShape source) {
8243-
return g.createShape(source);
8244-
}
8245-
8246-
8268+
/**
8269+
* @webref shape
8270+
* @see PShape
8271+
* @see PShape#endShape()
8272+
* @see PApplet#loadShape(String)
8273+
*/
82478274
public PShape createShape() {
82488275
return g.createShape();
82498276
}
@@ -8254,6 +8281,10 @@ public PShape createShape(int type) {
82548281
}
82558282

82568283

8284+
/**
8285+
* @param kind either POINT, LINE, TRIANGLE, QUAD, RECT, ELLIPSE, ARC, BOX, SPHERE
8286+
* @param p parameters that match the kind of shape
8287+
*/
82578288
public PShape createShape(int kind, float... p) {
82588289
return g.createShape(kind, p);
82598290
}

0 commit comments

Comments
 (0)