Commit 705d695d authored by Ivica Bukvic's avatar Ivica Bukvic
Browse files

*cleaned up Jonathan's data structures tutorials

parent 4c0d16fd
#N canvas 0 19 638 672 10;
#N canvas 0 19 476 614 10;
#X text 0 1 New Drawing Commands: draw;
#X text 0 1 __________________________;
#X obj 53 47 struct drawtut-one float x float y;
#X obj 53 219 draw rect 0 0 40 40;
#X obj 56 453;
#X text 53 67 The first argument "drawtut-one" is a name we will associated
with our shape.;
#X text 53 98 The other arguments define data to associate with this
......@@ -26,15 +25,16 @@ gave to the [struct] into an object box. This will create an object
\, referred to in Pd as a "scalar". It will have data for "x" and "y"
fields and will use the info in our [draw] object to draw itself on
the canvas.;
#X text 53 429 Type our [struct] name "drawtut-one" in the box below:
#X text 53 439 Type our [struct] name "drawtut-one" in the box below:
;
#X text 53 152 The field names "x" and "y" are special in Pd. Their
values will be associated with the base x/y coordinates of what we
draw to represent an object created from the [struct] above.;
#X text 53 23 Let's draw something! First \, we need a [struct]:;
#X text 53 499 That's it! To sum up: once you have a [struct] and some
#X text 53 509 That's it! To sum up: once you have a [struct] and some
[draw] objects \, you can create a scalar like the one above on any
canvas in the running Pd instance. For convenience we created everything
in the main patch \, but since there's only one [struct] per canvas
you typically will want to keep your [struct] and any [draw] objects
in their own subpatch.;
#X obj 53 463;
#N struct drawtut-rect float x float y;
#N canvas 0 19 638 678 10;
#N canvas 196 51 467 625 10;
#X text 0 1 __________________________;
#X text 0 1 New Drawing Commands: rect;
#X obj 53 87 struct drawtut-rect float x float y;
......
#N struct drawtut-attr float x float y;
#N canvas 0 19 638 678 10;
#N canvas 0 19 470 676 10;
#X text 0 1 New Drawing Commands: attributes;
#X text 0 1 ________________________________;
#X text 53 23 Our shapes are pretty boring so far. Black lines around
......
#N struct drawtut-attr-cont float x float y;
#N canvas 0 19 638 678 10;
#N canvas 0 19 601 660 10;
#X obj 53 553 draw rect 0 0 50 50;
#X msg 53 92 fill red;
#X text 0 1 New Drawing Commands: attributes (continued);
......
#N struct drawtut-attr-saving float x float y;
#N canvas 0 19 638 678 10;
#N canvas 0 19 606 514 10;
#X obj 53 153 draw rect 0 0 50 50;
#X text 0 1 New Drawing Commands: attributes (continued);
#X text 0 1 ____________________________________________;
......
#N struct drawtut-line float x float y;
#N canvas 0 19 638 634 10;
#N canvas 0 19 453 618 10;
#X obj 53 84 loadbang;
#X text 0 1 New Drawing Commands: line;
#X text 0 1 __________________________;
......
#N struct drawtut-circle float x float y;
#N canvas -9 19 638 554 10;
#N canvas 0 19 439 554 10;
#X msg 53 117 stroke blue;
#X text 52 484 Lines are only a single stroke. They don't have any
inner area to fill \, so none of the messages like "fill" or "fill-rule"
......
#N struct drawtut-ellipse float x float y;
#N canvas 0 19 638 498 10;
#N canvas 0 19 445 477 10;
#X msg 53 117 stroke blue;
#X msg 142 117 fill yellow;
#X msg 228 117 stroke-width \$1;
#X floatatom 228 93 5 0 0 0 - - -, f 5;
#X obj 53 153 draw ellipse 0 0 86 42;
#X text 259 246 <- an ellipse;
#X text 0 1 New Drawing Commands: ellipse;
#X text 0 1 _____________________________;
#X text 5 1 New Drawing Commands: ellipse;
#X text 5 1 _____________________________;
#X text 53 23 An ellipse.;
#X obj 53 57 struct drawtut-ellipse float x float y;
#X scalar drawtut-ellipse 155 253 \;;
......
#N struct drawtut-polygon float x float y;
#N canvas -9 19 867 610 10;
#N canvas 106 54 849 580 10;
#X msg 53 117 stroke blue;
#X msg 142 117 fill yellow;
#X msg 228 117 stroke-width \$1;
#X floatatom 228 93 5 0 0 0 - - -, f 5;
#X obj 53 57 struct drawtut-polygon float x float y;
#X scalar drawtut-polygon -138 117 \;;
#X text 0 1 New Drawing Commands: polygon;
#X text 0 1 _____________________________;
#X text 4 1 New Drawing Commands: polygon;
#X text 4 1 _____________________________;
#X text 53 23 Polygons are closed shapes.;
#X obj 53 153 draw polygon 350 75 379 161 469 161 397 215 423 301 350
250 277 301 303 215 231 161 321 161;
......
#N struct drawtut-path float x float y;
#N canvas 0 19 867 610 10;
#N canvas 0 19 859 563 10;
#X text 0 1 New Drawing Commands: path;
#X text 1 1 __________________________;
#X text 53 23 Paths are complex drawings.;
......
#N struct drawtut-transform float x float y;
#N canvas -9 19 867 589 10;
#N canvas 0 19 836 610 10;
#X text 0 1 New Drawing Commands: transform;
#X text 1 1 _______________________________;
#X text 53 23 All [draw] objects understand the "transform" message.
......
#N struct drawtut-group float x float y;
#N canvas 0 19 648 502 10;
#N canvas 0 19 657 493 10;
#X scalar drawtut-group 54 209 \;;
#X symbolatom 53 173 10 0 0 1 event_type - -, f 10;
#X obj 53 148 list split 1;
......
#N struct drawtut-events float x float y;
#N canvas 0 19 591 589 10;
#N canvas 0 19 525 484 10;
#X scalar drawtut-events 54 210 \;;
#X text 1 1 __________________________________;
#X text 0 1 New Drawing Commands: mouse events;
......
#N struct drawtut-animation float x float y;
#N canvas -9 19 537 571 10;
#N canvas 0 19 514 563 10;
#X scalar drawtut-animation 47 306 \;;
#X obj 47 271 draw rect 0 0 40 40;
#X obj 47 135 struct drawtut-animation float x float y;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment