mirror of
https://github.com/euphy/polargraphcontroller
synced 2025-01-09 19:55:16 +01:00
Getting there...
This commit is contained in:
parent
765b09ff55
commit
55a32c8b70
43
ControlFrame.pde
Normal file
43
ControlFrame.pde
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
// the ControlFrame class extends PApplet, so we
|
||||||
|
// are creating a new processing applet inside a
|
||||||
|
// new frame with a controlP5 object loaded
|
||||||
|
public class ControlFrame extends PApplet {
|
||||||
|
|
||||||
|
int w, h;
|
||||||
|
|
||||||
|
int abc = 100;
|
||||||
|
|
||||||
|
public void setup() {
|
||||||
|
size(w, h);
|
||||||
|
frameRate(25);
|
||||||
|
cp5 = new ControlP5(this);
|
||||||
|
cp5.addSlider("abc").setRange(0, 255).setPosition(10,10);
|
||||||
|
cp5.addSlider("def").plugTo(parent,"def").setRange(0, 255).setPosition(10,30);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void draw() {
|
||||||
|
background(abc);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ControlFrame() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public ControlFrame(Object theParent, int theWidth, int theHeight) {
|
||||||
|
parent = theParent;
|
||||||
|
w = theWidth;
|
||||||
|
h = theHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ControlP5 control() {
|
||||||
|
return cp5;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ControlP5 cp5;
|
||||||
|
|
||||||
|
Object parent;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
/**
|
Frame/**
|
||||||
Polargraph controller
|
Polargraph controller
|
||||||
Copyright Sandy Noble 2012.
|
Copyright Sandy Noble 2012.
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ void button_mode_serialPortDialog()
|
|||||||
serialPortWindow.hideCoordinates();
|
serialPortWindow.hideCoordinates();
|
||||||
|
|
||||||
serialPortWindow.setBackground(getBackgroundColour());
|
serialPortWindow.setBackground(getBackgroundColour());
|
||||||
Radio r = cp5.addRadio("radio_serialPort",10,10);
|
RadioButton r = cp5.addRadio("radio_serialPort",10,10);
|
||||||
r.setWindow(serialPortWindow);
|
r.setWindow(serialPortWindow);
|
||||||
|
|
||||||
String[] ports = Serial.list();
|
String[] ports = Serial.list();
|
||||||
@ -129,440 +129,440 @@ void radio_serialPort(int newSerialPort)
|
|||||||
/*------------------------------------------------------------------------
|
/*------------------------------------------------------------------------
|
||||||
Details about the "machine store" subwindow
|
Details about the "machine store" subwindow
|
||||||
------------------------------------------------------------------------*/
|
------------------------------------------------------------------------*/
|
||||||
|
//
|
||||||
ControlWindow dialogWindow = null;
|
//ControlWindow dialogWindow = null;
|
||||||
|
//
|
||||||
void button_mode_machineStoreDialog()
|
//void button_mode_machineStoreDialog()
|
||||||
{
|
//{
|
||||||
this.dialogWindow = cp5.addControlWindow("chooseStoreFilenameWindow",100,100,450,150);
|
// this.dialogWindow = cp5.addControlWindow("chooseStoreFilenameWindow",100,100,450,150);
|
||||||
dialogWindow.hideCoordinates();
|
// dialogWindow.hideCoordinates();
|
||||||
|
//
|
||||||
dialogWindow.setBackground(getBackgroundColour());
|
// dialogWindow.setBackground(getBackgroundColour());
|
||||||
|
//
|
||||||
Textfield filenameField = cp5.addTextfield("storeFilename",20,20,150,20);
|
// Textfield filenameField = cp5.addTextfield("storeFilename",20,20,150,20);
|
||||||
filenameField.setText(getStoreFilename());
|
// filenameField.setText(getStoreFilename());
|
||||||
filenameField.setLabel("Filename to store to");
|
// filenameField.setLabel("Filename to store to");
|
||||||
filenameField.setWindow(dialogWindow);
|
// filenameField.setWindow(dialogWindow);
|
||||||
|
//
|
||||||
Button submitButton = cp5.addButton("submitStoreFilenameWindow",0,180,20,60,20);
|
// Button submitButton = cp5.addButton("submitStoreFilenameWindow",0,180,20,60,20);
|
||||||
submitButton.setLabel("Submit");
|
// submitButton.setLabel("Submit");
|
||||||
submitButton.setWindow(dialogWindow);
|
// submitButton.setWindow(dialogWindow);
|
||||||
|
//
|
||||||
Toggle overwriteToggle = cp5.addToggle("toggleAppendToFile",true,180,50,20,20);
|
// Toggle overwriteToggle = cp5.addToggle("toggleAppendToFile",true,180,50,20,20);
|
||||||
overwriteToggle.setCaptionLabel("Overwrite existing file");
|
// overwriteToggle.setCaptionLabel("Overwrite existing file");
|
||||||
overwriteToggle.setWindow(dialogWindow);
|
// overwriteToggle.setWindow(dialogWindow);
|
||||||
|
//
|
||||||
filenameField.setFocus(true);
|
// filenameField.setFocus(true);
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
void storeFilename(String filename)
|
//void storeFilename(String filename)
|
||||||
{
|
//{
|
||||||
println("Filename event: "+ filename);
|
// println("Filename event: "+ filename);
|
||||||
if (filename != null && filename.length() <= 12)
|
// if (filename != null && filename.length() <= 12)
|
||||||
{
|
// {
|
||||||
setStoreFilename(filename);
|
// setStoreFilename(filename);
|
||||||
sendMachineStoreMode();
|
// sendMachineStoreMode();
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
void toggleAppendToFile(boolean theFlag)
|
//void toggleAppendToFile(boolean theFlag)
|
||||||
{
|
//{
|
||||||
setOverwriteExistingStoreFile(theFlag);
|
// setOverwriteExistingStoreFile(theFlag);
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
void submitStoreFilenameWindow(int theValue)
|
//void submitStoreFilenameWindow(int theValue)
|
||||||
{
|
//{
|
||||||
Textfield tf = (Textfield) cp5.controller("storeFilename");
|
// Textfield tf = (Textfield) cp5.controller("storeFilename");
|
||||||
tf.submit();
|
// tf.submit();
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
void button_mode_machineExecDialog()
|
//void button_mode_machineExecDialog()
|
||||||
{
|
//{
|
||||||
this.dialogWindow = cp5.addControlWindow("chooseExecFilenameWindow",100,100,450,150);
|
// this.dialogWindow = cp5.addControlWindow("chooseExecFilenameWindow",100,100,450,150);
|
||||||
dialogWindow.hideCoordinates();
|
// dialogWindow.hideCoordinates();
|
||||||
|
//
|
||||||
dialogWindow.setBackground(getBackgroundColour());
|
// dialogWindow.setBackground(getBackgroundColour());
|
||||||
|
//
|
||||||
Textfield filenameField = cp5.addTextfield("execFilename",20,20,150,20);
|
// Textfield filenameField = cp5.addTextfield("execFilename",20,20,150,20);
|
||||||
filenameField.setText(getStoreFilename());
|
// filenameField.setText(getStoreFilename());
|
||||||
filenameField.setLabel("Filename to execute from");
|
// filenameField.setLabel("Filename to execute from");
|
||||||
filenameField.setWindow(dialogWindow);
|
// filenameField.setWindow(dialogWindow);
|
||||||
|
//
|
||||||
Button submitButton = cp5.addButton("submitExecFilenameWindow",0,180,20,60,20);
|
// Button submitButton = cp5.addButton("submitExecFilenameWindow",0,180,20,60,20);
|
||||||
submitButton.setLabel("Submit");
|
// submitButton.setLabel("Submit");
|
||||||
submitButton.setWindow(dialogWindow);
|
// submitButton.setWindow(dialogWindow);
|
||||||
|
//
|
||||||
filenameField.setFocus(true);
|
// filenameField.setFocus(true);
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
void execFilename(String filename)
|
//void execFilename(String filename)
|
||||||
{
|
//{
|
||||||
println("Filename event: "+ filename);
|
// println("Filename event: "+ filename);
|
||||||
if (filename != null && filename.length() <= 12)
|
// if (filename != null && filename.length() <= 12)
|
||||||
{
|
// {
|
||||||
setStoreFilename(filename);
|
// setStoreFilename(filename);
|
||||||
sendMachineExecMode();
|
// sendMachineExecMode();
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
void submitExecFilenameWindow(int theValue)
|
//void submitExecFilenameWindow(int theValue)
|
||||||
{
|
//{
|
||||||
Textfield tf = (Textfield) cp5.controller("execFilename");
|
// Textfield tf = (Textfield) cp5.controller("execFilename");
|
||||||
tf.submit();
|
// tf.submit();
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
void button_mode_sendMachineLiveMode()
|
//void button_mode_sendMachineLiveMode()
|
||||||
{
|
//{
|
||||||
sendMachineLiveMode();
|
// sendMachineLiveMode();
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
/*------------------------------------------------------------------------
|
///*------------------------------------------------------------------------
|
||||||
Details about the "drawing" subwindow
|
// Details about the "drawing" subwindow
|
||||||
------------------------------------------------------------------------*/
|
//------------------------------------------------------------------------*/
|
||||||
void button_mode_drawPixelsDialog()
|
//void button_mode_drawPixelsDialog()
|
||||||
{
|
//{
|
||||||
this.dialogWindow = cp5.addControlWindow("drawPixelsWindow",100,100,450,150);
|
// this.dialogWindow = cp5.addControlWindow("drawPixelsWindow",100,100,450,150);
|
||||||
dialogWindow.hideCoordinates();
|
// dialogWindow.hideCoordinates();
|
||||||
|
//
|
||||||
dialogWindow.setBackground(getBackgroundColour());
|
// dialogWindow.setBackground(getBackgroundColour());
|
||||||
|
//
|
||||||
Radio rPos = cp5.addRadio("radio_startPosition",10,10);
|
// Radio rPos = cp5.addRadio("radio_startPosition",10,10);
|
||||||
rPos.add("Top-right", DRAW_DIR_NE);
|
// rPos.add("Top-right", DRAW_DIR_NE);
|
||||||
rPos.add("Bottom-right", DRAW_DIR_SE);
|
// rPos.add("Bottom-right", DRAW_DIR_SE);
|
||||||
rPos.add("Bottom-left", DRAW_DIR_SW);
|
// rPos.add("Bottom-left", DRAW_DIR_SW);
|
||||||
rPos.add("Top-left", DRAW_DIR_NW);
|
// rPos.add("Top-left", DRAW_DIR_NW);
|
||||||
rPos.setWindow(dialogWindow);
|
// rPos.setWindow(dialogWindow);
|
||||||
|
//
|
||||||
Radio rSkip = cp5.addRadio("radio_pixelSkipStyle",10,100);
|
// Radio rSkip = cp5.addRadio("radio_pixelSkipStyle",10,100);
|
||||||
rSkip.add("Lift pen over masked pixels", 1);
|
// rSkip.add("Lift pen over masked pixels", 1);
|
||||||
rSkip.add("Draw masked pixels as blanks", 2);
|
// rSkip.add("Draw masked pixels as blanks", 2);
|
||||||
rSkip.setWindow(dialogWindow);
|
// rSkip.setWindow(dialogWindow);
|
||||||
|
//
|
||||||
// Radio rDir = cp5.addRadio("radio_rowStartDirection",100,10);
|
//// Radio rDir = cp5.addRadio("radio_rowStartDirection",100,10);
|
||||||
// rDir.add("Upwards", 0);
|
//// rDir.add("Upwards", 0);
|
||||||
// rDir.add("Downwards", 1);
|
//// rDir.add("Downwards", 1);
|
||||||
// rDir.setWindow(dialogWindow);
|
//// rDir.setWindow(dialogWindow);
|
||||||
|
//
|
||||||
Radio rStyle = cp5.addRadio("radio_pixelStyle",100,10);
|
// Radio rStyle = cp5.addRadio("radio_pixelStyle",100,10);
|
||||||
rStyle.add("Variable frequency square wave", PIXEL_STYLE_SQ_FREQ);
|
// rStyle.add("Variable frequency square wave", PIXEL_STYLE_SQ_FREQ);
|
||||||
rStyle.add("Variable size square wave", PIXEL_STYLE_SQ_SIZE);
|
// rStyle.add("Variable size square wave", PIXEL_STYLE_SQ_SIZE);
|
||||||
rStyle.add("Solid square wave", PIXEL_STYLE_SQ_SOLID);
|
// rStyle.add("Solid square wave", PIXEL_STYLE_SQ_SOLID);
|
||||||
rStyle.add("Scribble", PIXEL_STYLE_SCRIBBLE);
|
// rStyle.add("Scribble", PIXEL_STYLE_SCRIBBLE);
|
||||||
if (currentHardware >= HARDWARE_VER_MEGA)
|
// if (currentHardware >= HARDWARE_VER_MEGA)
|
||||||
{
|
// {
|
||||||
rStyle.add("Spiral", PIXEL_STYLE_CIRCLE);
|
// rStyle.add("Spiral", PIXEL_STYLE_CIRCLE);
|
||||||
rStyle.add("Sawtooth", PIXEL_STYLE_SAW);
|
// rStyle.add("Sawtooth", PIXEL_STYLE_SAW);
|
||||||
}
|
// }
|
||||||
rStyle.setWindow(dialogWindow);
|
// rStyle.setWindow(dialogWindow);
|
||||||
|
//
|
||||||
Button submitButton = cp5.addButton("submitDrawWindow",0,280,10,120,20);
|
// Button submitButton = cp5.addButton("submitDrawWindow",0,280,10,120,20);
|
||||||
submitButton.setLabel("Generate commands");
|
// submitButton.setLabel("Generate commands");
|
||||||
submitButton.setWindow(dialogWindow);
|
// submitButton.setWindow(dialogWindow);
|
||||||
|
//
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
public Integer renderStartPosition = DRAW_DIR_NE; // default top right hand corner for start
|
//public Integer renderStartPosition = DRAW_DIR_NE; // default top right hand corner for start
|
||||||
public Integer renderStartDirection = DRAW_DIR_SE; // default start drawing in SE direction (DOWN)
|
//public Integer renderStartDirection = DRAW_DIR_SE; // default start drawing in SE direction (DOWN)
|
||||||
public Integer renderStyle = PIXEL_STYLE_SQ_FREQ; // default pixel style square wave
|
//public Integer renderStyle = PIXEL_STYLE_SQ_FREQ; // default pixel style square wave
|
||||||
void radio_startPosition(int pos)
|
//void radio_startPosition(int pos)
|
||||||
{
|
//{
|
||||||
this.renderStartPosition = pos;
|
// this.renderStartPosition = pos;
|
||||||
radio_rowStartDirection(1);
|
// radio_rowStartDirection(1);
|
||||||
}
|
//}
|
||||||
void radio_rowStartDirection(int dir)
|
//void radio_rowStartDirection(int dir)
|
||||||
{
|
//{
|
||||||
if (renderStartPosition == DRAW_DIR_NE || renderStartPosition == DRAW_DIR_SW)
|
// if (renderStartPosition == DRAW_DIR_NE || renderStartPosition == DRAW_DIR_SW)
|
||||||
renderStartDirection = (dir == 0) ? DRAW_DIR_NW : DRAW_DIR_SE;
|
// renderStartDirection = (dir == 0) ? DRAW_DIR_NW : DRAW_DIR_SE;
|
||||||
else if (renderStartPosition == DRAW_DIR_SE || renderStartPosition == DRAW_DIR_NW)
|
// else if (renderStartPosition == DRAW_DIR_SE || renderStartPosition == DRAW_DIR_NW)
|
||||||
renderStartDirection = (dir == 0) ? DRAW_DIR_NE : DRAW_DIR_SW;
|
// renderStartDirection = (dir == 0) ? DRAW_DIR_NE : DRAW_DIR_SW;
|
||||||
}
|
//}
|
||||||
void radio_pixelStyle(int style)
|
//void radio_pixelStyle(int style)
|
||||||
{
|
//{
|
||||||
renderStyle = style;
|
// renderStyle = style;
|
||||||
}
|
//}
|
||||||
void radio_pixelSkipStyle(int style)
|
//void radio_pixelSkipStyle(int style)
|
||||||
{
|
//{
|
||||||
if (style == 1)
|
// if (style == 1)
|
||||||
liftPenOnMaskedPixels = true;
|
// liftPenOnMaskedPixels = true;
|
||||||
else if (style == 2)
|
// else if (style == 2)
|
||||||
liftPenOnMaskedPixels = false;
|
// liftPenOnMaskedPixels = false;
|
||||||
}
|
//}
|
||||||
void submitDrawWindow(int theValue)
|
//void submitDrawWindow(int theValue)
|
||||||
{
|
//{
|
||||||
println("draw.");
|
// println("draw.");
|
||||||
println("Style: " + renderStyle);
|
// println("Style: " + renderStyle);
|
||||||
println("Start pos: " + renderStartPosition);
|
// println("Start pos: " + renderStartPosition);
|
||||||
println("Start dir: " + renderStartDirection);
|
// println("Start dir: " + renderStartDirection);
|
||||||
|
//
|
||||||
switch (renderStyle)
|
// switch (renderStyle)
|
||||||
{
|
// {
|
||||||
case PIXEL_STYLE_SQ_FREQ: button_mode_renderSquarePixel(); break;
|
// case PIXEL_STYLE_SQ_FREQ: button_mode_renderSquarePixel(); break;
|
||||||
case PIXEL_STYLE_SQ_SIZE: button_mode_renderScaledSquarePixels(); break;
|
// case PIXEL_STYLE_SQ_SIZE: button_mode_renderScaledSquarePixels(); break;
|
||||||
case PIXEL_STYLE_SQ_SOLID: button_mode_renderSolidSquarePixels(); break;
|
// case PIXEL_STYLE_SQ_SOLID: button_mode_renderSolidSquarePixels(); break;
|
||||||
case PIXEL_STYLE_SCRIBBLE: button_mode_renderScribblePixels(); break;
|
// case PIXEL_STYLE_SCRIBBLE: button_mode_renderScribblePixels(); break;
|
||||||
case PIXEL_STYLE_CIRCLE: button_mode_renderCirclePixel(); break;
|
// case PIXEL_STYLE_CIRCLE: button_mode_renderCirclePixel(); break;
|
||||||
case PIXEL_STYLE_SAW: button_mode_renderSawPixel(); break;
|
// case PIXEL_STYLE_SAW: button_mode_renderSawPixel(); break;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
/*------------------------------------------------------------------------
|
///*------------------------------------------------------------------------
|
||||||
Details about the "writing" subwindow
|
// Details about the "writing" subwindow
|
||||||
------------------------------------------------------------------------*/
|
//------------------------------------------------------------------------*/
|
||||||
String spriteFilePrefix = "sprite/let";
|
//String spriteFilePrefix = "sprite/let";
|
||||||
String spriteFileSuffix = ".txt";
|
//String spriteFileSuffix = ".txt";
|
||||||
|
//
|
||||||
void button_mode_drawWritingDialog()
|
//void button_mode_drawWritingDialog()
|
||||||
{
|
//{
|
||||||
this.dialogWindow = cp5.addControlWindow("drawWritingWindow",100,100,450,200);
|
// this.dialogWindow = cp5.addControlWindow("drawWritingWindow",100,100,450,200);
|
||||||
dialogWindow.hideCoordinates();
|
// dialogWindow.hideCoordinates();
|
||||||
|
//
|
||||||
dialogWindow.setBackground(getBackgroundColour());
|
// dialogWindow.setBackground(getBackgroundColour());
|
||||||
|
//
|
||||||
Textfield spriteFileField = cp5.addTextfield("spriteFilePrefixField",20,20,150,20);
|
// Textfield spriteFileField = cp5.addTextfield("spriteFilePrefixField",20,20,150,20);
|
||||||
spriteFileField.setText(getSpriteFilePrefix());
|
// spriteFileField.setText(getSpriteFilePrefix());
|
||||||
spriteFileField.setLabel("File prefix");
|
// spriteFileField.setLabel("File prefix");
|
||||||
spriteFileField.setWindow(dialogWindow);
|
// spriteFileField.setWindow(dialogWindow);
|
||||||
|
//
|
||||||
Textfield writingField = cp5.addTextfield("textToWriteField",20,60,400,20);
|
// Textfield writingField = cp5.addTextfield("textToWriteField",20,60,400,20);
|
||||||
writingField.setText(getTextToWrite());
|
// writingField.setText(getTextToWrite());
|
||||||
writingField.setLabel("Text to write");
|
// writingField.setLabel("Text to write");
|
||||||
writingField.setWindow(dialogWindow);
|
// writingField.setWindow(dialogWindow);
|
||||||
|
//
|
||||||
Button importTextButton = cp5.addButton("importTextButton",0,20,100,120,20);
|
// Button importTextButton = cp5.addButton("importTextButton",0,20,100,120,20);
|
||||||
importTextButton.setLabel("Load text from file");
|
// importTextButton.setLabel("Load text from file");
|
||||||
importTextButton.setWindow(dialogWindow);
|
// importTextButton.setWindow(dialogWindow);
|
||||||
|
//
|
||||||
Radio rPos = cp5.addRadio("radio_drawWritingDirection",20,140);
|
// Radio rPos = cp5.addRadio("radio_drawWritingDirection",20,140);
|
||||||
|
//// rPos.add("North-east", DRAW_DIR_NE);
|
||||||
|
// rPos.add("South-east", DRAW_DIR_SE);
|
||||||
|
//// rPos.add("South-west", DRAW_DIR_SW);
|
||||||
|
//// rPos.add("North-west", DRAW_DIR_NW);
|
||||||
|
// rPos.setWindow(dialogWindow);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Button submitButton = cp5.addButton("submitWritingWindow",0,300,100,120,20);
|
||||||
|
// submitButton.setLabel("Generate commands");
|
||||||
|
// submitButton.setWindow(dialogWindow);
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//void spriteFilePrefixField(String value)
|
||||||
|
//{
|
||||||
|
// spriteFilePrefix = value;
|
||||||
|
//}
|
||||||
|
//void textToWriteField(String value)
|
||||||
|
//{
|
||||||
|
// textForVectorSprite = value;
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//String getTextToWrite()
|
||||||
|
//{
|
||||||
|
// return textForVectorSprite;
|
||||||
|
//}
|
||||||
|
//String getSpriteFilePrefix()
|
||||||
|
//{
|
||||||
|
// return spriteFilePrefix;
|
||||||
|
//}
|
||||||
|
//String getSpriteFileSuffix()
|
||||||
|
//{
|
||||||
|
// return spriteFileSuffix;
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//void importTextButton()
|
||||||
|
//{
|
||||||
|
// // This loads the file contents into the variable called textForVectorSprite
|
||||||
|
// selectInput("Choose a text file to load from...", "importTextToWriteFromFile");
|
||||||
|
// Textfield tf = (Textfield) cp5.controller("textToWriteField");
|
||||||
|
// tf.setText(getTextToWrite());
|
||||||
|
// tf.submit();
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//void submitWritingWindow(int theValue)
|
||||||
|
//{
|
||||||
|
// println("Write.");
|
||||||
|
//
|
||||||
|
// Textfield tf = (Textfield) cp5.controller("spriteFilePrefixField");
|
||||||
|
// tf.submit();
|
||||||
|
// tf.setText(getSpriteFilePrefix());
|
||||||
|
// tf = (Textfield) cp5.controller("textToWriteField");
|
||||||
|
// tf.submit();
|
||||||
|
// tf.setText(getTextToWrite());
|
||||||
|
//
|
||||||
|
// println("Start dir: " + renderStartDirection);
|
||||||
|
// println("Sprite file prefix: " + spriteFilePrefix);
|
||||||
|
// println("Text: " + getTextToWrite());
|
||||||
|
//
|
||||||
|
// for (int i=0; i<getTextToWrite().length(); i++)
|
||||||
|
// {
|
||||||
|
// String filename = getSpriteFilePrefix() + (int) getTextToWrite().charAt(i) + getSpriteFileSuffix();
|
||||||
|
// addToCommandQueue(CMD_DRAW_SPRITE + int(gridSize * pixelScalingOverGridSize) + "," + filename+",END");
|
||||||
|
// println(filename);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//
|
||||||
|
///*------------------------------------------------------------------------
|
||||||
|
// Details about the "sprite" subwindow
|
||||||
|
//------------------------------------------------------------------------*/
|
||||||
|
//String spriteFilename;
|
||||||
|
//int minSpriteSize = 100;
|
||||||
|
//int maxSpriteSize = 500;
|
||||||
|
//
|
||||||
|
//void button_mode_drawSpriteDialog()
|
||||||
|
//{
|
||||||
|
// this.dialogWindow = cp5.addControlWindow("drawSpriteWindow",100,100,450,200);
|
||||||
|
// dialogWindow.hideCoordinates();
|
||||||
|
//
|
||||||
|
// dialogWindow.setBackground(getBackgroundColour());
|
||||||
|
//
|
||||||
|
// delay(200);
|
||||||
|
// Textfield spriteFilenameField = cp5.addTextfield("spriteFilenameField",20,20,400,20);
|
||||||
|
// spriteFilenameField.setText("filename.txt");
|
||||||
|
// spriteFilenameField.setLabel("Sprite filename");
|
||||||
|
// spriteFilenameField.setWindow(dialogWindow);
|
||||||
|
//
|
||||||
|
// Numberbox minSizeField = cp5.addNumberbox("minimumSpriteSize",20,60,100,20);
|
||||||
|
// minSizeField.setValue(getMinimumSpriteSize());
|
||||||
|
// minSizeField.setMin(10);
|
||||||
|
// minSizeField.setMax(getMaximumSpriteSize());
|
||||||
|
// minSizeField.setMultiplier(0.5);
|
||||||
|
// minSizeField.setLabel("Minimum size");
|
||||||
|
// minSizeField.setWindow(dialogWindow);
|
||||||
|
//
|
||||||
|
// Numberbox maxSizeField = cp5.addNumberbox("maximumSpriteSize",20,100,100,20);
|
||||||
|
// maxSizeField.setValue(getMaximumSpriteSize());
|
||||||
|
// maxSizeField.setMin(getMinimumSpriteSize());
|
||||||
|
// maxSizeField.setMultiplier(0.5);
|
||||||
|
// maxSizeField.setLabel("Maximum size");
|
||||||
|
// maxSizeField.setWindow(dialogWindow);
|
||||||
|
//
|
||||||
|
// Radio rPos = cp5.addRadio("radio_drawWritingDirection",20,140);
|
||||||
// rPos.add("North-east", DRAW_DIR_NE);
|
// rPos.add("North-east", DRAW_DIR_NE);
|
||||||
rPos.add("South-east", DRAW_DIR_SE);
|
// rPos.add("South-east", DRAW_DIR_SE);
|
||||||
// rPos.add("South-west", DRAW_DIR_SW);
|
// rPos.add("South-west", DRAW_DIR_SW);
|
||||||
// rPos.add("North-west", DRAW_DIR_NW);
|
// rPos.add("North-west", DRAW_DIR_NW);
|
||||||
rPos.setWindow(dialogWindow);
|
// rPos.setWindow(dialogWindow);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
Button submitButton = cp5.addButton("submitWritingWindow",0,300,100,120,20);
|
// Button submitButton = cp5.addButton("submitSpriteWindow",0,300,100,120,20);
|
||||||
submitButton.setLabel("Generate commands");
|
// submitButton.setLabel("Draw sprite");
|
||||||
submitButton.setWindow(dialogWindow);
|
// submitButton.setWindow(dialogWindow);
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
void spriteFilePrefixField(String value)
|
//void radio_drawWritingDirection(int dir)
|
||||||
{
|
//{
|
||||||
spriteFilePrefix = value;
|
// renderStartDirection = dir;
|
||||||
}
|
//}
|
||||||
void textToWriteField(String value)
|
//
|
||||||
{
|
//String getSpriteFilename()
|
||||||
textForVectorSprite = value;
|
//{
|
||||||
}
|
// return spriteFilename;
|
||||||
|
//}
|
||||||
String getTextToWrite()
|
//int getMinimumSpriteSize()
|
||||||
{
|
//{
|
||||||
return textForVectorSprite;
|
// return minSpriteSize;
|
||||||
}
|
//}
|
||||||
String getSpriteFilePrefix()
|
//int getMaximumSpriteSize()
|
||||||
{
|
//{
|
||||||
return spriteFilePrefix;
|
// return maxSpriteSize;
|
||||||
}
|
//}
|
||||||
String getSpriteFileSuffix()
|
//
|
||||||
{
|
//void submitSpriteWindow(int theValue)
|
||||||
return spriteFileSuffix;
|
//{
|
||||||
}
|
// println("Sprite.");
|
||||||
|
//
|
||||||
void importTextButton()
|
// Textfield tf = (Textfield) cp5.controller("spriteFilenameField");
|
||||||
{
|
// tf.submit();
|
||||||
// This loads the file contents into the variable called textForVectorSprite
|
// tf.setText(getSpriteFilename());
|
||||||
selectInput("Choose a text file to load from...", "importTextToWriteFromFile");
|
//
|
||||||
Textfield tf = (Textfield) cp5.controller("textToWriteField");
|
// println("Start dir: " + renderStartDirection);
|
||||||
tf.setText(getTextToWrite());
|
// println("Filename: " + spriteFilename);
|
||||||
tf.submit();
|
//
|
||||||
}
|
// addToCommandQueue(CMD_DRAW_SPRITE + "," + spriteFilename + ","
|
||||||
|
// + getMinimumSpriteSize() + "," + getMaximumSpriteSize() + "," + renderStartDirection + ",END");
|
||||||
|
//
|
||||||
void submitWritingWindow(int theValue)
|
//}
|
||||||
{
|
//
|
||||||
println("Write.");
|
//
|
||||||
|
///*------------------------------------------------------------------------
|
||||||
Textfield tf = (Textfield) cp5.controller("spriteFilePrefixField");
|
// Details about the "norwegian draw" subwindow
|
||||||
tf.submit();
|
//------------------------------------------------------------------------*/
|
||||||
tf.setText(getSpriteFilePrefix());
|
//String norwegianExecFilename = "filename.pbm";
|
||||||
tf = (Textfield) cp5.controller("textToWriteField");
|
//int norwegianAmplitude = 20;
|
||||||
tf.submit();
|
//int norwegianWavelength = 2;
|
||||||
tf.setText(getTextToWrite());
|
//
|
||||||
|
//void button_mode_drawNorwegianDialog()
|
||||||
println("Start dir: " + renderStartDirection);
|
//{
|
||||||
println("Sprite file prefix: " + spriteFilePrefix);
|
// this.dialogWindow = cp5.addControlWindow("chooseNorwegianFilenameWindow",100,100,450,150);
|
||||||
println("Text: " + getTextToWrite());
|
// dialogWindow.hideCoordinates();
|
||||||
|
//
|
||||||
for (int i=0; i<getTextToWrite().length(); i++)
|
// dialogWindow.setBackground(getBackgroundColour());
|
||||||
{
|
//
|
||||||
String filename = getSpriteFilePrefix() + (int) getTextToWrite().charAt(i) + getSpriteFileSuffix();
|
// Textfield filenameField = cp5.addTextfield("norwegianExecFilename",20,20,150,20);
|
||||||
addToCommandQueue(CMD_DRAW_SPRITE + int(gridSize * pixelScalingOverGridSize) + "," + filename+",END");
|
// filenameField.setText(norwegianExecFilename);
|
||||||
println(filename);
|
// filenameField.setLabel("Filename to execute from");
|
||||||
}
|
// filenameField.setWindow(dialogWindow);
|
||||||
|
//
|
||||||
}
|
// Numberbox minSizeField = cp5.addNumberbox("norwegianAmplitude",20,60,100,20);
|
||||||
|
// minSizeField.setValue(norwegianAmplitude);
|
||||||
|
// minSizeField.setMin(10);
|
||||||
/*------------------------------------------------------------------------
|
// minSizeField.setMultiplier(0.5);
|
||||||
Details about the "sprite" subwindow
|
// minSizeField.setLabel("Amplitude");
|
||||||
------------------------------------------------------------------------*/
|
// minSizeField.setWindow(dialogWindow);
|
||||||
String spriteFilename;
|
//
|
||||||
int minSpriteSize = 100;
|
// Numberbox maxSizeField = cp5.addNumberbox("norwegianWavelength",20,100,100,20);
|
||||||
int maxSpriteSize = 500;
|
// maxSizeField.setValue(norwegianWavelength);
|
||||||
|
// maxSizeField.setMin(1);
|
||||||
void button_mode_drawSpriteDialog()
|
// maxSizeField.setMultiplier(0.5);
|
||||||
{
|
// maxSizeField.setLabel("Wavelength");
|
||||||
this.dialogWindow = cp5.addControlWindow("drawSpriteWindow",100,100,450,200);
|
// maxSizeField.setWindow(dialogWindow);
|
||||||
dialogWindow.hideCoordinates();
|
//
|
||||||
|
// Button outlineButton = cp5.addButton("submitNorwegianExecTraceOutline",0,180,20,80,20);
|
||||||
dialogWindow.setBackground(getBackgroundColour());
|
// outlineButton.setLabel("Trace outline");
|
||||||
|
// outlineButton.setWindow(dialogWindow);
|
||||||
delay(200);
|
//
|
||||||
Textfield spriteFilenameField = cp5.addTextfield("spriteFilenameField",20,20,400,20);
|
// Button submitButton = cp5.addButton("submitNorwegianExecFilenameWindow",0,180,100,80,20);
|
||||||
spriteFilenameField.setText("filename.txt");
|
// submitButton.setLabel("Submit");
|
||||||
spriteFilenameField.setLabel("Sprite filename");
|
// submitButton.setWindow(dialogWindow);
|
||||||
spriteFilenameField.setWindow(dialogWindow);
|
//
|
||||||
|
// filenameField.setFocus(true);
|
||||||
Numberbox minSizeField = cp5.addNumberbox("minimumSpriteSize",20,60,100,20);
|
//
|
||||||
minSizeField.setValue(getMinimumSpriteSize());
|
//}
|
||||||
minSizeField.setMin(10);
|
//
|
||||||
minSizeField.setMax(getMaximumSpriteSize());
|
//void submitNorwegianExecTraceOutline(int theValue)
|
||||||
minSizeField.setMultiplier(0.5);
|
//{
|
||||||
minSizeField.setLabel("Minimum size");
|
// Textfield tf = (Textfield) cp5.controller("norwegianExecFilename");
|
||||||
minSizeField.setWindow(dialogWindow);
|
// tf.submit();
|
||||||
|
// tf.setText(norwegianExecFilename);
|
||||||
Numberbox maxSizeField = cp5.addNumberbox("maximumSpriteSize",20,100,100,20);
|
//
|
||||||
maxSizeField.setValue(getMaximumSpriteSize());
|
// println("Filename:" + norwegianExecFilename);
|
||||||
maxSizeField.setMin(getMinimumSpriteSize());
|
//
|
||||||
maxSizeField.setMultiplier(0.5);
|
// addToCommandQueue(CMD_DRAW_NORWEGIAN_OUTLINE + norwegianExecFilename + ",END");
|
||||||
maxSizeField.setLabel("Maximum size");
|
//}
|
||||||
maxSizeField.setWindow(dialogWindow);
|
//
|
||||||
|
//void submitNorwegianExecFilenameWindow(int theValue)
|
||||||
Radio rPos = cp5.addRadio("radio_drawWritingDirection",20,140);
|
//{
|
||||||
rPos.add("North-east", DRAW_DIR_NE);
|
// Textfield tf = (Textfield) cp5.controller("norwegianExecFilename");
|
||||||
rPos.add("South-east", DRAW_DIR_SE);
|
// tf.submit();
|
||||||
rPos.add("South-west", DRAW_DIR_SW);
|
// tf.setText(norwegianExecFilename);
|
||||||
rPos.add("North-west", DRAW_DIR_NW);
|
//
|
||||||
rPos.setWindow(dialogWindow);
|
// println("Filename:" + norwegianExecFilename);
|
||||||
|
// println("Amplitude:" + norwegianAmplitude);
|
||||||
|
// println("Wavelength:" + norwegianWavelength);
|
||||||
|
//
|
||||||
Button submitButton = cp5.addButton("submitSpriteWindow",0,300,100,120,20);
|
// addToCommandQueue(CMD_DRAW_NORWEGIAN + norwegianExecFilename + ","+norwegianAmplitude+","+norwegianWavelength+",END");
|
||||||
submitButton.setLabel("Draw sprite");
|
//}
|
||||||
submitButton.setWindow(dialogWindow);
|
//
|
||||||
}
|
//
|
||||||
|
|
||||||
void radio_drawWritingDirection(int dir)
|
|
||||||
{
|
|
||||||
renderStartDirection = dir;
|
|
||||||
}
|
|
||||||
|
|
||||||
String getSpriteFilename()
|
|
||||||
{
|
|
||||||
return spriteFilename;
|
|
||||||
}
|
|
||||||
int getMinimumSpriteSize()
|
|
||||||
{
|
|
||||||
return minSpriteSize;
|
|
||||||
}
|
|
||||||
int getMaximumSpriteSize()
|
|
||||||
{
|
|
||||||
return maxSpriteSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
void submitSpriteWindow(int theValue)
|
|
||||||
{
|
|
||||||
println("Sprite.");
|
|
||||||
|
|
||||||
Textfield tf = (Textfield) cp5.controller("spriteFilenameField");
|
|
||||||
tf.submit();
|
|
||||||
tf.setText(getSpriteFilename());
|
|
||||||
|
|
||||||
println("Start dir: " + renderStartDirection);
|
|
||||||
println("Filename: " + spriteFilename);
|
|
||||||
|
|
||||||
addToCommandQueue(CMD_DRAW_SPRITE + "," + spriteFilename + ","
|
|
||||||
+ getMinimumSpriteSize() + "," + getMaximumSpriteSize() + "," + renderStartDirection + ",END");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------
|
|
||||||
Details about the "norwegian draw" subwindow
|
|
||||||
------------------------------------------------------------------------*/
|
|
||||||
String norwegianExecFilename = "filename.pbm";
|
|
||||||
int norwegianAmplitude = 20;
|
|
||||||
int norwegianWavelength = 2;
|
|
||||||
|
|
||||||
void button_mode_drawNorwegianDialog()
|
|
||||||
{
|
|
||||||
this.dialogWindow = cp5.addControlWindow("chooseNorwegianFilenameWindow",100,100,450,150);
|
|
||||||
dialogWindow.hideCoordinates();
|
|
||||||
|
|
||||||
dialogWindow.setBackground(getBackgroundColour());
|
|
||||||
|
|
||||||
Textfield filenameField = cp5.addTextfield("norwegianExecFilename",20,20,150,20);
|
|
||||||
filenameField.setText(norwegianExecFilename);
|
|
||||||
filenameField.setLabel("Filename to execute from");
|
|
||||||
filenameField.setWindow(dialogWindow);
|
|
||||||
|
|
||||||
Numberbox minSizeField = cp5.addNumberbox("norwegianAmplitude",20,60,100,20);
|
|
||||||
minSizeField.setValue(norwegianAmplitude);
|
|
||||||
minSizeField.setMin(10);
|
|
||||||
minSizeField.setMultiplier(0.5);
|
|
||||||
minSizeField.setLabel("Amplitude");
|
|
||||||
minSizeField.setWindow(dialogWindow);
|
|
||||||
|
|
||||||
Numberbox maxSizeField = cp5.addNumberbox("norwegianWavelength",20,100,100,20);
|
|
||||||
maxSizeField.setValue(norwegianWavelength);
|
|
||||||
maxSizeField.setMin(1);
|
|
||||||
maxSizeField.setMultiplier(0.5);
|
|
||||||
maxSizeField.setLabel("Wavelength");
|
|
||||||
maxSizeField.setWindow(dialogWindow);
|
|
||||||
|
|
||||||
Button outlineButton = cp5.addButton("submitNorwegianExecTraceOutline",0,180,20,80,20);
|
|
||||||
outlineButton.setLabel("Trace outline");
|
|
||||||
outlineButton.setWindow(dialogWindow);
|
|
||||||
|
|
||||||
Button submitButton = cp5.addButton("submitNorwegianExecFilenameWindow",0,180,100,80,20);
|
|
||||||
submitButton.setLabel("Submit");
|
|
||||||
submitButton.setWindow(dialogWindow);
|
|
||||||
|
|
||||||
filenameField.setFocus(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void submitNorwegianExecTraceOutline(int theValue)
|
|
||||||
{
|
|
||||||
Textfield tf = (Textfield) cp5.controller("norwegianExecFilename");
|
|
||||||
tf.submit();
|
|
||||||
tf.setText(norwegianExecFilename);
|
|
||||||
|
|
||||||
println("Filename:" + norwegianExecFilename);
|
|
||||||
|
|
||||||
addToCommandQueue(CMD_DRAW_NORWEGIAN_OUTLINE + norwegianExecFilename + ",END");
|
|
||||||
}
|
|
||||||
|
|
||||||
void submitNorwegianExecFilenameWindow(int theValue)
|
|
||||||
{
|
|
||||||
Textfield tf = (Textfield) cp5.controller("norwegianExecFilename");
|
|
||||||
tf.submit();
|
|
||||||
tf.setText(norwegianExecFilename);
|
|
||||||
|
|
||||||
println("Filename:" + norwegianExecFilename);
|
|
||||||
println("Amplitude:" + norwegianAmplitude);
|
|
||||||
println("Wavelength:" + norwegianWavelength);
|
|
||||||
|
|
||||||
addToCommandQueue(CMD_DRAW_NORWEGIAN + norwegianExecFilename + ","+norwegianAmplitude+","+norwegianWavelength+",END");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user