298 lines
30 KiB
HTML
Executable File
298 lines
30 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=cF0>#</span><span class=cF1>define</span><span class=cF0> TURTLE_SIZE 4
|
|
<a name="l2"></a>#</span><span class=cF1>define</span><span class=cF0> TURTLE_SPEED_STEP 2
|
|
<a name="l3"></a>
|
|
<a name="l4"></a>#</span><span class=cF1>define</span><span class=cF0> ANGLES 35
|
|
<a name="l5"></a></span><span class=cF1>F64</span><span class=cF0> angles[ANGLES]={
|
|
<a name="l6"></a>-2*</span><span class=cF3>pi</span><span class=cF0>/1,-2*</span><span class=cF3>pi</span><span class=cF0>/2,-2*</span><span class=cF3>pi</span><span class=cF0>/3,-2*</span><span class=cF3>pi</span><span class=cF0>/4,-2*</span><span class=cF3>pi</span><span class=cF0>/5,
|
|
<a name="l7"></a>-2*</span><span class=cF3>pi</span><span class=cF0>/6,-2*</span><span class=cF3>pi</span><span class=cF0>/8,-2*</span><span class=cF3>pi</span><span class=cF0>/9,-2*</span><span class=cF3>pi</span><span class=cF0>/10,
|
|
<a name="l8"></a>-2*</span><span class=cF3>pi</span><span class=cF0>/12,-2*</span><span class=cF3>pi</span><span class=cF0>/15,-2*</span><span class=cF3>pi</span><span class=cF0>/18,-2*</span><span class=cF3>pi</span><span class=cF0>/20,
|
|
<a name="l9"></a>-2*</span><span class=cF3>pi</span><span class=cF0>/24,-2*</span><span class=cF3>pi</span><span class=cF0>/30,-2*</span><span class=cF3>pi</span><span class=cF0>/36,-2*</span><span class=cF3>pi</span><span class=cF0>/40,
|
|
<a name="l10"></a>0,
|
|
<a name="l11"></a>2*</span><span class=cF3>pi</span><span class=cF0>/40,2*</span><span class=cF3>pi</span><span class=cF0>/36,2*</span><span class=cF3>pi</span><span class=cF0>/30,2*</span><span class=cF3>pi</span><span class=cF0>/24,
|
|
<a name="l12"></a>2*</span><span class=cF3>pi</span><span class=cF0>/20,2*</span><span class=cF3>pi</span><span class=cF0>/18,2*</span><span class=cF3>pi</span><span class=cF0>/15,2*</span><span class=cF3>pi</span><span class=cF0>/12,
|
|
<a name="l13"></a>2*</span><span class=cF3>pi</span><span class=cF0>/10,2*</span><span class=cF3>pi</span><span class=cF0>/9,2*</span><span class=cF3>pi</span><span class=cF0>/8,2*</span><span class=cF3>pi</span><span class=cF0>/6,
|
|
<a name="l14"></a>2*</span><span class=cF3>pi</span><span class=cF0>/5,2*</span><span class=cF3>pi</span><span class=cF0>/4,2*</span><span class=cF3>pi</span><span class=cF0>/3,2*</span><span class=cF3>pi</span><span class=cF0>/2,2*</span><span class=cF3>pi</span><span class=cF0>/1
|
|
<a name="l15"></a>};
|
|
<a name="l16"></a>
|
|
<a name="l17"></a></span><span class=cF1>class</span><span class=cF0> Turtle
|
|
<a name="l18"></a>{
|
|
<a name="l19"></a> </span><span class=cF1>F64</span><span class=cF0> x,y,z,speed,theta,w;
|
|
<a name="l20"></a> </span><span class=cF9>I64</span><span class=cF0> dtheta_idx;
|
|
<a name="l21"></a> </span><span class=cF9>CColorROPU16</span><span class=cF0> edge,middle;
|
|
<a name="l22"></a> </span><span class=cF1>Bool</span><span class=cF0> ends,first;
|
|
<a name="l23"></a>} tt;
|
|
<a name="l24"></a>
|
|
<a name="l25"></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="l26"></a>{
|
|
<a name="l27"></a> </span><span class=cF1>F64</span><span class=cF0> w=t->w/2.0-1;
|
|
<a name="l28"></a> </span><span class=cF1>if</span><span class=cF0> (w<0) w=0;
|
|
<a name="l29"></a> dc->color=middle;
|
|
<a name="l30"></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>/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>/2</span><span class=cF7>)</span><span class=cF0>,t->z,
|
|
<a name="l31"></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>/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>/2</span><span class=cF7>)</span><span class=cF0>,t->z);
|
|
<a name="l32"></a> w=t->w/2.0;
|
|
<a name="l33"></a> dc->color=edge;
|
|
<a name="l34"></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>/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>/2</span><span class=cF7>)</span><span class=cF0>,t->z);
|
|
<a name="l35"></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>/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>/2</span><span class=cF7>)</span><span class=cF0>,t->z);
|
|
<a name="l36"></a>}
|
|
<a name="l37"></a>
|
|
<a name="l38"></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="l39"></a>{
|
|
<a name="l40"></a> t->x+=dt*t->speed*</span><span class=cF5>Cos</span><span class=cF0>(t->theta);
|
|
<a name="l41"></a> t->y+=dt*t->speed*</span><span class=cF5>Sin</span><span class=cF0>(t->theta);
|
|
<a name="l42"></a> t->theta=</span><span class=cF5>Wrap</span><span class=cF0>(t->theta+dt*angles[t->dtheta_idx]);
|
|
<a name="l43"></a>}
|
|
<a name="l44"></a>
|
|
<a name="l45"></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="l46"></a>{
|
|
<a name="l47"></a> </span><span class=cF1>F64</span><span class=cF0> r,x,y2;
|
|
<a name="l48"></a> Turtle t2;
|
|
<a name="l49"></a> </span><span class=cF1>if</span><span class=cF0> (r=t->w) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l50"></a> </span><span class=cF5>MemCpy</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="l51"></a> x=0;
|
|
<a name="l52"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) {
|
|
<a name="l53"></a> t->x+=1/r*</span><span class=cF5>Cos</span><span class=cF0>(theta);
|
|
<a name="l54"></a> t->y+=1/r*</span><span class=cF5>Sin</span><span class=cF0>(theta);
|
|
<a name="l55"></a> x+=1/r;
|
|
<a name="l56"></a> y2=r*r-4*x*x;
|
|
<a name="l57"></a> </span><span class=cF1>if</span><span class=cF0> (y2>=0) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l58"></a> t->w=</span><span class=cF5>Sqrt</span><span class=cF0>(y2);
|
|
<a name="l59"></a> TurtlePlot(dc,t,edge,middle);
|
|
<a name="l60"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l61"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l62"></a> }
|
|
<a name="l63"></a> </span><span class=cF5>MemCpy</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="l64"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l65"></a>}
|
|
<a name="l66"></a>
|
|
<a name="l67"></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="l68"></a>{
|
|
<a name="l69"></a> </span><span class=cF9>I64</span><span class=cF0> i,l=16*</span><span class=cF5>AbsI64</span><span class=cF0>(t->w+1)*</span><span class=cF5>AbsI64</span><span class=cF0>(t->speed+1);
|
|
<a name="l70"></a>
|
|
<a name="l71"></a> </span><span class=cF1>if</span><span class=cF0> (t->ends && t->first)
|
|
<a name="l72"></a> TurtleEnd(dc,t,edge,middle,t->theta+</span><span class=cF3>pi</span><span class=cF0>);
|
|
<a name="l73"></a> t->first=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l74"></a>
|
|
<a name="l75"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<l;i++) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l76"></a> TurtleMicroMove(t,1.0/l);
|
|
<a name="l77"></a> TurtlePlot(dc,t,edge,middle);
|
|
<a name="l78"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l79"></a> </span><span class=cF1>if</span><span class=cF0> (t->ends)
|
|
<a name="l80"></a> TurtleEnd(dc,t,edge,middle,t->theta);
|
|
<a name="l81"></a>}
|
|
<a name="l82"></a>
|
|
<a name="l83"></a></span><span class=cF1>U0</span><span class=cF0> TurtleInit(Turtle *t)
|
|
<a name="l84"></a>{
|
|
<a name="l85"></a> </span><span class=cF5>MemSet</span><span class=cF0>(t,0,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>Turtle</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l86"></a> t->x=</span><span class=cF5>Fs</span><span class=cF0>->pix_width>>1;
|
|
<a name="l87"></a> t->y=</span><span class=cF5>Fs</span><span class=cF0>->pix_height>>1;
|
|
<a name="l88"></a> t->z=5;
|
|
<a name="l89"></a> t->edge=</span><span class=cF3>BLACK</span><span class=cF0>;
|
|
<a name="l90"></a> t->middle=</span><span class=cF3>YELLOW</span><span class=cF0>;
|
|
<a name="l91"></a> t->dtheta_idx=ANGLES/2;
|
|
<a name="l92"></a> t->first=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l93"></a> t->ends=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l94"></a>}
|
|
<a name="l95"></a>
|
|
<a name="l96"></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="l97"></a>{
|
|
<a name="l98"></a> Turtle t2;
|
|
<a name="l99"></a> </span><span class=cF5>MemCpy</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="l100"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc,0,0,</span><span class=cF6>"Layer:%f Speed:%f theta:%5.1f dtheta:%5.1f Width:%f"</span><span class=cF0>,
|
|
<a name="l101"></a> tt.z,tt.speed,tt.theta*180/</span><span class=cF3>pi</span><span class=cF0>,angles[tt.dtheta_idx]*180/</span><span class=cF3>pi</span><span class=cF0>,tt.w);
|
|
<a name="l102"></a>
|
|
<a name="l103"></a> TurtleMove(dc,&t2,</span><span class=cF3>RED</span><span class=cF0>,</span><span class=cF3>LTRED</span><span class=cF0>);
|
|
<a name="l104"></a> dc->color=</span><span class=cF3>LTRED</span><span class=cF0>;
|
|
<a name="l105"></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>/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>/2</span><span class=cF7>)</span><span class=cF0>,
|
|
<a name="l106"></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>/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>/2</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l107"></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>/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>/2</span><span class=cF7>)</span><span class=cF0>,
|
|
<a name="l108"></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="l109"></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>/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>/2</span><span class=cF7>)</span><span class=cF0>,
|
|
<a name="l110"></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="l111"></a>}
|
|
<a name="l112"></a>
|
|
<a name="l113"></a></span><span class=cF1>U0</span><span class=cF0> SetMenu()
|
|
<a name="l114"></a>{
|
|
<a name="l115"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l116"></a> </span><span class=cF1>U8</span><span class=cF0> buf[</span><span class=cF3>STR_LEN</span><span class=cF0>];
|
|
<a name="l117"></a> </span><span class=cF9>CMenuEntry</span><span class=cF0> *tmpse;
|
|
<a name="l118"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<=9;i++) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l119"></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="l120"></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="l121"></a> </span><span class=cF1>if</span><span class=cF0> (i==tt.z)
|
|
<a name="l122"></a> tmpse->checked=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l123"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l124"></a> tmpse->checked=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l125"></a> }
|
|
<a name="l126"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l127"></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>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l128"></a> </span><span class=cF1>if</span><span class=cF0> (tt.ends)
|
|
<a name="l129"></a> tmpse->checked=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l130"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l131"></a> tmpse->checked=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l132"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l133"></a>}
|
|
<a name="l134"></a>
|
|
<a name="l135"></a></span><span class=cF1>U0</span><span class=cF0> Lattice()
|
|
<a name="l136"></a>{
|
|
<a name="l137"></a> </span><span class=cF1>Bool</span><span class=cF0> aim=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l138"></a> </span><span class=cF9>I64</span><span class=cF0> arg1,arg2;
|
|
<a name="l139"></a> </span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cF5>DCAlias</span><span class=cF0>;
|
|
<a name="l140"></a> </span><span class=cF5>DCDepthBufAlloc</span><span class=cF0>(dc);
|
|
<a name="l141"></a> </span><span class=cF5>MenuPush</span><span class=cF0>(
|
|
<a name="l142"></a> </span><span class=cF6>"File {"</span><span class=cF0>
|
|
<a name="l143"></a> </span><span class=cF6>" Abort(,CH_SHIFT_ESC);"</span><span class=cF0>
|
|
<a name="l144"></a> </span><span class=cF6>" Exit(,CH_ESC);"</span><span class=cF0>
|
|
<a name="l145"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l146"></a> </span><span class=cF6>"Play {"</span><span class=cF0>
|
|
<a name="l147"></a> </span><span class=cF6>" Restart(,'\n');"</span><span class=cF0>
|
|
<a name="l148"></a> </span><span class=cF6>" Step(,CH_SPACE);"</span><span class=cF0>
|
|
<a name="l149"></a> </span><span class=cF6>" Accelerator(,,SC_CURSOR_UP);"</span><span class=cF0>
|
|
<a name="l150"></a> </span><span class=cF6>" Break(,,SC_CURSOR_DOWN);"</span><span class=cF0>
|
|
<a name="l151"></a> </span><span class=cF6>" Left(,,SC_CURSOR_LEFT);"</span><span class=cF0>
|
|
<a name="l152"></a> </span><span class=cF6>" Right(,,SC_CURSOR_RIGHT);"</span><span class=cF0>
|
|
<a name="l153"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l154"></a> </span><span class=cF6>"Settings {"</span><span class=cF0>
|
|
<a name="l155"></a> </span><span class=cF6>" Color(,'c');"</span><span class=cF0>
|
|
<a name="l156"></a> </span><span class=cF6>" Wider(,'+');"</span><span class=cF0>
|
|
<a name="l157"></a> </span><span class=cF6>" Narrower(,'-');"</span><span class=cF0>
|
|
<a name="l158"></a> </span><span class=cF6>" Ends(,'e');"</span><span class=cF0>
|
|
<a name="l159"></a> </span><span class=cF6>" Layer0(,'0');"</span><span class=cF0>
|
|
<a name="l160"></a> </span><span class=cF6>" Layer1(,'1');"</span><span class=cF0>
|
|
<a name="l161"></a> </span><span class=cF6>" Layer2(,'2');"</span><span class=cF0>
|
|
<a name="l162"></a> </span><span class=cF6>" Layer3(,'3');"</span><span class=cF0>
|
|
<a name="l163"></a> </span><span class=cF6>" Layer4(,'4');"</span><span class=cF0>
|
|
<a name="l164"></a> </span><span class=cF6>" Layer5(,'5');"</span><span class=cF0>
|
|
<a name="l165"></a> </span><span class=cF6>" Layer6(,'6');"</span><span class=cF0>
|
|
<a name="l166"></a> </span><span class=cF6>" Layer7(,'7');"</span><span class=cF0>
|
|
<a name="l167"></a> </span><span class=cF6>" Layer8(,'8');"</span><span class=cF0>
|
|
<a name="l168"></a> </span><span class=cF6>" Layer9(,'9');"</span><span class=cF0>
|
|
<a name="l169"></a> </span><span class=cF6>"}"</span><span class=cF0>
|
|
<a name="l170"></a> );
|
|
<a name="l171"></a> </span><span class=cF5>SettingsPush</span><span class=cF0>; </span><span class=cF2>//See </span><a href="/Wb/Adam/TaskSettings.HC.HTML#l3"><span class=cF4>SettingsPush</span></a><span class=cF0>
|
|
<a name="l172"></a> </span><span class=cF5>AutoComplete</span><span class=cF0>;
|
|
<a name="l173"></a> </span><span class=cF5>WinBorder</span><span class=cF0>;
|
|
<a name="l174"></a> </span><span class=cF5>WinMax</span><span class=cF0>;
|
|
<a name="l175"></a> </span><span class=cF5>DocCursor</span><span class=cF0>;
|
|
<a name="l176"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
|
<a name="l177"></a> TurtleInit(&tt);
|
|
<a name="l178"></a> SetMenu;
|
|
<a name="l179"></a> </span><span class=cF5>Fs</span><span class=cF0>->win_inhibit=</span><span class=cF3>WIG_TASK_DFT</span><span class=cF0>-</span><span class=cF3>WIF_FOCUS_TASK_MENU</span><span class=cF0>
|
|
<a name="l180"></a> -</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="l181"></a> </span><span class=cF5>Fs</span><span class=cF0>->draw_it=&</span><span class=cF5>DrawIt</span><span class=cF0>;
|
|
<a name="l182"></a> </span><span class=cF1>try</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l183"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) {
|
|
<a name="l184"></a> </span><span class=cF1>switch</span><span class=cF0> (</span><span class=cF5>GetMsg</span><span class=cF7>(</span><span class=cF0>&arg1,&arg2,1<<</span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>|1<<</span><span class=cF3>MSG_MS_L_DOWN</span><span class=cF0>|
|
|
<a name="l185"></a> 1<<</span><span class=cF3>MSG_MS_R_DOWN</span><span class=cF0>|1<<</span><span class=cF3>MSG_MS_R_UP</span><span class=cF0>|1<<</span><span class=cF3>MSG_MS_MOVE</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l186"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_MS_L_DOWN</span><span class=cF0>:
|
|
<a name="l187"></a> tt.first=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l188"></a> tt.x=arg1;
|
|
<a name="l189"></a> tt.y=arg2;
|
|
<a name="l190"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l191"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_MS_R_DOWN</span><span class=cF0>:
|
|
<a name="l192"></a> aim=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l193"></a> tt.theta=</span><span class=cF5>Arg</span><span class=cF0>(arg1-tt.x,arg2-tt.y);
|
|
<a name="l194"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l195"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_MS_MOVE</span><span class=cF0>:
|
|
<a name="l196"></a> </span><span class=cF1>if</span><span class=cF0> (aim)
|
|
<a name="l197"></a> tt.theta=</span><span class=cF5>Arg</span><span class=cF0>(arg1-tt.x,arg2-tt.y);
|
|
<a name="l198"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l199"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_MS_R_UP</span><span class=cF0>:
|
|
<a name="l200"></a> tt.theta=</span><span class=cF5>Arg</span><span class=cF0>(arg1-tt.x,arg2-tt.y);
|
|
<a name="l201"></a> aim=</span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l202"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l203"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>:
|
|
<a name="l204"></a> </span><span class=cF1>switch</span><span class=cF0> (arg1) {
|
|
<a name="l205"></a> </span><span class=cF1>case</span><span class=cF0> 0:
|
|
<a name="l206"></a> </span><span class=cF1>switch</span><span class=cF0> (arg2.u8[0]) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l207"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_LEFT</span><span class=cF0>:
|
|
<a name="l208"></a> </span><span class=cF1>if</span><span class=cF0> (tt.dtheta_idx)
|
|
<a name="l209"></a> tt.dtheta_idx--;
|
|
<a name="l210"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l211"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_RIGHT</span><span class=cF0>:
|
|
<a name="l212"></a> </span><span class=cF1>if</span><span class=cF0> (tt.dtheta_idx<ANGLES-1)
|
|
<a name="l213"></a> tt.dtheta_idx++;
|
|
<a name="l214"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l215"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_UP</span><span class=cF0>:
|
|
<a name="l216"></a> tt.speed+=TURTLE_SPEED_STEP;
|
|
<a name="l217"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l218"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_DOWN</span><span class=cF0>:
|
|
<a name="l219"></a> </span><span class=cF1>if</span><span class=cF0> (tt.speed>=TURTLE_SPEED_STEP)
|
|
<a name="l220"></a> tt.speed-=TURTLE_SPEED_STEP;
|
|
<a name="l221"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l222"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l223"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l224"></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="l225"></a> tt.z=arg1-</span><span class=cF6>'0'</span><span class=cF0>;
|
|
<a name="l226"></a> SetMenu;
|
|
<a name="l227"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l228"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'c'</span><span class=cF0>:
|
|
<a name="l229"></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="l230"></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="l231"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l232"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'e'</span><span class=cF0>:
|
|
<a name="l233"></a> tt.ends=!tt.ends;
|
|
<a name="l234"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l235"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'+'</span><span class=cF0>:
|
|
<a name="l236"></a> tt.w++;
|
|
<a name="l237"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l238"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'-'</span><span class=cF0>:
|
|
<a name="l239"></a> </span><span class=cF1>if</span><span class=cF0> (tt.w)
|
|
<a name="l240"></a> tt.w--;
|
|
<a name="l241"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l242"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'\n'</span><span class=cF0>:
|
|
<a name="l243"></a> </span><span class=cF5>DCFill</span><span class=cF0>(dc);
|
|
<a name="l244"></a> TurtleInit(&tt);
|
|
<a name="l245"></a> SetMenu;
|
|
<a name="l246"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l247"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_ESC</span><span class=cF0>:
|
|
<a name="l248"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>:
|
|
<a name="l249"></a> </span><span class=cF1>goto</span><span class=cF0> lt_done;
|
|
<a name="l250"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SPACE</span><span class=cF0>:
|
|
<a name="l251"></a> TurtleMove(dc,&tt,tt.edge,tt.middle);
|
|
<a name="l252"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l253"></a> }
|
|
<a name="l254"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l255"></a> }
|
|
<a name="l256"></a>lt_done:
|
|
<a name="l257"></a> </span><span class=cF5>GetMsg</span><span class=cF0>(,,1<<</span><span class=cF3>MSG_KEY_UP</span><span class=cF0>);
|
|
<a name="l258"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>catch</span><span class=cF0>
|
|
<a name="l259"></a> </span><span class=cF5>PutExcept</span><span class=cF0>;
|
|
<a name="l260"></a> </span><span class=cF5>SettingsPop</span><span class=cF0>;
|
|
<a name="l261"></a> </span><span class=cF5>DCFill</span><span class=cF0>(dc);
|
|
<a name="l262"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc);
|
|
<a name="l263"></a> </span><span class=cF5>MenuPop</span><span class=cF0>;
|
|
<a name="l264"></a>}
|
|
<a name="l265"></a>
|
|
<a name="l266"></a>Lattice;
|
|
</span></pre></body>
|
|
</html>
|