mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-28 08:16:31 +00:00
332 lines
38 KiB
HTML
Executable file
332 lines
38 KiB
HTML
Executable file
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
|
<meta name="generator" content="ZealOS V1.00">
|
|
<style type="text/css">
|
|
body {background-color:#fef1f0;}
|
|
.cF0{color:#000000;background-color:#fef1f0;}
|
|
.cF1{color:#0148a4;background-color:#fef1f0;}
|
|
.cF2{color:#3b7901;background-color:#fef1f0;}
|
|
.cF3{color:#057c7e;background-color:#fef1f0;}
|
|
.cF4{color:#bb2020;background-color:#fef1f0;}
|
|
.cF5{color:#9e42ae;background-color:#fef1f0;}
|
|
.cF6{color:#b57901;background-color:#fef1f0;}
|
|
.cF7{color:#b2b6af;background-color:#fef1f0;}
|
|
.cF8{color:#555753;background-color:#fef1f0;}
|
|
.cF9{color:#678fbb;background-color:#fef1f0;}
|
|
.cFA{color:#82bc49;background-color:#fef1f0;}
|
|
.cFB{color:#0097a2;background-color:#fef1f0;}
|
|
.cFC{color:#e26a6a;background-color:#fef1f0;}
|
|
.cFD{color:#c671bc;background-color:#fef1f0;}
|
|
.cFE{color:#c7ab00;background-color:#fef1f0;}
|
|
.cFF{color:#fef1f0;background-color:#fef1f0;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre style="font-family:monospace;font-size:12pt">
|
|
<a name="l1"></a><span class=cF0>#</span><span class=cF1>define</span><span class=cF0> TURTLE_SIZE </span><span class=cFE>4</span><span class=cF0>
|
|
<a name="l2"></a>#</span><span class=cF1>define</span><span class=cF0> TURTLE_SPEED_STEP </span><span class=cFE>2</span><span class=cF0>
|
|
<a name="l3"></a>
|
|
<a name="l4"></a>#</span><span class=cF1>define</span><span class=cF0> ANGLES </span><span class=cFE>35</span><span class=cF0>
|
|
<a name="l5"></a></span><span class=cF1>F64</span><span class=cF0> angles[ANGLES] = {
|
|
<a name="l6"></a>
|
|
<a name="l7"></a> -</span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>1</span><span class=cF0>, -</span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>, -</span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>3</span><span class=cF0>, -</span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>4</span><span class=cF0>, -</span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>5</span><span class=cF0>,
|
|
<a name="l8"></a> -</span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>6</span><span class=cF0>, -</span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>8</span><span class=cF0>, -</span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>9</span><span class=cF0>, -</span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>10</span><span class=cF0>,
|
|
<a name="l9"></a> -</span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>12</span><span class=cF0>, -</span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>15</span><span class=cF0>, -</span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>18</span><span class=cF0>, -</span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>20</span><span class=cF0>,
|
|
<a name="l10"></a> -</span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>24</span><span class=cF0>, -</span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>30</span><span class=cF0>, -</span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>36</span><span class=cF0>, -</span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>40</span><span class=cF0>,
|
|
<a name="l11"></a> </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l12"></a> </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>40</span><span class=cF0>, </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>36</span><span class=cF0>, </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>30</span><span class=cF0>, </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>24</span><span class=cF0>,
|
|
<a name="l13"></a> </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>20</span><span class=cF0>, </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>18</span><span class=cF0>, </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>15</span><span class=cF0>, </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>12</span><span class=cF0>,
|
|
<a name="l14"></a> </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>10</span><span class=cF0>, </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>9</span><span class=cF0>, </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>8</span><span class=cF0>, </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>6</span><span class=cF0>,
|
|
<a name="l15"></a> </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>5</span><span class=cF0>, </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>4</span><span class=cF0>, </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>3</span><span class=cF0>, </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0>, </span><span class=cFE>2</span><span class=cF0> * </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>1</span><span class=cF0>
|
|
<a name="l16"></a>};
|
|
<a name="l17"></a>
|
|
<a name="l18"></a></span><span class=cF1>class</span><span class=cF0> Turtle
|
|
<a name="l19"></a>{
|
|
<a name="l20"></a> </span><span class=cF1>F64</span><span class=cF0> x, y, z, speed, theta, w;
|
|
<a name="l21"></a> </span><span class=cF9>I64</span><span class=cF0> dtheta_idx;
|
|
<a name="l22"></a> </span><span class=cF9>CColorROPU16</span><span class=cF0> edge, middle;
|
|
<a name="l23"></a> </span><span class=cF1>Bool</span><span class=cF0> ends, first;
|
|
<a name="l24"></a>
|
|
<a name="l25"></a>} tt;
|
|
<a name="l26"></a>
|
|
<a name="l27"></a></span><span class=cF1>U0</span><span class=cF0> TurtlePlot(</span><span class=cF9>CDC</span><span class=cF0> *dc, Turtle *t, </span><span class=cF9>CColorROPU16</span><span class=cF0> edge, </span><span class=cF9>CColorROPU16</span><span class=cF0> middle)
|
|
<a name="l28"></a>{
|
|
<a name="l29"></a> </span><span class=cF1>F64</span><span class=cF0> w = t->w / </span><span class=cFE>2</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l30"></a>
|
|
<a name="l31"></a> </span><span class=cF1>if</span><span class=cF0> (w < </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l32"></a> w = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l33"></a> dc->color = middle;
|
|
<a name="l34"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, t->x + w * </span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>t->theta + </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF7>)</span><span class=cF0>, t->y + w * </span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>t->theta + </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF7>)</span><span class=cF0>, t->z,
|
|
<a name="l35"></a> t->x + w * </span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>t->theta - </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF7>)</span><span class=cF0>, t->y + w * </span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>t->theta - </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF7>)</span><span class=cF0>, t->z);
|
|
<a name="l36"></a> w = t->w / </span><span class=cFE>2</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l37"></a> dc->color = edge;
|
|
<a name="l38"></a> </span><span class=cF5>GrPlot3</span><span class=cF0>(dc, t->x + w * </span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>t->theta + </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF7>)</span><span class=cF0>, t->y + w * </span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>t->theta + </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF7>)</span><span class=cF0>, t->z);
|
|
<a name="l39"></a> </span><span class=cF5>GrPlot3</span><span class=cF0>(dc, t->x + w * </span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>t->theta - </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF7>)</span><span class=cF0>, t->y + w * </span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>t->theta - </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF7>)</span><span class=cF0>, t->z);
|
|
<a name="l40"></a>}
|
|
<a name="l41"></a>
|
|
<a name="l42"></a></span><span class=cF1>U0</span><span class=cF0> TurtleMicroMove(Turtle *t, </span><span class=cF1>F64</span><span class=cF0> dt)
|
|
<a name="l43"></a>{
|
|
<a name="l44"></a> t->x += dt * t->speed * </span><span class=cF5>Cos</span><span class=cF0>(t->theta);
|
|
<a name="l45"></a> t->y += dt * t->speed * </span><span class=cF5>Sin</span><span class=cF0>(t->theta);
|
|
<a name="l46"></a> t->theta = </span><span class=cF5>Wrap</span><span class=cF0>(t->theta + dt * angles[t->dtheta_idx]);
|
|
<a name="l47"></a>}
|
|
<a name="l48"></a>
|
|
<a name="l49"></a></span><span class=cF1>U0</span><span class=cF0> TurtleEnd(</span><span class=cF9>CDC</span><span class=cF0> *dc, Turtle *t, </span><span class=cF9>CColorROPU16</span><span class=cF0> edge, </span><span class=cF9>CColorROPU16</span><span class=cF0> middle, </span><span class=cF1>F64</span><span class=cF0> theta)
|
|
<a name="l50"></a>{
|
|
<a name="l51"></a> </span><span class=cF1>F64</span><span class=cF0> r, x, y2;
|
|
<a name="l52"></a> Turtle t2;
|
|
<a name="l53"></a>
|
|
<a name="l54"></a> </span><span class=cF1>if</span><span class=cF0> (r = t->w)
|
|
<a name="l55"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l56"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(&t2, t, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>Turtle</span><span class=cF7>)</span><span class=cF0>); </span><span class=cF2>//Save</span><span class=cF0>
|
|
<a name="l57"></a> x = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l58"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
<a name="l59"></a> {
|
|
<a name="l60"></a> t->x += </span><span class=cFE>1</span><span class=cF0> / r *</span><span class=cF5>Cos</span><span class=cF0>(theta);
|
|
<a name="l61"></a> t->y += </span><span class=cFE>1</span><span class=cF0> / r * </span><span class=cF5>Sin</span><span class=cF0>(theta);
|
|
<a name="l62"></a> x += </span><span class=cFE>1</span><span class=cF0> / r;
|
|
<a name="l63"></a> y2 = r * r - </span><span class=cFE>4</span><span class=cF0> * x * x;
|
|
<a name="l64"></a> </span><span class=cF1>if</span><span class=cF0> (y2 >= </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l65"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l66"></a> t->w = </span><span class=cF5>Sqrt</span><span class=cF0>(y2);
|
|
<a name="l67"></a> TurtlePlot(dc, t, edge, middle);
|
|
<a name="l68"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l69"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l70"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l71"></a> }
|
|
<a name="l72"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(t, &t2, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>Turtle</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l73"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l74"></a>}
|
|
<a name="l75"></a>
|
|
<a name="l76"></a></span><span class=cF1>U0</span><span class=cF0> TurtleMove(</span><span class=cF9>CDC</span><span class=cF0> *dc, Turtle *t, </span><span class=cF9>CColorROPU16</span><span class=cF0> edge, </span><span class=cF9>CColorROPU16</span><span class=cF0> middle)
|
|
<a name="l77"></a>{
|
|
<a name="l78"></a> </span><span class=cF9>I64</span><span class=cF0> i, l = </span><span class=cFE>16</span><span class=cF0> * </span><span class=cF5>AbsI64</span><span class=cF0>(t->w + </span><span class=cFE>1</span><span class=cF0>) * </span><span class=cF5>AbsI64</span><span class=cF0>(t->speed + </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l79"></a>
|
|
<a name="l80"></a> </span><span class=cF1>if</span><span class=cF0> (t->ends && t->first)
|
|
<a name="l81"></a> TurtleEnd(dc, t, edge, middle, t->theta + </span><span class=cF3>pi</span><span class=cF0>);
|
|
<a name="l82"></a> t->first = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l83"></a>
|
|
<a name="l84"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < l; i++)
|
|
<a name="l85"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l86"></a> TurtleMicroMove(t, </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> / l);
|
|
<a name="l87"></a> TurtlePlot(dc, t, edge, middle);
|
|
<a name="l88"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l89"></a> </span><span class=cF1>if</span><span class=cF0> (t->ends)
|
|
<a name="l90"></a> TurtleEnd(dc, t, edge, middle, t->theta);
|
|
<a name="l91"></a>}
|
|
<a name="l92"></a>
|
|
<a name="l93"></a></span><span class=cF1>U0</span><span class=cF0> TurtleInit(Turtle *t)
|
|
<a name="l94"></a>{
|
|
<a name="l95"></a> </span><span class=cF5>MemSet</span><span class=cF0>(t, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>Turtle</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l96"></a> t->x = </span><span class=cF5>Fs</span><span class=cF0>->pix_width >> </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l97"></a> t->y = </span><span class=cF5>Fs</span><span class=cF0>->pix_height >> </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l98"></a> t->z = </span><span class=cFE>5</span><span class=cF0>;
|
|
<a name="l99"></a> t->edge = </span><span class=cF3>BLACK</span><span class=cF0>;
|
|
<a name="l100"></a> t->middle = </span><span class=cF3>YELLOW</span><span class=cF0>;
|
|
<a name="l101"></a> t->dtheta_idx = ANGLES / </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l102"></a> t->first = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l103"></a> t->ends = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l104"></a>}
|
|
<a name="l105"></a>
|
|
<a name="l106"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DrawIt</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *, </span><span class=cF9>CDC</span><span class=cF0> *dc)
|
|
<a name="l107"></a>{
|
|
<a name="l108"></a> Turtle t2;
|
|
<a name="l109"></a>
|
|
<a name="l110"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(&t2, &tt, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>Turtle</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l111"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF6>"Layer:%f Speed:%f theta:%5.1f dtheta:%5.1f Width:%f"</span><span class=cF0>,
|
|
<a name="l112"></a> tt.z, tt.speed, tt.theta * </span><span class=cFE>180</span><span class=cF0> / </span><span class=cF3>pi</span><span class=cF0>, angles[tt.dtheta_idx] * </span><span class=cFE>180</span><span class=cF0> / </span><span class=cF3>pi</span><span class=cF0>, tt.w);
|
|
<a name="l113"></a>
|
|
<a name="l114"></a> TurtleMove(dc, &t2, </span><span class=cF3>RED</span><span class=cF0>, </span><span class=cF3>LTRED</span><span class=cF0>);
|
|
<a name="l115"></a> dc->color = </span><span class=cF3>LTRED</span><span class=cF0>;
|
|
<a name="l116"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc, t2.x + TURTLE_SIZE * </span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>t2.theta + </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF7>)</span><span class=cF0>, t2.y + TURTLE_SIZE * </span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>t2.theta + </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF7>)</span><span class=cF0>,
|
|
<a name="l117"></a> t2.x + TURTLE_SIZE * </span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>t2.theta - </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF7>)</span><span class=cF0>, t2.y + TURTLE_SIZE * </span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>t2.theta - </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l118"></a>
|
|
<a name="l119"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc, t2.x + TURTLE_SIZE * </span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>t2.theta + </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF7>)</span><span class=cF0>, t2.y + TURTLE_SIZE * </span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>t2.theta + </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF7>)</span><span class=cF0>,
|
|
<a name="l120"></a> t2.x + TURTLE_SIZE * </span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>t2.theta</span><span class=cF7>)</span><span class=cF0>, t2.y + TURTLE_SIZE * </span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>t2.theta</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l121"></a>
|
|
<a name="l122"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc, t2.x + TURTLE_SIZE * </span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>t2.theta - </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF7>)</span><span class=cF0>, t2.y + TURTLE_SIZE * </span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>t2.theta - </span><span class=cF3>pi</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF7>)</span><span class=cF0>,
|
|
<a name="l123"></a> t2.x + TURTLE_SIZE * </span><span class=cF5>Cos</span><span class=cF7>(</span><span class=cF0>t2.theta</span><span class=cF7>)</span><span class=cF0>, t2.y + TURTLE_SIZE * </span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>t2.theta</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l124"></a>}
|
|
<a name="l125"></a>
|
|
<a name="l126"></a></span><span class=cF1>U0</span><span class=cF0> SetMenu()
|
|
<a name="l127"></a>{
|
|
<a name="l128"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l129"></a> </span><span class=cF1>U8</span><span class=cF0> buf[</span><span class=cF3>STR_LEN</span><span class=cF0>];
|
|
<a name="l130"></a> </span><span class=cF9>CMenuEntry</span><span class=cF0> *tmpse;
|
|
<a name="l131"></a>
|
|
<a name="l132"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i <= </span><span class=cFE>9</span><span class=cF0>; i++)
|
|
<a name="l133"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l134"></a> </span><span class=cF5>StrPrint</span><span class=cF0>(buf, </span><span class=cF6>"Settings/Layer%d"</span><span class=cF0>, i);
|
|
<a name="l135"></a> </span><span class=cF1>if</span><span class=cF0> (tmpse = </span><span class=cF5>MenuEntryFind</span><span class=cF7>(</span><span class=cF5>Fs</span><span class=cF0>->cur_menu, buf</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l136"></a> {
|
|
<a name="l137"></a> </span><span class=cF1>if</span><span class=cF0> (i == tt.z)
|
|
<a name="l138"></a> tmpse->checked = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l139"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l140"></a> tmpse->checked = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l141"></a> }
|
|
<a name="l142"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l143"></a> </span><span class=cF1>if</span><span class=cF0> (tmpse = </span><span class=cF5>MenuEntryFind</span><span class=cF7>(</span><span class=cF5>Fs</span><span class=cF0>->cur_menu, </span><span class=cF6>"Settings/Ends"</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l144"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l145"></a> </span><span class=cF1>if</span><span class=cF0> (tt.ends)
|
|
<a name="l146"></a> tmpse->checked = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l147"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l148"></a> tmpse->checked = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l149"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l150"></a>}
|
|
<a name="l151"></a>
|
|
<a name="l152"></a></span><span class=cF1>U0</span><span class=cF0> Lattice()
|
|
<a name="l153"></a>{
|
|
<a name="l154"></a> </span><span class=cF1>Bool</span><span class=cF0> aim = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l155"></a> </span><span class=cF9>I64</span><span class=cF0> arg1, arg2;
|
|
<a name="l156"></a> </span><span class=cF9>CDC</span><span class=cF0> *dc = </span><span class=cF5>DCAlias</span><span class=cF0>;
|
|
<a name="l157"></a>
|
|
<a name="l158"></a> </span><span class=cF5>DCDepthBufAlloc</span><span class=cF0>(dc);
|
|
<a name="l159"></a> </span><span class=cF5>MenuPush</span><span class=cF0>( </span><span class=cF6>"File {"</span><span class=cF0>
|
|
<a name="l160"></a> </span><span class=cF6>" Abort(,CH_SHIFT_ESC);"</span><span class=cF0>
|
|
<a name="l161"></a> </span><span class=cF6>" Exit(,CH_ESC);"</span><span class=cF0>
|
|
<a name="l162"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l163"></a> </span><span class=cF6>"Play {"</span><span class=cF0>
|
|
<a name="l164"></a> </span><span class=cF6>" Restart(,'\n');"</span><span class=cF0>
|
|
<a name="l165"></a> </span><span class=cF6>" Step(,CH_SPACE);"</span><span class=cF0>
|
|
<a name="l166"></a> </span><span class=cF6>" Accelerator(,,SC_CURSOR_UP);"</span><span class=cF0>
|
|
<a name="l167"></a> </span><span class=cF6>" Break(,,SC_CURSOR_DOWN);"</span><span class=cF0>
|
|
<a name="l168"></a> </span><span class=cF6>" Left(,,SC_CURSOR_LEFT);"</span><span class=cF0>
|
|
<a name="l169"></a> </span><span class=cF6>" Right(,,SC_CURSOR_RIGHT);"</span><span class=cF0>
|
|
<a name="l170"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l171"></a> </span><span class=cF6>"Settings {"</span><span class=cF0>
|
|
<a name="l172"></a> </span><span class=cF6>" Color(,'c');"</span><span class=cF0>
|
|
<a name="l173"></a> </span><span class=cF6>" Wider(,'+');"</span><span class=cF0>
|
|
<a name="l174"></a> </span><span class=cF6>" Narrower(,'-');"</span><span class=cF0>
|
|
<a name="l175"></a> </span><span class=cF6>" Ends(,'e');"</span><span class=cF0>
|
|
<a name="l176"></a> </span><span class=cF6>" Layer0(,'0');"</span><span class=cF0>
|
|
<a name="l177"></a> </span><span class=cF6>" Layer1(,'1');"</span><span class=cF0>
|
|
<a name="l178"></a> </span><span class=cF6>" Layer2(,'2');"</span><span class=cF0>
|
|
<a name="l179"></a> </span><span class=cF6>" Layer3(,'3');"</span><span class=cF0>
|
|
<a name="l180"></a> </span><span class=cF6>" Layer4(,'4');"</span><span class=cF0>
|
|
<a name="l181"></a> </span><span class=cF6>" Layer5(,'5');"</span><span class=cF0>
|
|
<a name="l182"></a> </span><span class=cF6>" Layer6(,'6');"</span><span class=cF0>
|
|
<a name="l183"></a> </span><span class=cF6>" Layer7(,'7');"</span><span class=cF0>
|
|
<a name="l184"></a> </span><span class=cF6>" Layer8(,'8');"</span><span class=cF0>
|
|
<a name="l185"></a> </span><span class=cF6>" Layer9(,'9');"</span><span class=cF0>
|
|
<a name="l186"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l187"></a> );
|
|
<a name="l188"></a> </span><span class=cF5>SettingsPush</span><span class=cF0>; </span><span class=cF2>//See </span><a href="https://zeal-operating-system.github.io/ZealOS/System/TaskSettings.CC.html#l3"><span class=cF4>SettingsPush</span></a><span class=cF0>
|
|
<a name="l189"></a> </span><span class=cF5>AutoComplete</span><span class=cF0>;
|
|
<a name="l190"></a> </span><span class=cF5>WinBorder</span><span class=cF0>;
|
|
<a name="l191"></a> </span><span class=cF5>WinMax</span><span class=cF0>;
|
|
<a name="l192"></a> </span><span class=cF5>DocCursor</span><span class=cF0>;
|
|
<a name="l193"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
|
<a name="l194"></a> TurtleInit(&tt);
|
|
<a name="l195"></a> SetMenu;
|
|
<a name="l196"></a> </span><span class=cF5>Fs</span><span class=cF0>->win_inhibit = </span><span class=cF3>WIG_TASK_DEFAULT</span><span class=cF0> - </span><span class=cF3>WIF_FOCUS_TASK_MENU</span><span class=cF0> - </span><span class=cF3>WIF_SELF_FOCUS</span><span class=cF0> - </span><span class=cF3>WIF_SELF_GRAB_SCROLL</span><span class=cF0>;
|
|
<a name="l197"></a> </span><span class=cF5>Fs</span><span class=cF0>->draw_it = &</span><span class=cF5>DrawIt</span><span class=cF0>;
|
|
<a name="l198"></a> </span><span class=cF1>try</span><span class=cF0>
|
|
<a name="l199"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l200"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
<a name="l201"></a> {
|
|
<a name="l202"></a> </span><span class=cF1>switch</span><span class=cF0> (</span><span class=cF5>MessageGet</span><span class=cF7>(</span><span class=cF0>&arg1, &arg2, </span><span class=cFE>1</span><span class=cF0> << </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0> | </span><span class=cFE>1</span><span class=cF0> << </span><span class=cF3>MESSAGE_MS_L_DOWN</span><span class=cF0>|
|
|
<a name="l203"></a> </span><span class=cFE>1</span><span class=cF0> << </span><span class=cF3>MESSAGE_MS_R_DOWN</span><span class=cF0> | </span><span class=cFE>1</span><span class=cF0> << </span><span class=cF3>MESSAGE_MS_R_UP</span><span class=cF0> | </span><span class=cFE>1</span><span class=cF0> << </span><span class=cF3>MESSAGE_MS_MOVE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l204"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l205"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_L_DOWN</span><span class=cF0>:
|
|
<a name="l206"></a> tt.first = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l207"></a> tt.x = arg1;
|
|
<a name="l208"></a> tt.y = arg2;
|
|
<a name="l209"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l210"></a>
|
|
<a name="l211"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_R_DOWN</span><span class=cF0>:
|
|
<a name="l212"></a> aim = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l213"></a> tt.theta = </span><span class=cF5>Arg</span><span class=cF0>(arg1 - tt.x, arg2 - tt.y);
|
|
<a name="l214"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l215"></a>
|
|
<a name="l216"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_MOVE</span><span class=cF0>:
|
|
<a name="l217"></a> </span><span class=cF1>if</span><span class=cF0> (aim)
|
|
<a name="l218"></a> tt.theta = </span><span class=cF5>Arg</span><span class=cF0>(arg1 - tt.x, arg2 - tt.y);
|
|
<a name="l219"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l220"></a>
|
|
<a name="l221"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_R_UP</span><span class=cF0>:
|
|
<a name="l222"></a> tt.theta = </span><span class=cF5>Arg</span><span class=cF0>(arg1 - tt.x, arg2 - tt.y);
|
|
<a name="l223"></a> aim = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l224"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l225"></a>
|
|
<a name="l226"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0>:
|
|
<a name="l227"></a> </span><span class=cF1>switch</span><span class=cF0> (arg1)
|
|
<a name="l228"></a> {
|
|
<a name="l229"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>:
|
|
<a name="l230"></a> </span><span class=cF1>switch</span><span class=cF0> (arg2.u8[</span><span class=cFE>0</span><span class=cF0>])
|
|
<a name="l231"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l232"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_LEFT</span><span class=cF0>:
|
|
<a name="l233"></a> </span><span class=cF1>if</span><span class=cF0> (tt.dtheta_idx)
|
|
<a name="l234"></a> tt.dtheta_idx--;
|
|
<a name="l235"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l236"></a>
|
|
<a name="l237"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_RIGHT</span><span class=cF0>:
|
|
<a name="l238"></a> </span><span class=cF1>if</span><span class=cF0> (tt.dtheta_idx < ANGLES - </span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l239"></a> tt.dtheta_idx++;
|
|
<a name="l240"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l241"></a>
|
|
<a name="l242"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_UP</span><span class=cF0>:
|
|
<a name="l243"></a> tt.speed += TURTLE_SPEED_STEP;
|
|
<a name="l244"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l245"></a>
|
|
<a name="l246"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_DOWN</span><span class=cF0>:
|
|
<a name="l247"></a> </span><span class=cF1>if</span><span class=cF0> (tt.speed >= TURTLE_SPEED_STEP)
|
|
<a name="l248"></a> tt.speed -= TURTLE_SPEED_STEP;
|
|
<a name="l249"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l250"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l251"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l252"></a>
|
|
<a name="l253"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'0'</span><span class=cF0>...</span><span class=cF6>'9'</span><span class=cF0>:
|
|
<a name="l254"></a> tt.z = arg1 - </span><span class=cF6>'0'</span><span class=cF0>;
|
|
<a name="l255"></a> SetMenu;
|
|
<a name="l256"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l257"></a>
|
|
<a name="l258"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'c'</span><span class=cF0>:
|
|
<a name="l259"></a> tt.middle = </span><span class=cF5>PopUpColor</span><span class=cF0>(</span><span class=cF6>"Mid Color\n\n"</span><span class=cF0>);
|
|
<a name="l260"></a> tt.edge = </span><span class=cF5>PopUpColor</span><span class=cF0>(</span><span class=cF6>"Edge Color\n\n"</span><span class=cF0>);
|
|
<a name="l261"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l262"></a>
|
|
<a name="l263"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'e'</span><span class=cF0>:
|
|
<a name="l264"></a> tt.ends = !tt.ends;
|
|
<a name="l265"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l266"></a>
|
|
<a name="l267"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'+'</span><span class=cF0>:
|
|
<a name="l268"></a> tt.w++;
|
|
<a name="l269"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l270"></a>
|
|
<a name="l271"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'-'</span><span class=cF0>:
|
|
<a name="l272"></a> </span><span class=cF1>if</span><span class=cF0> (tt.w)
|
|
<a name="l273"></a> tt.w--;
|
|
<a name="l274"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l275"></a>
|
|
<a name="l276"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'\n'</span><span class=cF0>:
|
|
<a name="l277"></a> </span><span class=cF5>DCFill</span><span class=cF0>(dc);
|
|
<a name="l278"></a> TurtleInit(&tt);
|
|
<a name="l279"></a> SetMenu;
|
|
<a name="l280"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l281"></a>
|
|
<a name="l282"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_ESC</span><span class=cF0>:
|
|
<a name="l283"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>:
|
|
<a name="l284"></a> </span><span class=cF1>goto</span><span class=cF0> lt_done;
|
|
<a name="l285"></a>
|
|
<a name="l286"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SPACE</span><span class=cF0>:
|
|
<a name="l287"></a> TurtleMove(dc, &tt, tt.edge, tt.middle);
|
|
<a name="l288"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l289"></a> }
|
|
<a name="l290"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l291"></a> }
|
|
<a name="l292"></a>lt_done:
|
|
<a name="l293"></a> </span><span class=cF5>MessageGet</span><span class=cF0>(,, </span><span class=cFE>1</span><span class=cF0> << </span><span class=cF3>MESSAGE_KEY_UP</span><span class=cF0>);
|
|
<a name="l294"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l295"></a> </span><span class=cF1>catch</span><span class=cF0>
|
|
<a name="l296"></a> </span><span class=cF5>PutExcept</span><span class=cF0>;
|
|
<a name="l297"></a> </span><span class=cF5>SettingsPop</span><span class=cF0>;
|
|
<a name="l298"></a> </span><span class=cF5>DCFill</span><span class=cF0>(dc);
|
|
<a name="l299"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc);
|
|
<a name="l300"></a> </span><span class=cF5>MenuPop</span><span class=cF0>;
|
|
<a name="l301"></a>}
|
|
<a name="l302"></a>
|
|
<a name="l303"></a>Lattice;
|
|
</span></pre></body>
|
|
</html>
|