Last active
December 31, 2015 04:29
-
-
Save monkstone/7934196 to your computer and use it in GitHub Desktop.
.k9rc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# YAML configuration file for ruby-processing | |
# K9_HOME: "$HOME/ruby193 ... /ruby-processing" #windows users may need to set this | |
PROCESSING_ROOT: "/home/zen/processing/build/linux/work" | |
#PROCESSING_ROOT: "C:\Java\processing\build\windows\work" # if you follow PhiLhos suggestion for windoes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String processingRoot = "enter your processing root here"; // edit this line in the sketch | |
String done = "Done"; | |
String home, suggestion, separator, root, os; | |
PFont font; | |
StringBuilder header = new StringBuilder(200); | |
void setup() { | |
size(500, 200); | |
home = System.getProperty("user.home"); | |
os = System.getProperty("os.name").toLowerCase(); | |
if (os.indexOf("win") >= 0){ | |
os = "windows"; | |
} | |
File f = new File(home); | |
root = f.getParent(); | |
separator = System.getProperty("file.separator"); | |
header.append("# YAML configuration file for ruby-processing\n"); | |
header.append("# K9_HOME: \"").append(root).append(separator).append("ruby193 ... ").append(separator); | |
header.append("ruby-processing\" #windows users may need to set this\n"); | |
font = createFont("Helvetica", 18); | |
suggestion = home + separator + "processing" + separator + "build" + separator + os + separator + "work"; | |
} | |
void draw() { | |
background(200); | |
fill(0, 0, 200); | |
text("Suggestion:", 35, 28); | |
text(suggestion, 35, 56); | |
textFont(font, 18); | |
fill(255, 0, 0); | |
// this adds a blinking cursor after your text, at the expense of redrawing everything every frame | |
text(processingRoot+(frameCount/10 % 2 == 0 ? "_" : ""), 35, 100); | |
} | |
void keyReleased() { | |
if (key != CODED) { | |
switch(key) { | |
case BACKSPACE: | |
processingRoot = processingRoot.substring(0, max(0, processingRoot.length()-1)); | |
break; | |
case ENTER: // save the processing root to the config file | |
case RETURN: | |
header.append("PROCESSING_ROOT: \"").append(processingRoot).append("\"\n"); | |
PrintWriter pw = createWriter(home + separator + ".k9rc"); | |
pw.append(header); | |
pw.close(); | |
processingRoot = done; | |
break; | |
case ESC: | |
case DELETE: | |
break; | |
default: | |
processingRoot += key; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment