ZealOS/docs/Demo/Graphics/WallPaperFish.CC.html
TomAwezome dbf8647d59 Fixed non-writable drive throw on F5 and Ctrl-S.
Added top & right borders to RawDr.
Improved spacing in some debug and compiler reporting.
Fixed RawPutChar and EdLite tab width.
Fixed Ui missing '0x' prefix syntax highlighter bug.
Added 32BitPaint demo.
2021-07-14 18:38:02 -04:00

153 lines
12 KiB
HTML
Executable file

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V0.08">
<style type="text/css">
body {background-color:#000000;}
.cF0{color:#ffffff;background-color:#000000;}
.cF1{color:#3465a4;background-color:#000000;}
.cF2{color:#4e9a06;background-color:#000000;}
.cF3{color:#06989a;background-color:#000000;}
.cF4{color:#a24444;background-color:#000000;}
.cF5{color:#75507b;background-color:#000000;}
.cF6{color:#ce982f;background-color:#000000;}
.cF7{color:#bcc0b9;background-color:#000000;}
.cF8{color:#555753;background-color:#000000;}
.cF9{color:#729fcf;background-color:#000000;}
.cFA{color:#82bc49;background-color:#000000;}
.cFB{color:#34e2e2;background-color:#000000;}
.cFC{color:#ac3535;background-color:#000000;}
.cFD{color:#ad7fa8;background-color:#000000;}
.cFE{color:#fce94f;background-color:#000000;}
.cFF{color:#000000;background-color:#000000;}
</style>
</head>
<body>
<pre style="font-family:monospace;font-size:12pt">
<a name="l1"></a><span class=cF2>/* You &quot;System Include&quot; this because you want the wallpaper</span><span class=cF0>
<a name="l2"></a></span><span class=cF2>routine to stay in mem even if this task is killed.</span><span class=cF0>
<a name="l3"></a>
<a name="l4"></a> </span><span class=cF2>&lt;CTRL-t&gt; to see the hidden text needed for sprite elements.</span><span class=cF0>
<a name="l5"></a>
<a name="l6"></a> </span><span class=cF2>&lt;CTRL-r&gt; to add a sprite to a document.</span><span class=cF0>
<a name="l7"></a></span><span class=cF2>*/</span><span class=cF0>
<a name="l8"></a></span><span class=cFA>
<a name="l9"></a>&lt;1&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l10"></a>
<a name="l11"></a></span><span class=cFA>
<a name="l12"></a>&lt;2&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l13"></a>
<a name="l14"></a></span><span class=cFA>
<a name="l15"></a>&lt;3&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l16"></a>
<a name="l17"></a></span><span class=cFA>
<a name="l18"></a>&lt;4&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l19"></a>
<a name="l20"></a>
<a name="l21"></a></span><span class=cFA>
<a name="l22"></a>&lt;5&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l23"></a>
<a name="l24"></a>
<a name="l25"></a></span><span class=cFA>
<a name="l26"></a>&lt;6&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l27"></a>
<a name="l28"></a>
<a name="l29"></a></span><span class=cFA>
<a name="l30"></a>&lt;7&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l31"></a>
<a name="l32"></a></span><span class=cFA>
<a name="l33"></a>&lt;8&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l34"></a>
<a name="l35"></a></span><span class=cFA>
<a name="l36"></a>&lt;9&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l37"></a>
<a name="l38"></a>
<a name="l39"></a>#</span><span class=cF1>define</span><span class=cF0> TYPES_OF_CRITTERS </span><span class=cFE>3</span><span class=cF0>
<a name="l40"></a>#</span><span class=cF1>define</span><span class=cF0> FRAMES_PER_CRITTER </span><span class=cFE>4</span><span class=cF0>
<a name="l41"></a>
<a name="l42"></a></span><span class=cF1>U8</span><span class=cF0> *imgs[TYPES_OF_CRITTERS][FRAMES_PER_CRITTER] = {
<a name="l43"></a> </span><span class=cF7>{</span><span class=cFA>&lt;1&gt;</span><span class=cF0>, </span><span class=cFA>&lt;2&gt;</span><span class=cF0>, </span><span class=cFA>&lt;3&gt;</span><span class=cF0>, </span><span class=cFA>&lt;2&gt;</span><span class=cF7>}</span><span class=cF0>,
<a name="l44"></a> </span><span class=cF7>{</span><span class=cFA>&lt;4&gt;</span><span class=cF0>, </span><span class=cFA>&lt;5&gt;</span><span class=cF0>, </span><span class=cFA>&lt;6&gt;</span><span class=cF0>, </span><span class=cFA>&lt;5&gt;</span><span class=cF7>}</span><span class=cF0>,
<a name="l45"></a> </span><span class=cF7>{</span><span class=cFA>&lt;7&gt;</span><span class=cF0>, </span><span class=cFA>&lt;8&gt;</span><span class=cF0>, </span><span class=cFA>&lt;9&gt;</span><span class=cF0>, </span><span class=cFA>&lt;8&gt;</span><span class=cF7>}</span><span class=cF0>
<a name="l46"></a>};
<a name="l47"></a>
<a name="l48"></a>#</span><span class=cF1>define</span><span class=cF0> CRITTERS_NUM </span><span class=cFE>16</span><span class=cF0>
<a name="l49"></a></span><span class=cF1>class</span><span class=cF0> Critter
<a name="l50"></a>{
<a name="l51"></a> </span><span class=cF9>I64</span><span class=cF0> x, y, dx, dy, type;
<a name="l52"></a> </span><span class=cF1>F64</span><span class=cF0> t_offset;
<a name="l53"></a>
<a name="l54"></a>} wall_crits[CRITTERS_NUM];
<a name="l55"></a>
<a name="l56"></a></span><span class=cF1>U0</span><span class=cF0> (*old_wall_paper)(</span><span class=cF9>CTask</span><span class=cF0> *task);
<a name="l57"></a>
<a name="l58"></a></span><span class=cF1>U0</span><span class=cF0> WallPaperFish(</span><span class=cF9>CTask</span><span class=cF0> *task)
<a name="l59"></a>{
<a name="l60"></a> </span><span class=cF9>I64</span><span class=cF0> i, j, x, y;
<a name="l61"></a> </span><span class=cF9>CDC</span><span class=cF0> *dc = </span><span class=cF5>DCAlias</span><span class=cF0>(</span><span class=cFB>gr</span><span class=cF0>.dc2, task);
<a name="l62"></a> Critter *c = wall_crits;
<a name="l63"></a>
<a name="l64"></a> task-&gt;text_attr = </span><span class=cF3>CYAN</span><span class=cF0> &lt;&lt; </span><span class=cFE>4</span><span class=cF0> + </span><span class=cF3>WHITE</span><span class=cF0>;
<a name="l65"></a> dc-&gt;color = </span><span class=cF3>BROWN</span><span class=cF0>;
<a name="l66"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; </span><span class=cF3>GR_HEIGHT</span><span class=cF0>; i += </span><span class=cFE>20</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l67"></a> j = </span><span class=cFE>16</span><span class=cF0> * </span><span class=cF5>Tri</span><span class=cF0>(</span><span class=cF5>tS</span><span class=cF0> * </span><span class=cFE>10</span><span class=cF0>, </span><span class=cFE>20</span><span class=cF0>);
<a name="l68"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>GR_HEIGHT</span><span class=cF0> - i - j, </span><span class=cF3>GR_HEIGHT</span><span class=cF0> - i - j, </span><span class=cF3>GR_HEIGHT</span><span class=cF0>);
<a name="l69"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l70"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; CRITTERS_NUM; i++, c++)
<a name="l71"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l72"></a> j = (</span><span class=cF5>tS</span><span class=cF0> * </span><span class=cFE>4</span><span class=cF0> + c-&gt;t_offset) % FRAMES_PER_CRITTER;
<a name="l73"></a> x = c-&gt;x &gt;&gt; </span><span class=cFE>16</span><span class=cF0> % </span><span class=cF3>GR_WIDTH</span><span class=cF0>;
<a name="l74"></a> </span><span class=cF1>if</span><span class=cF0> (x &lt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l75"></a> x += </span><span class=cF3>GR_WIDTH</span><span class=cF0>;
<a name="l76"></a> y = c-&gt;y &gt;&gt; </span><span class=cFE>16</span><span class=cF0> % </span><span class=cF3>GR_HEIGHT</span><span class=cF0>;
<a name="l77"></a> </span><span class=cF1>if</span><span class=cF0> (y &lt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l78"></a> y += </span><span class=cF3>GR_HEIGHT</span><span class=cF0>;
<a name="l79"></a> </span><span class=cF1>if</span><span class=cF0> (c-&gt;dx &lt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l80"></a> {
<a name="l81"></a> dc-&gt;flags |= </span><span class=cF3>DCF_SYMMETRY</span><span class=cF0> | </span><span class=cF3>DCF_JUST_MIRROR</span><span class=cF0>;
<a name="l82"></a> </span><span class=cF5>DCSymmetrySet</span><span class=cF0>(dc, x, y - </span><span class=cFE>1</span><span class=cF0>, x, y + </span><span class=cFE>1</span><span class=cF0>);
<a name="l83"></a> }
<a name="l84"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l85"></a> dc-&gt;flags &amp;= ~(</span><span class=cF3>DCF_SYMMETRY</span><span class=cF0> | </span><span class=cF3>DCF_JUST_MIRROR</span><span class=cF0>);
<a name="l86"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc, x, y, </span><span class=cFE>0</span><span class=cF0>, imgs[c-&gt;type][j]);
<a name="l87"></a> c-&gt;x += c-&gt;dx; c-&gt;y += c-&gt;dy;
<a name="l88"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l89"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc);
<a name="l90"></a>
<a name="l91"></a> </span><span class=cF2>//Uncomment the following if you wish.</span><span class=cF0>
<a name="l92"></a> </span><span class=cF2>//old_wall_paper(task);</span><span class=cF0>
<a name="l93"></a>}
<a name="l94"></a>
<a name="l95"></a></span><span class=cF1>U0</span><span class=cF0> WallInit()
<a name="l96"></a>{
<a name="l97"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l98"></a> Critter *c;
<a name="l99"></a>
<a name="l100"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Fs</span><span class=cF0> != </span><span class=cFB>sys_task</span><span class=cF0>)
<a name="l101"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l102"></a> </span><span class=cF6>&quot;Must be System Included with SHIFT-F5.\n&quot;</span><span class=cF0>
<a name="l103"></a> </span><span class=cF6>&quot;(Would crash when code mem was freed.)\n&quot;</span><span class=cF0>;
<a name="l104"></a> </span><span class=cF1>return</span><span class=cF0>;
<a name="l105"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l106"></a> old_wall_paper = </span><span class=cFB>gr</span><span class=cF0>.fp_wall_paper;
<a name="l107"></a> c = wall_crits;
<a name="l108"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; CRITTERS_NUM; i++, c++)
<a name="l109"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l110"></a> c-&gt;x = (</span><span class=cF5>RandU16</span><span class=cF0> % </span><span class=cF3>GR_WIDTH</span><span class=cF0>) &lt;&lt; </span><span class=cFE>16</span><span class=cF0>;
<a name="l111"></a> c-&gt;y = (</span><span class=cF5>RandU16</span><span class=cF0> % </span><span class=cF3>GR_HEIGHT</span><span class=cF0>) &lt;&lt; </span><span class=cFE>16</span><span class=cF0>;
<a name="l112"></a> c-&gt;type = </span><span class=cF5>RandU16</span><span class=cF0> % TYPES_OF_CRITTERS;
<a name="l113"></a> c-&gt;dx = </span><span class=cF5>RandI16</span><span class=cF0>;
<a name="l114"></a> </span><span class=cF1>if</span><span class=cF0> (c-&gt;dx &lt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l115"></a> c-&gt;dx -= </span><span class=cFE>0x4000</span><span class=cF0>;
<a name="l116"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l117"></a> c-&gt;dx += </span><span class=cFE>0x4000</span><span class=cF0>;
<a name="l118"></a> c-&gt;dy = </span><span class=cF5>RandI16</span><span class=cF0>;
<a name="l119"></a> c-&gt;t_offset = </span><span class=cF5>Rand</span><span class=cF0> * FRAMES_PER_CRITTER;
<a name="l120"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l121"></a> </span><span class=cFB>gr</span><span class=cF0>.fp_wall_paper = &amp;WallPaperFish;
<a name="l122"></a>}
<a name="l123"></a>
<a name="l124"></a>WallInit;
</span></pre></body>
</html>