@@ -417,15 +417,20 @@ static public class RendererChangeException extends RuntimeException { }
417
417
418
418
static final String ERROR_MIN_MAX =
419
419
"Cannot use min() or max() on an empty array." ;
420
-
420
+
421
421
boolean insideSettings ;
422
-
422
+
423
423
String renderer = JAVA2D ;
424
-
424
+
425
425
int smooth = 1 ; // default smoothing (whatever that means for the renderer)
426
-
426
+
427
427
boolean fullScreen = false ;
428
428
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
+
429
434
430
435
//////////////////////////////////////////////////////////////
431
436
//////////////////////////////////////////////////////////////
@@ -456,7 +461,7 @@ public void onCreate(Bundle savedInstanceState) {
456
461
getWindowManager ().getDefaultDisplay ().getMetrics (dm );
457
462
displayWidth = dm .widthPixels ;
458
463
displayHeight = dm .heightPixels ;
459
-
464
+
460
465
//Setting the default height and width to be fullscreen
461
466
width = displayWidth ;
462
467
height = displayHeight ;
@@ -476,7 +481,7 @@ public void onCreate(Bundle savedInstanceState) {
476
481
// RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.FILL_PARENT);
477
482
//lp.addRule(RelativeLayout.RIGHT_OF, tv1.getId());
478
483
// layout.setGravity(RelativeLayout.CENTER_IN_PARENT);
479
-
484
+
480
485
handleSettings ();
481
486
482
487
int sw = sketchWidth ();
@@ -507,7 +512,7 @@ public void onCreate(Bundle savedInstanceState) {
507
512
"Error: Unsupported renderer class: %s" , rendererName );
508
513
throw new RuntimeException (message );
509
514
}
510
-
515
+
511
516
//set smooth level
512
517
if (smooth == 0 ) {
513
518
g .noSmooth ();
@@ -659,8 +664,8 @@ protected void onPause() {
659
664
//}
660
665
// surfaceView.onPause();
661
666
}
662
-
663
-
667
+
668
+
664
669
/**
665
670
* @param method "size" or "fullScreen"
666
671
* @param args parameters passed to the function so we can show the user
@@ -681,16 +686,16 @@ boolean insideSettings(String method, Object... args) {
681
686
}
682
687
throw new IllegalStateException (method + "() cannot be used here, see " + url );
683
688
}
684
-
685
-
689
+
690
+
686
691
void handleSettings () {
687
692
insideSettings = true ;
688
693
//Do stuff
689
694
settings ();
690
695
insideSettings = false ;
691
696
}
692
-
693
-
697
+
698
+
694
699
public void settings () {
695
700
//It'll be empty. Will be overridden by user's sketch class.
696
701
}
@@ -1095,27 +1100,33 @@ public int sketchQuality() {
1095
1100
}
1096
1101
1097
1102
1098
- public int sketchWidth () {
1103
+ final public int sketchWidth () {
1099
1104
if (fullScreen ) {
1100
1105
return displayWidth ;
1101
1106
}
1102
1107
return width ;
1103
1108
}
1104
1109
1105
1110
1106
- public int sketchHeight () {
1111
+ final public int sketchHeight () {
1107
1112
if (fullScreen ) {
1108
1113
return displayHeight ;
1109
1114
}
1110
1115
return height ;
1111
1116
}
1112
1117
1113
1118
1114
- public String sketchRenderer () {
1119
+ final public String sketchRenderer () {
1115
1120
return renderer ;
1116
1121
}
1117
1122
1118
1123
1124
+ final public int sketchWindowColor () {
1125
+ return windowColor ;
1126
+ }
1127
+
1128
+
1129
+
1119
1130
public void orientation (int which ) {
1120
1131
if (which == PORTRAIT ) {
1121
1132
setRequestedOrientation (ActivityInfo .SCREEN_ORIENTATION_PORTRAIT );
@@ -1527,8 +1538,8 @@ public void draw() {
1527
1538
// layout.invalidate();
1528
1539
// }
1529
1540
// }
1530
-
1531
-
1541
+
1542
+
1532
1543
/**
1533
1544
* Create a full-screen sketch using the default renderer.
1534
1545
*/
@@ -1606,8 +1617,8 @@ public void size(int iwidth, int iheight, String irenderer) {
1606
1617
}
1607
1618
}
1608
1619
}
1609
-
1610
-
1620
+
1621
+
1611
1622
//. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1612
1623
1613
1624
@@ -1681,7 +1692,7 @@ public void size(final int iwidth, final int iheight,
1681
1692
final String irenderer , final String ipath ) {
1682
1693
if (iwidth != this .width || iheight != this .height ||
1683
1694
!this .renderer .equals (irenderer )) {
1684
- if (insideSettings ("size" , iwidth , iheight , irenderer ,
1695
+ if (insideSettings ("size" , iwidth , iheight , irenderer ,
1685
1696
ipath )) {
1686
1697
this .width = iwidth ;
1687
1698
this .height = iheight ;
@@ -3635,8 +3646,8 @@ static public void println(Object what) {
3635
3646
}
3636
3647
}
3637
3648
}
3638
-
3639
-
3649
+
3650
+
3640
3651
/**
3641
3652
* @webref output:text_area
3642
3653
* @param what one-dimensional array
@@ -8128,6 +8139,21 @@ public void normal(float nx, float ny, float nz) {
8128
8139
}
8129
8140
8130
8141
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
+
8131
8157
/**
8132
8158
* Set texture mode to either to use coordinates based on the IMAGE
8133
8159
* (more intuitive for new users) or NORMALIZED (better for advanced chaps)
@@ -8239,11 +8265,12 @@ public PShape loadShape(String filename) {
8239
8265
}
8240
8266
8241
8267
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
+ */
8247
8274
public PShape createShape () {
8248
8275
return g .createShape ();
8249
8276
}
@@ -8254,6 +8281,10 @@ public PShape createShape(int type) {
8254
8281
}
8255
8282
8256
8283
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
+ */
8257
8288
public PShape createShape (int kind , float ... p ) {
8258
8289
return g .createShape (kind , p );
8259
8290
}
0 commit comments