templeos-info/public/Wb/Demo/Graphics/Lines.HC.HTML

58 lines
3.8 KiB
HTML
Executable File

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="generator" content="TempleOS V5.03">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/style/templeos.css">
<script src="/script/templeos.js"></script>
<style type="text/css">
.cF0{color:#000000;background-color:#ffffff;}
.cF1{color:#0000aa;background-color:#ffffff;}
.cF2{color:#00aa00;background-color:#ffffff;}
.cF3{color:#00aaaa;background-color:#ffffff;}
.cF4{color:#aa0000;background-color:#ffffff;}
.cF5{color:#aa00aa;background-color:#ffffff;}
.cF6{color:#aa5500;background-color:#ffffff;}
.cF7{color:#aaaaaa;background-color:#ffffff;}
.cF8{color:#555555;background-color:#ffffff;}
.cF9{color:#5555ff;background-color:#ffffff;}
.cFA{color:#55ff55;background-color:#ffffff;}
.cFB{color:#55ffff;background-color:#ffffff;}
.cFC{color:#ff5555;background-color:#ffffff;}
.cFD{color:#ff55ff;background-color:#ffffff;}
.cFE{color:#ffff55;background-color:#ffffff;}
.cFF{color:#ffffff;background-color:#ffffff;}
</style>
</head>
<body>
<pre id="content">
<a name="l1"></a><span class=cF1>U0</span><span class=cF0> Main()
<a name="l2"></a>{
<a name="l3"></a> </span><span class=cF9>I64</span><span class=cF0> x1=0,y1=0,x2=0,y2=0,i=1,c=0;
<a name="l4"></a> </span><span class=cF9>I64</span><span class=cF0> vx1=0,vy1=0,vx2=0,vy2=0;
<a name="l5"></a> </span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cF5>DCAlias</span><span class=cF0>;
<a name="l6"></a> </span><span class=cF1>while</span><span class=cF0> (!</span><span class=cF5>ScanChar</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l7"></a> </span><span class=cF1>if</span><span class=cF0> (!--i) {
<a name="l8"></a> i=1000;
<a name="l9"></a> dc-&gt;color=c++&amp;15;
<a name="l10"></a> }
<a name="l11"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,x1,y1,x2,y2);
<a name="l12"></a> vx1=</span><span class=cF5>ClampI64</span><span class=cF0>(vx1+</span><span class=cF5>SignI64</span><span class=cF7>(</span><span class=cF5>RandI16</span><span class=cF7>)</span><span class=cF0>,-5,5);
<a name="l13"></a> vy1=</span><span class=cF5>ClampI64</span><span class=cF0>(vy1+</span><span class=cF5>SignI64</span><span class=cF7>(</span><span class=cF5>RandI16</span><span class=cF7>)</span><span class=cF0>,-5,5);
<a name="l14"></a> vx2=</span><span class=cF5>ClampI64</span><span class=cF0>(vx2+</span><span class=cF5>SignI64</span><span class=cF7>(</span><span class=cF5>RandI16</span><span class=cF7>)</span><span class=cF0>,-5,5);
<a name="l15"></a> vy2=</span><span class=cF5>ClampI64</span><span class=cF0>(vy2+</span><span class=cF5>SignI64</span><span class=cF7>(</span><span class=cF5>RandI16</span><span class=cF7>)</span><span class=cF0>,-5,5);
<a name="l16"></a> x1=</span><span class=cF5>ClampI64</span><span class=cF0>(x1+vx1,0,</span><span class=cF5>Fs</span><span class=cF0>-&gt;pix_width-1);
<a name="l17"></a> y1=</span><span class=cF5>ClampI64</span><span class=cF0>(y1+vy1,0,</span><span class=cF5>Fs</span><span class=cF0>-&gt;pix_height-1);
<a name="l18"></a> x2=</span><span class=cF5>ClampI64</span><span class=cF0>(x2+vx2,0,</span><span class=cF5>Fs</span><span class=cF0>-&gt;pix_width-1);
<a name="l19"></a> y2=</span><span class=cF5>ClampI64</span><span class=cF0>(y2+vy2,0,</span><span class=cF5>Fs</span><span class=cF0>-&gt;pix_height-1);
<a name="l20"></a> </span><span class=cF5>Sleep</span><span class=cF0>(1); </span><span class=cF2>//Replace this with Yield() ort Sleep(0) and see what happens!</span><span class=cF0>
<a name="l21"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l22"></a> </span><span class=cF5>DCFill</span><span class=cF0>(dc);
<a name="l23"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc);
<a name="l24"></a>}
<a name="l25"></a>
<a name="l26"></a>Main;
</span></pre></body>
</html>