diff --git a/controlsActions.pde b/controlsActions.pde index 1549833..27e5a84 100644 --- a/controlsActions.pde +++ b/controlsActions.pde @@ -141,17 +141,17 @@ void button_mode_liveConfirmDraw() { if (captureShape != null) { - // save shape as SVG - - + confirmedDraw = true; // work out scaling and position float scaling = getDisplayMachine().inMM(getDisplayMachine().getPictureFrame().getWidth()) / captureShape.getWidth(); PVector position = new PVector(getDisplayMachine().inMM(getDisplayMachine().getPictureFrame().getPosition().x), getDisplayMachine().inMM(getDisplayMachine().getPictureFrame().getPosition().y) + (captureShape.getHeight() * scaling)); sendVectorShapes(captureShape, scaling, position); - webcam_saveShape(captureShape); button_mode_penUp(); + + // save shape as SVG + webcam_saveShape(captureShape); } } diff --git a/data/dpadlr.png b/data/dpadlr.png new file mode 100644 index 0000000..ea70d84 Binary files /dev/null and b/data/dpadlr.png differ diff --git a/data/dpadud.png b/data/dpadud.png new file mode 100644 index 0000000..53dd1dd Binary files /dev/null and b/data/dpadud.png differ diff --git a/drawing.pde b/drawing.pde index 07c56c7..ad709a1 100644 --- a/drawing.pde +++ b/drawing.pde @@ -714,9 +714,6 @@ public RPoint[][] sortPathLongestFirst(RPoint[][] pointPaths, int highPassCutoff } } - for (RPoint[] path : pathsList) - println(path.length + ", "); - // sort the list Collections.sort(pathsList, new Comparator() { public int compare(RPoint[] o1, RPoint[] o2) { @@ -746,12 +743,14 @@ List removeShortPaths(List list, int cutoff) { if (cutoff > 0) { - int numberOfPaths = list.size()-1; - for (int i=0; i it = list.listIterator(); + while (it.hasNext()) { - if (cutoff >= list.get(i).length) + RPoint[] paths = it.next(); + if (paths == null || cutoff >= paths.length) { - list.remove(i); + it.remove(); } } } diff --git a/gamepad.pde b/gamepad.pde index e58ba34..fb0aba4 100644 --- a/gamepad.pde +++ b/gamepad.pde @@ -113,13 +113,25 @@ void processGamepadInput() { if (signalFromGamepad != null) { + println("Signal from gamepad: " + signalFromGamepad); if (signalFromGamepad == BUTTON_A_RELEASED) - if (captureShape == null) + { + if (captureShape == null && !confirmedDraw) button_mode_liveCaptureFromLive(); - else + else if (captureShape != null && !confirmedDraw) button_mode_liveClearCapture(); + else if (captureShape != null && confirmedDraw) + { + button_mode_liveClearCapture(); + button_mode_clearQueue(); + confirmedDraw = false; + } + } else if (signalFromGamepad == BUTTON_B_RELEASED) - button_mode_liveConfirmDraw(); + { + if (captureShape != null && !confirmedDraw) + button_mode_liveConfirmDraw(); + } // clear the signal diff --git a/polargraphcontroller_webcam.pde b/polargraphcontroller_webcam.pde index cccf110..262ec5c 100644 --- a/polargraphcontroller_webcam.pde +++ b/polargraphcontroller_webcam.pde @@ -461,6 +461,7 @@ public boolean useWindowedConsole = false; static boolean drawingLiveVideo = false; static boolean drawingWebcamShape = true; static boolean flipWebcamImage = true; +static boolean confirmedDraw = false; static PImage liveImage = null; static PImage processedLiveImage = null; @@ -495,6 +496,9 @@ PImage xButtonImage = null; PImage aButtonImage = null; PImage bButtonImage = null; +PImage dpadXImage = null; +PImage dpadYImage = null; + void setup() { println("Running polargraph controller"); @@ -883,22 +887,36 @@ void drawImageLoadPage() void displayGamepadOverlay() { textSize(40); - + fill(255); + if (captureShape == null) { - image(aButtonImage, width-190, height-180, 128, 128); - fill(255); - text("SNAP!", width-180, height-200); + image(aButtonImage, width-400, height-180, 128, 128); + text("SNAP!", width-400, height-200); + + textSize(30); + image(dpadYImage, width-600, height-180, 128, 128); + text("Simplify", width-600, height-200); + + image(dpadXImage, width-600, height-400, 128, 128); + text("Filter short paths", width-600, height-420); + + } else { - image(aButtonImage, width-400, height-180, 128, 128); - fill(255); - text("BACK", width-400, height-200); - - image(bButtonImage, width-190, height-180, 128, 128); - fill(255); - text("DRAW!", width-180, height-200); + if (confirmedDraw) + { + image(aButtonImage, width-400, height-180, 128, 128); + text("CANCEL!", width-385, height-200); + } + else + { + image(aButtonImage, width-400, height-180, 128, 128); + text("BACK", width-400, height-200); + image(bButtonImage, width-190, height-180, 128, 128); + text("DRAW!", width-180, height-200); + } } @@ -3013,6 +3031,8 @@ void initImages() xButtonImage = loadImage("x.png"); aButtonImage = loadImage("a.png"); bButtonImage = loadImage("b.png"); + dpadXImage = loadImage("dpadlr.png"); + dpadYImage = loadImage("dpadud.png"); } catch (Exception e) {