mirror of
https://github.com/processing/processing4.git
synced 2026-01-30 11:51:54 +01:00
Re-adding Topics to SVN
This commit is contained in:
30
java/examples/Topics/File IO/LoadFile1/LoadFile1.pde
Normal file
30
java/examples/Topics/File IO/LoadFile1/LoadFile1.pde
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* LoadFile 1
|
||||
*
|
||||
* Loads a text file that contains two numbers separated by a tab ('\t').
|
||||
* A new pair of numbers is loaded each frame and used to draw a point on the screen.
|
||||
*/
|
||||
|
||||
String[] lines;
|
||||
int index = 0;
|
||||
|
||||
void setup() {
|
||||
size(200, 200);
|
||||
background(0);
|
||||
stroke(255);
|
||||
frameRate(12);
|
||||
lines = loadStrings("positions.txt");
|
||||
}
|
||||
|
||||
void draw() {
|
||||
if (index < lines.length) {
|
||||
String[] pieces = split(lines[index], '\t');
|
||||
if (pieces.length == 2) {
|
||||
int x = int(pieces[0]) * 2;
|
||||
int y = int(pieces[1]) * 2;
|
||||
point(x, y);
|
||||
}
|
||||
// Go to the next line for the next run through draw()
|
||||
index = index + 1;
|
||||
}
|
||||
}
|
||||
206
java/examples/Topics/File IO/LoadFile1/data/positions.txt
Normal file
206
java/examples/Topics/File IO/LoadFile1/data/positions.txt
Normal file
@@ -0,0 +1,206 @@
|
||||
70 35
|
||||
69 35
|
||||
68 39
|
||||
67 42
|
||||
66 47
|
||||
64 51
|
||||
64 54
|
||||
63 57
|
||||
60 60
|
||||
58 64
|
||||
51 69
|
||||
48 72
|
||||
44 73
|
||||
39 75
|
||||
35 75
|
||||
30 75
|
||||
25 75
|
||||
21 75
|
||||
17 73
|
||||
13 69
|
||||
12 66
|
||||
11 61
|
||||
11 57
|
||||
10 49
|
||||
10 45
|
||||
10 38
|
||||
12 32
|
||||
13 29
|
||||
16 23
|
||||
20 19
|
||||
24 16
|
||||
27 15
|
||||
31 13
|
||||
33 13
|
||||
37 13
|
||||
40 15
|
||||
42 16
|
||||
45 19
|
||||
46 21
|
||||
47 24
|
||||
48 26
|
||||
48 29
|
||||
48 33
|
||||
47 39
|
||||
43 45
|
||||
42 47
|
||||
38 50
|
||||
35 51
|
||||
32 51
|
||||
30 51
|
||||
27 50
|
||||
27 50
|
||||
26 46
|
||||
26 41
|
||||
29 36
|
||||
30 34
|
||||
31 33
|
||||
31 33
|
||||
32 33
|
||||
33 33
|
||||
34 33
|
||||
34 33
|
||||
35 33
|
||||
37 33
|
||||
39 33
|
||||
42 32
|
||||
44 31
|
||||
46 29
|
||||
48 29
|
||||
49 27
|
||||
52 24
|
||||
53 23
|
||||
57 19
|
||||
61 16
|
||||
63 14
|
||||
67 13
|
||||
69 12
|
||||
69 12
|
||||
77 11
|
||||
77 11
|
||||
80 11
|
||||
86 16
|
||||
90 21
|
||||
93 25
|
||||
95 29
|
||||
95 32
|
||||
95 33
|
||||
95 37
|
||||
94 41
|
||||
93 44
|
||||
92 46
|
||||
91 49
|
||||
89 51
|
||||
87 55
|
||||
85 59
|
||||
82 62
|
||||
80 64
|
||||
79 67
|
||||
77 69
|
||||
74 71
|
||||
68 72
|
||||
65 73
|
||||
63 73
|
||||
62 73
|
||||
60 72
|
||||
58 69
|
||||
57 67
|
||||
57 66
|
||||
56 60
|
||||
56 56
|
||||
56 54
|
||||
58 49
|
||||
60 47
|
||||
62 47
|
||||
63 47
|
||||
67 48
|
||||
70 52
|
||||
73 55
|
||||
74 57
|
||||
74 58
|
||||
74 60
|
||||
74 62
|
||||
73 65
|
||||
70 68
|
||||
67 69
|
||||
65 70
|
||||
63 70
|
||||
62 70
|
||||
60 68
|
||||
57 65
|
||||
55 64
|
||||
50 62
|
||||
46 61
|
||||
40 60
|
||||
38 60
|
||||
36 60
|
||||
32 61
|
||||
30 62
|
||||
27 64
|
||||
26 68
|
||||
25 71
|
||||
25 77
|
||||
25 81
|
||||
26 84
|
||||
28 86
|
||||
31 87
|
||||
33 88
|
||||
36 88
|
||||
39 86
|
||||
41 85
|
||||
43 83
|
||||
44 81
|
||||
45 76
|
||||
45 74
|
||||
45 71
|
||||
40 67
|
||||
37 65
|
||||
34 63
|
||||
33 61
|
||||
33 61
|
||||
32 60
|
||||
33 49
|
||||
37 45
|
||||
41 41
|
||||
45 39
|
||||
47 38
|
||||
51 37
|
||||
54 37
|
||||
58 38
|
||||
61 41
|
||||
63 44
|
||||
65 46
|
||||
66 49
|
||||
66 51
|
||||
67 55
|
||||
67 58
|
||||
67 60
|
||||
66 62
|
||||
64 65
|
||||
63 66
|
||||
61 67
|
||||
60 68
|
||||
58 68
|
||||
55 69
|
||||
54 69
|
||||
51 69
|
||||
48 69
|
||||
46 68
|
||||
45 66
|
||||
44 65
|
||||
44 63
|
||||
44 61
|
||||
44 59
|
||||
44 56
|
||||
44 55
|
||||
45 53
|
||||
47 52
|
||||
49 50
|
||||
50 48
|
||||
51 47
|
||||
52 46
|
||||
54 46
|
||||
55 45
|
||||
55 45
|
||||
56 44
|
||||
57 44
|
||||
Reference in New Issue
Block a user