mirror of
https://github.com/processing/processing4.git
synced 2026-02-11 09:39:19 +01:00
printarr() totally gone, print() and println() take control
This commit is contained in:
@@ -1998,8 +1998,85 @@ public class PApplet extends Applet
|
||||
}
|
||||
|
||||
static public void print(Object what) {
|
||||
System.out.print(what.toString());
|
||||
System.out.flush();
|
||||
if (what == null) {
|
||||
// special case since this does fuggly things on > 1.1
|
||||
System.out.print("null");
|
||||
|
||||
} else {
|
||||
String name = what.getClass().getName();
|
||||
if (name.charAt(0) == '[') {
|
||||
switch (name.charAt(1)) {
|
||||
case '[':
|
||||
// don't even mess with multi-dimensional arrays (case '[')
|
||||
// or anything else that's not int, float, boolean, char
|
||||
System.out.print(what);
|
||||
System.out.print(' ');
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
// print a 1D array of objects as individual elements
|
||||
Object poo[] = (Object[]) what;
|
||||
for (int i = 0; i < poo.length; i++) {
|
||||
System.out.print(poo[i]);
|
||||
System.out.print(' ');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'Z': // boolean
|
||||
boolean zz[] = (boolean[]) what;
|
||||
for (int i = 0; i < zz.length; i++) {
|
||||
System.out.print(zz[i]);
|
||||
System.out.print(' ');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'B': // byte
|
||||
byte bb[] = (byte[]) what;
|
||||
for (int i = 0; i < bb.length; i++) {
|
||||
System.out.print(bb[i]);
|
||||
System.out.print(' ');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'C': // char
|
||||
char cc[] = (char[]) what;
|
||||
for (int i = 0; i < cc.length; i++) {
|
||||
System.out.print(cc[i]);
|
||||
System.out.print(' ');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'I': // int
|
||||
int ii[] = (int[]) what;
|
||||
for (int i = 0; i < ii.length; i++) {
|
||||
System.out.print(ii[i]);
|
||||
System.out.print(' ');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'F': // float
|
||||
float ff[] = (float[]) what;
|
||||
for (int i = 0; i < ff.length; i++) {
|
||||
System.out.print(ff[i]);
|
||||
System.out.print(' ');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'D': // double
|
||||
double dd[] = (double[]) what;
|
||||
for (int i = 0; i < dd.length; i++) {
|
||||
System.out.print(dd[i]);
|
||||
System.out.print(' ');
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
System.out.print(what);
|
||||
}
|
||||
} else {
|
||||
System.out.print(what); //.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -2039,11 +2116,82 @@ public class PApplet extends Applet
|
||||
}
|
||||
|
||||
static public void println(Object what) {
|
||||
System.out.println(what.toString());
|
||||
if (what == null) {
|
||||
// special case since this does fuggly things on > 1.1
|
||||
System.out.println("null");
|
||||
|
||||
} else {
|
||||
String name = what.getClass().getName();
|
||||
if (name.charAt(0) == '[') {
|
||||
switch (name.charAt(1)) {
|
||||
case '[':
|
||||
// don't even mess with multi-dimensional arrays (case '[')
|
||||
// or anything else that's not int, float, boolean, char
|
||||
System.out.println(what);
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
// print a 1D array of objects as individual elements
|
||||
Object poo[] = (Object[]) what;
|
||||
for (int i = 0; i < poo.length; i++) {
|
||||
System.out.println(poo[i]);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'Z': // boolean
|
||||
boolean zz[] = (boolean[]) what;
|
||||
for (int i = 0; i < zz.length; i++) {
|
||||
System.out.println(zz[i]);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'B': // byte
|
||||
byte bb[] = (byte[]) what;
|
||||
for (int i = 0; i < bb.length; i++) {
|
||||
System.out.println(bb[i]);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'C': // char
|
||||
char cc[] = (char[]) what;
|
||||
for (int i = 0; i < cc.length; i++) {
|
||||
System.out.println(cc[i]);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'I': // int
|
||||
int ii[] = (int[]) what;
|
||||
for (int i = 0; i < ii.length; i++) {
|
||||
System.out.println(ii[i]);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'F': // float
|
||||
float ff[] = (float[]) what;
|
||||
for (int i = 0; i < ff.length; i++) {
|
||||
System.out.println(ff[i]);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'D': // double
|
||||
double dd[] = (double[]) what;
|
||||
for (int i = 0; i < dd.length; i++) {
|
||||
System.out.println(dd[i]);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
System.out.println(what);
|
||||
}
|
||||
} else {
|
||||
System.out.println(what); //.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
/*
|
||||
static public void printarr(byte what[]) {
|
||||
for (int i = 0; i < what.length; i++) System.out.println(what[i]);
|
||||
System.out.flush();
|
||||
@@ -2083,6 +2231,7 @@ public class PApplet extends Applet
|
||||
for (int i = 0; i < what.length; i++) System.out.println(what[i]);
|
||||
System.out.flush();
|
||||
}
|
||||
*/
|
||||
|
||||
//
|
||||
|
||||
|
||||
@@ -123,8 +123,8 @@ X PFont.list() to return string list of all the available fonts
|
||||
X probably not a mode of use that we really want to encourage
|
||||
X actually important because the whole graphicsdevice crap is silly
|
||||
X and we need a 1.1 versus 1.3/1.4 version
|
||||
|
||||
_ implement printarr() as println() ?
|
||||
X implement printarr() as println() ?
|
||||
X actually deal with all the array types.. oy
|
||||
|
||||
_ rename video.Camera to video.Video ?
|
||||
_ VideoInput VideoOutput, SoundInput, SoundOutput or AudioInput/AudioOutput
|
||||
@@ -134,16 +134,16 @@ _ but don't put commas into the zero-padded version
|
||||
_ make nf/nfs/nfp not so weird
|
||||
_ nf(PLUS, ...) nf(PAD, ...) nfc(PLUS, ...)
|
||||
|
||||
_ fix the flicker in java2d mode
|
||||
X is it because the lock was taken off (g) in PApplet?
|
||||
_ appears to be much worse (unfinished drawing) on macosx
|
||||
_ try turning off hw accel on the mac to see if that's the problem
|
||||
|
||||
|
||||
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
NOT NECESSARY BEFORE BETA
|
||||
NOT COMPLETELY NECESSARY BEFORE BETA
|
||||
|
||||
_ fix the flicker in java2d mode
|
||||
_ not clear what's happening here
|
||||
_ appears to be much worse (unfinished drawing) on macosx
|
||||
_ try turning off hw accel on the mac to see if that's the problem
|
||||
|
||||
_ post() method to send a bunch of crap to a web url?
|
||||
_ or an example that does this?
|
||||
|
||||
@@ -14,9 +14,6 @@ _ remove PdeXxx prefixes on names, make PdeBase into just "Processing"
|
||||
|
||||
_ fix macos readme about how to boost memory size, and 1.3 vs 1.4
|
||||
|
||||
_ placement of 100x100 items is odd
|
||||
_ happens with P3D and maybe also P2D?
|
||||
|
||||
_ update .exe to use new class/package
|
||||
_ update .app to use new class/package
|
||||
_ update linux build and shell scripts for new package
|
||||
@@ -92,6 +89,9 @@ saving a project over an already existing project does not get rid of the .pde f
|
||||
|
||||
NOT NECESSARY BEFORE BETA
|
||||
|
||||
_ placement of 100x100 items is odd
|
||||
_ happens with P3D and maybe also P2D?
|
||||
|
||||
_ if in full java mode
|
||||
_ if extends PApplet.. or rather, put PApplet cast into a
|
||||
_ try/catch block.. if it doesn't work, try applet. if that
|
||||
|
||||
Reference in New Issue
Block a user