Skip to content

Commit e80a241

Browse files
committed
Merge remote-tracking branch 'origin/master' into fragment
Conflicts: src/processing/mode/android/Manifest.java
2 parents 9f391d1 + f722211 commit e80a241

File tree

16 files changed

+3073
-896
lines changed

16 files changed

+3073
-896
lines changed

core/src/processing/core/PApplet.java

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

429429
static final String ERROR_MIN_MAX =
430430
"Cannot use min() or max() on an empty array.";
431-
431+
432432
boolean insideSettings;
433-
433+
434434
String renderer = JAVA2D;
435-
435+
436436
int smooth = 1; // default smoothing (whatever that means for the renderer)
437-
437+
438438
boolean fullScreen = false;
439439

440+
// Background default needs to be different from the default value in
441+
// PGraphics.backgroundColor, otherwise size(100, 100) bg spills over.
442+
// https://github.com/processing/processing/issues/2297
443+
int windowColor = 0xffDDDDDD;
444+
440445

441446
//////////////////////////////////////////////////////////////
442447
//////////////////////////////////////////////////////////////
@@ -462,7 +467,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
462467
activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
463468
displayWidth = dm.widthPixels;
464469
displayHeight = dm.heightPixels;
465-
470+
466471
//Setting the default height and width to be fullscreen
467472
width = displayWidth;
468473
height = displayHeight;
@@ -482,7 +487,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
482487
// RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.FILL_PARENT);
483488
//lp.addRule(RelativeLayout.RIGHT_OF, tv1.getId());
484489
// layout.setGravity(RelativeLayout.CENTER_IN_PARENT);
485-
490+
486491
handleSettings();
487492

488493
int sw = sketchWidth();
@@ -513,7 +518,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
513518
"Error: Unsupported renderer class: %s", rendererName);
514519
throw new RuntimeException(message);
515520
}
516-
521+
517522
//set smooth level
518523
if (smooth == 0) {
519524
g.noSmooth();
@@ -667,8 +672,8 @@ public void onPause() {
667672
//}
668673
// surfaceView.onPause();
669674
}
670-
671-
675+
676+
672677
/**
673678
* @param method "size" or "fullScreen"
674679
* @param args parameters passed to the function so we can show the user
@@ -689,16 +694,16 @@ boolean insideSettings(String method, Object... args) {
689694
}
690695
throw new IllegalStateException(method + "() cannot be used here, see " + url);
691696
}
692-
693-
697+
698+
694699
void handleSettings() {
695700
insideSettings = true;
696701
//Do stuff
697702
settings();
698703
insideSettings = false;
699704
}
700-
701-
705+
706+
702707
public void settings() {
703708
//It'll be empty. Will be overridden by user's sketch class.
704709
}
@@ -1108,27 +1113,33 @@ public int sketchQuality() {
11081113
}
11091114

11101115

1111-
public int sketchWidth() {
1116+
final public int sketchWidth() {
11121117
if (fullScreen) {
11131118
return displayWidth;
11141119
}
11151120
return width;
11161121
}
11171122

11181123

1119-
public int sketchHeight() {
1124+
final public int sketchHeight() {
11201125
if (fullScreen) {
11211126
return displayHeight;
11221127
}
11231128
return height;
11241129
}
11251130

11261131

1127-
public String sketchRenderer() {
1132+
final public String sketchRenderer() {
11281133
return renderer;
11291134
}
11301135

11311136

1137+
final public int sketchWindowColor() {
1138+
return windowColor;
1139+
}
1140+
1141+
1142+
11321143
public void orientation(int which) {
11331144
if (which == PORTRAIT) {
11341145
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
@@ -1540,8 +1551,8 @@ public void draw() {
15401551
// layout.invalidate();
15411552
// }
15421553
// }
1543-
1544-
1554+
1555+
15451556
/**
15461557
* Create a full-screen sketch using the default renderer.
15471558
*/
@@ -1619,8 +1630,8 @@ public void size(int iwidth, int iheight, String irenderer) {
16191630
}
16201631
}
16211632
}
1622-
1623-
1633+
1634+
16241635
//. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16251636

16261637

@@ -1694,7 +1705,7 @@ public void size(final int iwidth, final int iheight,
16941705
final String irenderer, final String ipath) {
16951706
if (iwidth != this.width || iheight != this.height ||
16961707
!this.renderer.equals(irenderer)) {
1697-
if (insideSettings("size", iwidth, iheight, irenderer,
1708+
if (insideSettings("size", iwidth, iheight, irenderer,
16981709
ipath)) {
16991710
this.width = iwidth;
17001711
this.height = iheight;
@@ -3653,8 +3664,8 @@ static public void println(Object what) {
36533664
}
36543665
}
36553666
}
3656-
3657-
3667+
3668+
36583669
/**
36593670
* @webref output:text_area
36603671
* @param what one-dimensional array
@@ -8144,6 +8155,21 @@ public void normal(float nx, float ny, float nz) {
81448155
}
81458156

81468157

8158+
public void attrib(String name, float... values) {
8159+
g.attrib(name, values);
8160+
}
8161+
8162+
8163+
public void attrib(String name, int... values) {
8164+
g.attrib(name, values);
8165+
}
8166+
8167+
8168+
public void attrib(String name, boolean... values) {
8169+
g.attrib(name, values);
8170+
}
8171+
8172+
81478173
/**
81488174
* Set texture mode to either to use coordinates based on the IMAGE
81498175
* (more intuitive for new users) or NORMALIZED (better for advanced chaps)
@@ -8255,11 +8281,12 @@ public PShape loadShape(String filename) {
82558281
}
82568282

82578283

8258-
public PShape createShape(PShape source) {
8259-
return g.createShape(source);
8260-
}
8261-
8262-
8284+
/**
8285+
* @webref shape
8286+
* @see PShape
8287+
* @see PShape#endShape()
8288+
* @see PApplet#loadShape(String)
8289+
*/
82638290
public PShape createShape() {
82648291
return g.createShape();
82658292
}
@@ -8270,6 +8297,10 @@ public PShape createShape(int type) {
82708297
}
82718298

82728299

8300+
/**
8301+
* @param kind either POINT, LINE, TRIANGLE, QUAD, RECT, ELLIPSE, ARC, BOX, SPHERE
8302+
* @param p parameters that match the kind of shape
8303+
*/
82738304
public PShape createShape(int kind, float... p) {
82748305
return g.createShape(kind, p);
82758306
}

0 commit comments

Comments
 (0)