mirror of
https://github.com/euphy/polargraphcontroller
synced 2024-11-13 01:47:57 +01:00
Added dpad stuff, and some workflow.
This commit is contained in:
parent
f02873b218
commit
4b10190eba
@ -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
BIN
data/dpadlr.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.5 KiB |
BIN
data/dpadud.png
Normal file
BIN
data/dpadud.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.5 KiB |
13
drawing.pde
13
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<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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
18
gamepad.pde
18
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
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user