ellipse works via mouse + menu, but dimensions are probably wrong
This commit is contained in:
parent
df880a0e66
commit
58bb1611c8
4 changed files with 120 additions and 90 deletions
|
|
@ -54,7 +54,7 @@ class Ellipse {
|
|||
};
|
||||
}
|
||||
|
||||
ClickGetter clickGetter(ProjectorApplet p) {
|
||||
ClickGetter makeClickGetter(ProjectorApplet p) {
|
||||
return (int x, int y) -> {
|
||||
if (!centerPointComplete){
|
||||
centerX = x;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import controlP5.ControlEvent;
|
||||
import processing.core.*;
|
||||
|
||||
public class EuglenaApplet extends PApplet {
|
||||
|
|
@ -14,7 +15,10 @@ public class EuglenaApplet extends PApplet {
|
|||
Calibrator calibrator;
|
||||
ClickGetter clickGetter;
|
||||
|
||||
boolean tester;
|
||||
//Pen
|
||||
int penColor = color(200);
|
||||
int penWidth = 15;
|
||||
|
||||
|
||||
public static void main(String args[]) {
|
||||
PApplet.main("EuglenaApplet");
|
||||
|
|
@ -40,7 +44,6 @@ public class EuglenaApplet extends PApplet {
|
|||
projectorApplet = new ProjectorApplet(this);
|
||||
String[] args = {"Euglena projector"};
|
||||
PApplet.runSketch(args, projectorApplet);
|
||||
tester = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -52,13 +55,6 @@ public class EuglenaApplet extends PApplet {
|
|||
imageMode(PApplet.CORNER);
|
||||
image(camera.getImage(), 0, 0, width - menu.width, height);
|
||||
|
||||
if (!tester) {
|
||||
// this.projectorApplet.commandQueue.add(new Ellipse(0f, 0f, 1000f, 1000f, color(250, 250, 250), 8).drawCommand());
|
||||
|
||||
this.clickGetter = new Ellipse(color(255), 10).clickGetter(projectorApplet);
|
||||
tester = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -71,6 +67,10 @@ public class EuglenaApplet extends PApplet {
|
|||
}
|
||||
}
|
||||
|
||||
public void controlEvent(ControlEvent theEvent) {
|
||||
menu.controlEvent(theEvent);
|
||||
}
|
||||
|
||||
void drawArrow(int cx, int cy, int len, float angle){
|
||||
pushMatrix();
|
||||
translate(cx, cy);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
import processing.core.*;
|
||||
import static processing.core.PApplet.*;
|
||||
import controlP5.*;
|
||||
|
||||
class Menu {
|
||||
final int width = 200; // Width of toolbar on left side of display
|
||||
|
||||
EuglenaApplet parent;
|
||||
|
||||
private Button resetButton, calibrateButton, commitButton, lineButton, freehandButton, eraserButton, goButton;
|
||||
private Textfield redField, greenField, blueField, backgroundField, penwidthField,
|
||||
lagField, totaltimeField, speedField;
|
||||
|
|
@ -13,7 +16,8 @@ class Menu {
|
|||
|
||||
private Group g1, g2, g3;
|
||||
|
||||
Menu(PApplet applet){
|
||||
Menu(EuglenaApplet applet){
|
||||
parent = applet;
|
||||
|
||||
cp5 = new ControlP5(applet).setPosition(applet.width - width, 0);
|
||||
|
||||
|
|
@ -183,25 +187,23 @@ class Menu {
|
|||
a.fill(0);
|
||||
a.rect(a.width - width, 0, width, a.height);
|
||||
}
|
||||
/*
|
||||
|
||||
void controlEvent(ControlEvent theEvent) {
|
||||
if (theEvent.isFrom(shapesList)) {
|
||||
switch((int) shapesList.getValue()) {
|
||||
case 0:
|
||||
ellipseDrawer.reset();
|
||||
drawtype = 'e';
|
||||
parent.clickGetter = new Ellipse(parent.penColor, parent.penWidth)
|
||||
.makeClickGetter(parent.projectorApplet);
|
||||
break;
|
||||
case 1:
|
||||
rectangleDrawer.reset();
|
||||
drawtype = 'r';
|
||||
//rectangleDrawer.reset();
|
||||
break;
|
||||
case 2:
|
||||
triangleDrawer.reset();
|
||||
drawtype = 't';
|
||||
//triangleDrawer.reset();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if (theEvent.isFrom(animateList)){
|
||||
switch((int) animateList.getValue()) {
|
||||
case 0:
|
||||
|
|
@ -226,8 +228,8 @@ class Menu {
|
|||
if (theEvent.isFrom(presetsList)){
|
||||
preset = (int) presetsList.getValue();
|
||||
}
|
||||
*/
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue