Created
October 17, 2018 11:52
-
-
Save memish/28bd8b6ce09879b0fe1b0d756857b5ba to your computer and use it in GitHub Desktop.
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
BufferedReader reader; | |
String line; | |
void setup() { | |
// Open the file from the createWriter() example | |
reader = createReader("positions.txt"); | |
} | |
void draw() { | |
try { | |
line = reader.readLine(); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
line = null; | |
} | |
if (line == null) { | |
// Stop reading because of an error or file is empty | |
noLoop(); | |
} else { | |
String[] pieces = split(line, TAB); | |
int x = int(pieces[0]); | |
int y = int(pieces[1]); | |
point(x, y); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment