mirror of
https://github.com/processing/processing4.git
synced 2026-01-28 10:51:07 +01:00
Per https://github.com/processing/processing4/issues/58, pixelDensity should run in settings and currently results in failure if used in static context. This will rewrite pixelDensity into the setting section if found in static or settings context. Adds unit tests for both scenarios.
45 lines
1.0 KiB
Plaintext
45 lines
1.0 KiB
Plaintext
import processing.core.*;
|
|
import processing.data.*;
|
|
import processing.event.*;
|
|
import processing.opengl.*;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.ArrayList;
|
|
import java.io.File;
|
|
import java.io.BufferedReader;
|
|
import java.io.PrintWriter;
|
|
import java.io.InputStream;
|
|
import java.io.OutputStream;
|
|
import java.io.IOException;
|
|
|
|
public class parampixeldensity extends PApplet {
|
|
|
|
public void setup() {
|
|
/* size commented out by preprocessor */;
|
|
// Pulling the display's density dynamically
|
|
/* pixelDensity commented out by preprocessor */;
|
|
noStroke();
|
|
}
|
|
|
|
public void draw() {
|
|
background(0);
|
|
ellipse(30, 48, 36, 36);
|
|
ellipse(70, 48, 36, 36);
|
|
}
|
|
|
|
public void settings() {
|
|
size(100,100);
|
|
pixelDensity(displayDensity());
|
|
}
|
|
|
|
static public void main(String[] passedArgs) {
|
|
String[] appletArgs = new String[] { "parampixeldensity" };
|
|
if (passedArgs != null) {
|
|
PApplet.main(concat(appletArgs, passedArgs));
|
|
} else {
|
|
PApplet.main(appletArgs);
|
|
}
|
|
}
|
|
|
|
}
|