You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import processing.core.PApplet;
|
|
|
|
|
|
|
|
|
|
|
|
class ProjectorApplet extends PApplet {
|
|
|
|
final int projectorScreenNumber = 2;
|
|
|
|
|
|
|
|
final static int centerX = 860;
|
|
|
|
final static int centerY = 540;
|
|
|
|
|
|
|
|
EuglenaApplet parent;
|
|
|
|
Calibrator calibrator;
|
|
|
|
|
|
|
|
ProjectorApplet(EuglenaApplet parent) {
|
|
|
|
this.parent = parent;
|
|
|
|
calibrator = new Calibrator(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void settings() {
|
|
|
|
fullScreen(P2D, this.projectorScreenNumber);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void setup() {
|
|
|
|
clear();
|
|
|
|
calibrator.activate();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void draw() {
|
|
|
|
background(50);
|
|
|
|
fill(255);
|
|
|
|
ellipse(mouseX, mouseY, 10, 10);
|
|
|
|
|
|
|
|
calibrator.draw(parent);
|
|
|
|
}
|
|
|
|
|
|
|
|
public float convertXCoord(float x) {
|
|
|
|
return (x / calibrator.magx + width * calibrator.offsetx);
|
|
|
|
}
|
|
|
|
|
|
|
|
public float convertYCoord(float y) {
|
|
|
|
return (y / calibrator.magy + height * calibrator.offsety);
|
|
|
|
}
|
|
|
|
|
|
|
|
public float convertXDistance(float dx) {
|
|
|
|
return (dx / calibrator.magx);
|
|
|
|
}
|
|
|
|
|
|
|
|
public float convertYDistance(float dy) {
|
|
|
|
return (dy / calibrator.magy);
|
|
|
|
}
|
|
|
|
}
|