Added dpad stuff, and some workflow.

This commit is contained in:
Sandy Noble 2013-03-31 21:42:33 +01:00
parent f02873b218
commit 4b10190eba
6 changed files with 56 additions and 25 deletions

View File

@ -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);
}
}

BIN
data/dpadlr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

BIN
data/dpadud.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@ -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<RPoint[]>() {
public int compare(RPoint[] o1, RPoint[] o2) {
@ -746,12 +743,14 @@ List<RPoint[]> removeShortPaths(List<RPoint[]> list, int cutoff)
{
if (cutoff > 0)
{
int numberOfPaths = list.size()-1;
for (int i=0; i<numberOfPaths; i++)
int numberOfPaths = list.size();
ListIterator<RPoint[]> 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();
}
}
}

View File

@ -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

View File

@ -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)
{