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

75 lines
6.2 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=cF2>/*</span><a href="/Wb/Adam/Gr/GrGlbls.HC.HTML#l3"><span class=cF4>gr.dc</span></a><span class=cF2> is the persistent layer. You can access</span><span class=cF0>
<a name="l2"></a></span><span class=cF2>it directly but two tasks accessing it simultaneously</span><span class=cF0>
<a name="l3"></a></span><span class=cF2>with no </span><a href="/Wb/Adam/Gr/GrDC.HC.HTML#l168"><span class=cF4>DCAlias</span></a><span class=cF2>() will screw-up color and stuff.</span><span class=cF0>
<a name="l4"></a></span><span class=cF2>*/</span><span class=cF0>
<a name="l5"></a>
<a name="l6"></a></span><span class=cF1>U0</span><span class=cF0> SunMoon()
<a name="l7"></a>{
<a name="l8"></a> </span><span class=cF9>I64</span><span class=cF0> i,x,y,radius;
<a name="l9"></a>
<a name="l10"></a> </span><span class=cF5>AutoComplete</span><span class=cF0>; </span><span class=cF2>//AutoComplete Off</span><span class=cF0>
<a name="l11"></a> </span><span class=cF5>WinBorder</span><span class=cF0>; </span><span class=cF2>//No Border</span><span class=cF0>
<a name="l12"></a> </span><span class=cF5>WinMax</span><span class=cF0>; </span><span class=cF2>//Maximize window</span><span class=cF0>
<a name="l13"></a> </span><span class=cF5>DocClear</span><span class=cF0>; </span><span class=cF2>//Clear command-line text</span><span class=cF0>
<a name="l14"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;text_attr=</span><span class=cF3>BLACK</span><span class=cF0>&lt;&lt;4+</span><span class=cF3>WHITE</span><span class=cF0>; </span><span class=cF2>//Current </span><a href="/Wb/Kernel/KernelA.HH.HTML#l3271"><span class=cF4>CTask</span></a><span class=cF2> is Fs segment register.</span><span class=cF0>
<a name="l15"></a>
<a name="l16"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;0x8000;i+=0x200) </span><span class=cF7>{</span><span class=cF0>
<a name="l17"></a></span><span class=cF2>//Sun</span><span class=cF0>
<a name="l18"></a> x=0.2*</span><span class=cF3>GR_WIDTH</span><span class=cF0>; y=0.5*</span><span class=cF3>GR_HEIGHT</span><span class=cF0>; radius=120;
<a name="l19"></a> </span><span class=cFB>gr</span><span class=cF0>.dc-&gt;color=</span><span class=cF3>DKGRAY</span><span class=cF0>;
<a name="l20"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(</span><span class=cFB>gr</span><span class=cF0>.dc,x,y,radius);
<a name="l21"></a> </span><span class=cFB>gr</span><span class=cF0>.dc-&gt;color=</span><span class=cF3>ROPF_DITHER</span><span class=cF0>+</span><span class=cF3>RED</span><span class=cF0>&lt;&lt;16+</span><span class=cF3>YELLOW</span><span class=cF0>;
<a name="l22"></a> </span><span class=cF5>GrFloodFill</span><span class=cF0>(</span><span class=cFB>gr</span><span class=cF0>.dc,x,y);
<a name="l23"></a>
<a name="l24"></a> </span><span class=cF2>//Moon</span><span class=cF0>
<a name="l25"></a> x=0.8*</span><span class=cF3>GR_WIDTH</span><span class=cF0>-i/0x200; y=0.5*</span><span class=cF3>GR_HEIGHT</span><span class=cF0>; radius=75;
<a name="l26"></a> </span><span class=cFB>gr</span><span class=cF0>.dc-&gt;color=</span><span class=cF3>DKGRAY</span><span class=cF0>;
<a name="l27"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(</span><span class=cFB>gr</span><span class=cF0>.dc,x,y,radius);
<a name="l28"></a></span><span class=cF2>//&lt;CTRL-ALT-a&gt; for the &quot;pi&quot; character.</span><span class=cF0>
<a name="l29"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(</span><span class=cFB>gr</span><span class=cF0>.dc,x+0.5*radius,y,1.2*radius,,</span><span class=cF3>pi</span><span class=cF0>-.31*</span><span class=cF3>pi</span><span class=cF0>,0.62*</span><span class=cF3>pi</span><span class=cF0>);
<a name="l30"></a> </span><span class=cFB>gr</span><span class=cF0>.dc-&gt;color=</span><span class=cF3>ROPF_PROBABILITY_DITHER</span><span class=cF0>+</span><span class=cF3>LTGRAY</span><span class=cF0>&lt;&lt;16+</span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l31"></a> </span><span class=cFB>gr</span><span class=cF0>.dc-&gt;dither_probability_u16=i; </span><span class=cF2>//U16 can be [0,65535]</span><span class=cF0>
<a name="l32"></a> </span><span class=cF5>GrFloodFill</span><span class=cF0>(</span><span class=cFB>gr</span><span class=cF0>.dc,x+0.5*radius,y);
<a name="l33"></a> </span><span class=cFB>gr</span><span class=cF0>.dc-&gt;dither_probability_u16=2*i; </span><span class=cF2>//U16 can be [0,65535]</span><span class=cF0>
<a name="l34"></a> </span><span class=cF5>GrFloodFill</span><span class=cF0>(</span><span class=cFB>gr</span><span class=cF0>.dc,x-0.75*radius,y);
<a name="l35"></a>
<a name="l36"></a> </span><span class=cF5>Refresh</span><span class=cF0>; </span><span class=cF2>//Typically 30 fps</span><span class=cF0>
<a name="l37"></a> </span><span class=cF5>DCFill</span><span class=cF0>;
<a name="l38"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l39"></a>
<a name="l40"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;text_attr=</span><span class=cF3>WHITE</span><span class=cF0>&lt;&lt;4+</span><span class=cF3>BLUE</span><span class=cF0>;
<a name="l41"></a>}
<a name="l42"></a>
<a name="l43"></a>SunMoon;
</span></pre></body>
</html>