1 <?xml version=
"1.0" encoding=
"UTF-8" standalone=
"no"?>
2 <!-- Created with Inkscape (http://www.inkscape.org/) -->
4 xmlns:
dc=
"http://purl.org/dc/elements/1.1/"
5 xmlns:
cc=
"http://web.resource.org/cc/"
6 xmlns:
rdf=
"http://www.w3.org/1999/02/22-rdf-syntax-ns#"
7 xmlns:
svg=
"http://www.w3.org/2000/svg"
8 xmlns=
"http://www.w3.org/2000/svg"
9 xmlns:
sodipodi=
"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
10 xmlns:
inkscape=
"http://www.inkscape.org/namespaces/inkscape"
14 sodipodi:
version=
"0.32"
15 inkscape:
version=
"0.45.1"
16 sodipodi:
docbase=
"/home/andre/projects/xdock/www"
17 sodipodi:
docname=
"tutorial2.svg"
18 inkscape:
output_extension=
"org.inkscape.output.svg.inkscape"
19 inkscape:
export-filename=
"/home/andre/projects/xdock/www/tutorial2.png"
20 inkscape:
export-xdpi=
"155.75999"
21 inkscape:
export-ydpi=
"155.75999">
25 inkscape:
stockid=
"Arrow2Lend"
30 style=
"overflow:visible;">
33 style=
"font-size:12.0;fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
34 d=
"M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
35 transform=
"scale(1.1) rotate(180) translate(1,0)" />
38 inkscape:
stockid=
"Arrow2Mend"
43 style=
"overflow:visible;">
46 style=
"font-size:12.0;fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
47 d=
"M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
48 transform=
"scale(0.6) rotate(180) translate(0,0)" />
56 inkscape:
pageopacity=
"0.0"
57 inkscape:
pageshadow=
"2"
59 inkscape:
cx=
"370.85253"
60 inkscape:
cy=
"736.49022"
61 inkscape:
document-units=
"px"
62 inkscape:
current-layer=
"layer1"
63 inkscape:
window-width=
"1280"
64 inkscape:
window-height=
"725"
66 inkscape:
window-y=
"25" />
72 <dc:format>image/svg+xml
</dc:format>
74 rdf:
resource=
"http://purl.org/dc/dcmitype/StillImage" />
79 inkscape:
label=
"Camada 1"
80 inkscape:
groupmode=
"layer"
84 style=
"font-size:13px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Inconsolata"
92 style=
"fill:#800080">#include
<xdock.h
></tspan><tspan
97 style=
"fill:#800080">#include
<stdlib.h
></tspan><tspan
102 style=
"fill:#800080">#include
<unistd.h
></tspan><tspan
106 id=
"tspan2168" /><tspan
110 id=
"tspan2170"><tspan
112 id=
"tspan2297">int
</tspan> main()
</tspan><tspan
116 id=
"tspan2172">{
</tspan><tspan
120 id=
"tspan2174"><tspan
122 id=
"tspan2299"> int
</tspan> r;
</tspan><tspan
126 id=
"tspan2176"><tspan
128 id=
"tspan2303"> xd_connect
</tspan>();
</tspan><tspan
132 id=
"tspan2178"><tspan
134 id=
"tspan2305"> xd_led_draw_panel
</tspan>(
<tspan
136 id=
"tspan2315">5</tspan>,
<tspan
138 id=
"tspan2317">5</tspan>,
<tspan
140 id=
"tspan2319">58</tspan>,
<tspan
142 id=
"tspan2321">58</tspan>);
</tspan><tspan
146 id=
"tspan2180"><tspan
148 id=
"tspan2301"> while
</tspan>(
<tspan
150 id=
"tspan2323">1</tspan>)
</tspan><tspan
154 id=
"tspan2182"> {
</tspan><tspan
158 id=
"tspan2184"> r =
<tspan
160 id=
"tspan2325">1</tspan> + (
<tspan
162 id=
"tspan2327">int
</tspan>)(
<tspan
164 id=
"tspan2329">55.0</tspan> * (rand() / (RAND_MAX +
<tspan
166 id=
"tspan2331">1.0</tspan>)));
</tspan><tspan
170 id=
"tspan2186"><tspan
172 id=
"tspan2307"> xd_move_box
</tspan>(
<tspan
174 id=
"tspan2333">6</tspan>,
<tspan
176 id=
"tspan2335">6</tspan>,
<tspan
178 id=
"tspan2337">57</tspan>,
<tspan
180 id=
"tspan2339">57</tspan>,
<tspan
182 id=
"tspan2341">XD_LEFT
</tspan>,
<tspan
184 id=
"tspan2343">1</tspan>,
<tspan
186 id=
"tspan2345">XD_LED_BG
</tspan>);
</tspan><tspan
190 id=
"tspan2188"><tspan
192 id=
"tspan2309"> xd_draw_line
</tspan>(
<tspan
194 id=
"tspan2347">XD_LED_LIT_1
</tspan>,
<tspan
196 id=
"tspan2349">57</tspan>,
<tspan
198 id=
"tspan2351">57</tspan>,
<tspan
200 id=
"tspan2353">57</tspan>, r+
<tspan
202 id=
"tspan2355">4</tspan>);
</tspan><tspan
206 id=
"tspan2190"><tspan
208 id=
"tspan2311"> xd_draw_point
</tspan>(
<tspan
210 id=
"tspan2357">XD_LED_GLOW
</tspan>,
<tspan
212 id=
"tspan2359">57</tspan>,
<tspan
214 id=
"tspan2361">30</tspan>);
</tspan><tspan
218 id=
"tspan2192"><tspan
220 id=
"tspan2313"> xd_flush
</tspan>();
</tspan><tspan
224 id=
"tspan2194"> usleep(
<tspan
226 id=
"tspan2363">700000</tspan>);
</tspan><tspan
230 id=
"tspan2196"> }
</tspan><tspan
234 id=
"tspan2198">}
</tspan></text>
236 style=
"opacity:1;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;marker-mid:none;marker-end:url(#Arrow2Mend);stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
237 d=
"M 135.7148,168.42384 L 166.09117,168.53151"
239 inkscape:
connector-type=
"polyline"
240 sodipodi:
nodetypes=
"cc" />
243 style=
"font-size:9px;font-style:italic;font-weight:normal;fill:#008000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sans"
250 y=
"171.6479">our header
</tspan></text>
253 style=
"font-size:9px;font-style:italic;font-weight:normal;fill:#008000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sans"
260 y=
"186.6479">needed for RAND_MAX
</tspan></text>
263 style=
"font-size:9px;font-style:italic;font-weight:normal;fill:#008000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sans"
270 y=
"201.6479">needed for 'usleep'
</tspan></text>
273 style=
"font-size:9px;font-style:italic;font-weight:normal;fill:#008000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sans"
280 y=
"423.79074">update the screen
</tspan></text>
283 style=
"font-size:9px;font-style:italic;font-weight:normal;fill:#008000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sans"
290 y=
"452.36218">sleep for
0.7 seconds
</tspan></text>
292 style=
"opacity:1;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;marker-mid:none;marker-end:url(#Arrow2Mend);stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
293 d=
"M 137.76494,185.15388 L 168.14131,185.26155"
295 inkscape:
connector-type=
"polyline"
296 sodipodi:
nodetypes=
"cc" />
298 style=
"opacity:1;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;marker-mid:none;marker-end:url(#Arrow2Mend);stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
299 d=
"M 139.19352,201.58246 L 169.56989,201.69013"
301 inkscape:
connector-type=
"polyline"
302 sodipodi:
nodetypes=
"cc" />
304 style=
"opacity:1;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;marker-mid:none;marker-end:url(#Arrow2Mend);stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
305 d=
"M 121.33637,278.72532 L 315.99846,210.26155"
307 inkscape:
connector-type=
"polyline"
308 sodipodi:
nodetypes=
"cc" />
310 style=
"opacity:1;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;marker-mid:none;marker-end:url(#Arrow2Mend);stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
311 d=
"M 208.41363,287.99349 L 304.50429,258.10115"
313 inkscape:
connector-type=
"polyline"
314 sodipodi:
nodetypes=
"cc" />
316 style=
"opacity:1;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;marker-mid:none;marker-end:url(#Arrow2Mend);stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
317 d=
"M 142.81193,336.07262 L 208.90259,325.466"
319 inkscape:
connector-type=
"polyline"
320 sodipodi:
nodetypes=
"cc" />
323 style=
"font-size:9px;font-style:italic;font-weight:normal;fill:#008000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sans"
330 y=
"322.36218">get a random number
</tspan><tspan
334 id=
"tspan2499">for drawing the line
</tspan></text>
336 style=
"opacity:1;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;marker-mid:none;marker-end:url(#Arrow2Mend);stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
337 d=
"M 346.35009,387.74676 L 385.29788,411.42586"
339 inkscape:
connector-type=
"polyline"
340 sodipodi:
nodetypes=
"cc" />
342 style=
"opacity:1;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;marker-mid:none;marker-end:url(#Arrow2Mend);stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
343 d=
"M 293.88157,399.6656 L 383.54364,414.77327"
345 inkscape:
connector-type=
"polyline"
346 sodipodi:
nodetypes=
"cc" />
348 style=
"opacity:1;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;marker-mid:none;marker-end:url(#Arrow2Mend);stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
349 d=
"M 133.49294,413.46105 L 168.15503,420.71157"
351 inkscape:
connector-type=
"polyline"
352 sodipodi:
nodetypes=
"cc" />
354 style=
"opacity:1;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;marker-mid:none;marker-end:url(#Arrow2Mend);stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
355 d=
"M 77.784528,437.43831 L 92.44661,448.97454"
357 inkscape:
connector-type=
"polyline"
358 sodipodi:
nodetypes=
"cc" />
360 style=
"opacity:1;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;marker-mid:none;marker-end:url(#Arrow2Mend);stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
361 d=
"M 382.77866,364.88962 L 427.44075,352.14014"
363 inkscape:
connector-type=
"polyline"
364 sodipodi:
nodetypes=
"cc" />
367 style=
"font-size:9px;font-style:italic;font-weight:normal;fill:#008000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sans"
374 y=
"279.50504">this function moves
</tspan><tspan
378 id=
"tspan2517">the whole area
</tspan><tspan
382 id=
"tspan2519">one pixel to the left
</tspan></text>
384 style=
"opacity:1;fill:#ff0000;fill-rule:evenodd;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;marker-mid:none;marker-end:url(#Arrow2Mend);stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1;stroke:#ff0000;stroke-dashoffset:0;marker-start:none"
385 d=
"M 512.09082,313.31613 L 458.89577,313.4238"
387 inkscape:
connector-type=
"polyline"
388 sodipodi:
nodetypes=
"cc" />
391 style=
"font-size:9px;font-style:italic;font-weight:normal;fill:#008000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sans"
398 y=
"410.93362">here we draw
</tspan><tspan
402 id=
"tspan3580">only one line at the left
</tspan></text>