Skip to content

Instantly share code, notes, and snippets.

@MartinBspheroid
Created April 13, 2016 12:20
Show Gist options
  • Save MartinBspheroid/a1b155196ce69377b6720fb60bfae7c3 to your computer and use it in GitHub Desktop.
Save MartinBspheroid/a1b155196ce69377b6720fb60bfae7c3 to your computer and use it in GitHub Desktop.
import java.io.File;
long lastTime = 0;
File f;
String[] data;
void setup() {
f = new File("e:/test.txt");
}
void draw() {
background(0);
check();
for (int i = 0; i < data.length; i++) {
text(data[i], 10, 20 +(i*20));
}
}
void check() {
long millisec = f.lastModified();
if (millisec > lastTime) {
reload();
lastTime = millisec;
}
}
void reload() {
data = loadStrings(f.getAbsolutePath());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment