Skip to content

Commit f31275a

Browse files
committed
Edited the File IO examples to 640 × 360
Edited examples in the File IO category to be 640 × 360 like the others Fixes the .pde side of processing/processing-website#236
1 parent 125bf3c commit f31275a

File tree

5 files changed

+14
-13
lines changed

5 files changed

+14
-13
lines changed

Topics/File IO/LoadFile1/LoadFile1.pde

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ String[] lines;
99
int index = 0;
1010

1111
void setup() {
12-
size(200, 200);
12+
size(640, 360);
1313
background(0);
1414
stroke(255);
1515
frameRate(12);
@@ -20,8 +20,9 @@ void draw() {
2020
if (index < lines.length) {
2121
String[] pieces = split(lines[index], '\t');
2222
if (pieces.length == 2) {
23-
int x = int(pieces[0]) * 2;
24-
int y = int(pieces[1]) * 2;
23+
// Scale the coordinates to match the size of the sketch window
24+
float x = map(float(pieces[0]),0,100,0,width);
25+
float y = map(float(pieces[1]),0,100,0,height);
2526
point(x, y);
2627
}
2728
// Go to the next line for the next run through draw()

Topics/File IO/LoadFile2/LoadFile2.pde

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@ int num = 9; // Display this many entries on each screen.
1515
int startingEntry = 0; // Display from this entry number
1616

1717
void setup() {
18-
size(200, 200);
18+
size(640, 360);
1919
fill(255);
2020
noLoop();
21-
21+
2222
body = loadFont("TheSans-Plain-12.vlw");
2323
textFont(body);
24-
24+
textSize(20);
25+
2526
lines = loadStrings("cars2.tsv");
2627
records = new Record[lines.length];
2728
for (int i = 0; i < lines.length; i++) {
@@ -47,9 +48,9 @@ void draw() {
4748
}
4849

4950
void mousePressed() {
50-
startingEntry += num;
51+
startingEntry += num;
5152
if (startingEntry > records.length) {
5253
startingEntry = 0; // go back to the beginning
53-
}
54+
}
5455
redraw();
55-
}
56+
}

Topics/File IO/SaveFile1/SaveFile1.pde

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ int[] y = new int[0];
1212

1313
void setup()
1414
{
15-
size(200, 200);
15+
size(640, 360);
1616
}
1717

1818
void draw()
@@ -45,4 +45,3 @@ void keyPressed() { // Press a key to save the data
4545
saveStrings("lines.txt", lines);
4646
exit(); // Stop the program
4747
}
48-

Topics/File IO/SaveFile2/SaveFile2.pde

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ PrintWriter output;
1010

1111
void setup()
1212
{
13-
size(200, 200);
13+
size(640, 360);
1414
// Create a new file in the sketch directory
1515
output = createWriter("positions.txt");
1616
frameRate(12);

Topics/File IO/SaveOneImage/SaveOneImage.pde

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99

1010
void setup() {
11-
size(200, 200);
11+
size(640, 360);
1212
}
1313

1414
void draw() {

0 commit comments

Comments
 (0)