Add more comments
This commit is contained in:
parent
ccce12c725
commit
26db90a78b
7 changed files with 166 additions and 143 deletions
|
|
@ -1,3 +1,7 @@
|
|||
/*
|
||||
Interface for handling mouse clicks
|
||||
*/
|
||||
|
||||
public interface ClickGetter {
|
||||
boolean click(int mouseX, int mouseY);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,9 +4,10 @@ import processing.core.*;
|
|||
public class EuglenaApplet extends PApplet {
|
||||
/*
|
||||
This is the main Processing applet.
|
||||
This applet draws the main window and menu
|
||||
*/
|
||||
|
||||
final int cameraMode = 9;
|
||||
final int cameraMode = 8;
|
||||
final int whichArduino = 0;
|
||||
|
||||
// Hardware
|
||||
|
|
|
|||
|
|
@ -3,6 +3,10 @@ import static processing.core.PApplet.*;
|
|||
import cc.arduino.*;
|
||||
|
||||
class LEDControl {
|
||||
/*
|
||||
LED controller
|
||||
*/
|
||||
|
||||
final int comRate = 57600;
|
||||
|
||||
Arduino arduino;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,10 @@ import static processing.core.PApplet.*;
|
|||
|
||||
|
||||
class Line {
|
||||
/*
|
||||
Class representing a line
|
||||
*/
|
||||
|
||||
float x1, y1, x2, y2;
|
||||
int color, brushSize;
|
||||
boolean visible;
|
||||
|
|
@ -31,6 +35,14 @@ class Line {
|
|||
|
||||
|
||||
ProjectorCommand makeProjectorCommand() {
|
||||
/*
|
||||
Create a ProjectorCommand which draws ourselves!
|
||||
|
||||
The ```(arg) -> {my(); commands(); here(); return v}``` syntax creates a
|
||||
"closure", which is just a function that we write on-the-fly and
|
||||
store for later use.
|
||||
*/
|
||||
|
||||
return (ProjectorApplet p) -> {
|
||||
if (!visible) {
|
||||
//done drawing already
|
||||
|
|
@ -54,6 +66,11 @@ class Line {
|
|||
}
|
||||
|
||||
ClickGetter makeClickGetter(ProjectorApplet p) {
|
||||
/*
|
||||
Create a ClickGetter which can accept incoming mouse clicks
|
||||
and use them to update ourselves.
|
||||
*/
|
||||
|
||||
return (int x, int y) -> {
|
||||
if (!point1complete){
|
||||
x1 = x;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,10 @@ import static processing.core.PApplet.*;
|
|||
import controlP5.*;
|
||||
|
||||
class Menu {
|
||||
/*
|
||||
Right-side menu
|
||||
*/
|
||||
|
||||
final int width = 200; // Width of toolbar on left side of display
|
||||
|
||||
EuglenaApplet parent;
|
||||
|
|
@ -189,6 +193,11 @@ class Menu {
|
|||
}
|
||||
|
||||
void controlEvent(ControlEvent theEvent) {
|
||||
/*
|
||||
Handle a controlEvent -- controlP5 generates these events anytime
|
||||
a menu item is clicked.
|
||||
*/
|
||||
|
||||
//println(theEvent);
|
||||
if (theEvent.isFrom(shapesList)) {
|
||||
switch((int) shapesList.getValue()) {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,21 @@
|
|||
/*
|
||||
This file defines the ProjectorCommand interface.
|
||||
|
||||
It says, "if you want a class you wrote to also be a ProjectorCommand,
|
||||
it must have a method ```run``` which takes a ProjectorApplet and
|
||||
returns a boolean".
|
||||
|
||||
You can quickly make a ProjectorCommand by using the syntax
|
||||
|
||||
yourLocalVariable = 5;
|
||||
ProjectorCommand yourCommand = (ProjectorApplet p) -> {
|
||||
your(yourLocalVariable);
|
||||
code();
|
||||
here();
|
||||
}
|
||||
return yourCommand;
|
||||
*/
|
||||
|
||||
public interface ProjectorCommand {
|
||||
boolean run(ProjectorApplet p) throws ProjectorCommandException;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue