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

358 lines
25 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>//This is a whimsical program which demonstrates some techniques.</span><span class=cF0>
<a name="l2"></a>
<a name="l3"></a>#</span><span class=cF1>define</span><span class=cF0> BORDER 20
<a name="l4"></a>
<a name="l5"></a>#</span><span class=cF1>define</span><span class=cF0> PTY_PT 0
<a name="l6"></a>#</span><span class=cF1>define</span><span class=cF0> PTY_CIRCLE 1
<a name="l7"></a>#</span><span class=cF1>define</span><span class=cF0> PTY_LINE 2
<a name="l8"></a>#</span><span class=cF1>define</span><span class=cF0> PTY_SPRITE 3
<a name="l9"></a>#</span><span class=cF1>define</span><span class=cF0> PTY_NUM 4
<a name="l10"></a>
<a name="l11"></a></span><span class=cF1>extern</span><span class=cF0> </span><span class=cF1>class</span><span class=cF0> PObj;
<a name="l12"></a>
<a name="l13"></a></span><span class=cF1>class</span><span class=cF0> PPt
<a name="l14"></a>{
<a name="l15"></a> </span><span class=cF9>CD3I32</span><span class=cF0> p;
<a name="l16"></a>};
<a name="l17"></a>
<a name="l18"></a></span><span class=cF1>class</span><span class=cF0> PCircle
<a name="l19"></a>{
<a name="l20"></a> PObj *p;
<a name="l21"></a> </span><span class=cF9>I64</span><span class=cF0> radius;
<a name="l22"></a>};
<a name="l23"></a>
<a name="l24"></a></span><span class=cF1>class</span><span class=cF0> PLine
<a name="l25"></a>{
<a name="l26"></a> PObj *p1,*p2;
<a name="l27"></a>};
<a name="l28"></a>
<a name="l29"></a></span><span class=cF1>class</span><span class=cF0> PCSprite
<a name="l30"></a>{
<a name="l31"></a> PObj *p;
<a name="l32"></a> </span><span class=cF1>U8</span><span class=cF0> *img;
<a name="l33"></a> </span><span class=cF9>I64</span><span class=cF0> *r,
<a name="l34"></a> *dr; </span><span class=cF2>//Rounding error might eventually screw this up</span><span class=cF0>
<a name="l35"></a>}
<a name="l36"></a>
<a name="l37"></a></span><span class=cF1>class</span><span class=cF0> PObj
<a name="l38"></a>{
<a name="l39"></a> PObj *next,*last;
<a name="l40"></a> </span><span class=cF9>I64</span><span class=cF0> type,color;
<a name="l41"></a> </span><span class=cF1>union</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l42"></a> PPt p;
<a name="l43"></a> PCircle c;
<a name="l44"></a> PLine l;
<a name="l45"></a> PCSprite g;
<a name="l46"></a> </span><span class=cF7>}</span><span class=cF0>;
<a name="l47"></a>};
<a name="l48"></a>
<a name="l49"></a></span><span class=cF1>class</span><span class=cF0> PickFrame
<a name="l50"></a>{
<a name="l51"></a> PObj o_head;
<a name="l52"></a> </span><span class=cF9>I64</span><span class=cF0> o_cnts[PTY_NUM];
<a name="l53"></a> </span><span class=cF9>I64</span><span class=cF0> cx,cy;
<a name="l54"></a>};
<a name="l55"></a>
<a name="l56"></a>#</span><span class=cF1>define</span><span class=cF0> IMGS_NUM 3
<a name="l57"></a>
<a name="l58"></a>
<a name="l59"></a>
<a name="l60"></a> </span><span class=cFA>&lt;1&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l61"></a>
<a name="l62"></a>
<a name="l63"></a>
<a name="l64"></a> </span><span class=cFA>&lt;2&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l65"></a>
<a name="l66"></a>
<a name="l67"></a>
<a name="l68"></a>
<a name="l69"></a> </span><span class=cFA>&lt;3&gt;/* Graphics Not Rendered in HTML */</span><span class=cF0>
<a name="l70"></a>
<a name="l71"></a>
<a name="l72"></a></span><span class=cF1>U8</span><span class=cF0> *imgs[IMGS_NUM]={</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>};
<a name="l73"></a>
<a name="l74"></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> *task,</span><span class=cF9>CDC</span><span class=cF0> *dc)
<a name="l75"></a>{
<a name="l76"></a> </span><span class=cF9>I64</span><span class=cF0> *r,*old_r;
<a name="l77"></a> PickFrame *pf=</span><span class=cF5>FramePtr</span><span class=cF0>(</span><span class=cF6>&quot;PickFrame&quot;</span><span class=cF0>,task);
<a name="l78"></a> PObj *tmpo=pf-&gt;o_head.next;
<a name="l79"></a>
<a name="l80"></a> pf-&gt;cx=task-&gt;pix_width&gt;&gt;1;
<a name="l81"></a> pf-&gt;cy=task-&gt;pix_height&gt;&gt;1;
<a name="l82"></a>
<a name="l83"></a> </span><span class=cF5>DCDepthBufAlloc</span><span class=cF0>(dc);
<a name="l84"></a>
<a name="l85"></a> dc-&gt;color=</span><span class=cF3>LTRED</span><span class=cF0>;
<a name="l86"></a> dc-&gt;thick=3;
<a name="l87"></a> </span><span class=cF5>GrBorder</span><span class=cF0>(dc,BORDER,BORDER,2*pf-&gt;cx-BORDER,2*pf-&gt;cy-BORDER);
<a name="l88"></a>
<a name="l89"></a> </span><span class=cF1>while</span><span class=cF0> (tmpo!=&amp;pf-&gt;o_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l90"></a> dc-&gt;color=tmpo-&gt;color;
<a name="l91"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpo-&gt;type) {
<a name="l92"></a> </span><span class=cF1>case</span><span class=cF0> PTY_PT:
<a name="l93"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,pf-&gt;cx+tmpo-&gt;p.p.x+2,pf-&gt;cy+tmpo-&gt;p.p.y+2,
<a name="l94"></a> pf-&gt;cx+tmpo-&gt;p.p.x-2,pf-&gt;cy+tmpo-&gt;p.p.y-2);
<a name="l95"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,pf-&gt;cx+tmpo-&gt;p.p.x-2,pf-&gt;cy+tmpo-&gt;p.p.y+2,
<a name="l96"></a> pf-&gt;cx+tmpo-&gt;p.p.x+2,pf-&gt;cy+tmpo-&gt;p.p.y-2);
<a name="l97"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l98"></a> </span><span class=cF1>case</span><span class=cF0> PTY_CIRCLE:
<a name="l99"></a> </span><span class=cF5>GrCircle</span><span class=cF0>(dc,pf-&gt;cx+tmpo-&gt;c.p-&gt;p.p.x,pf-&gt;cy+tmpo-&gt;c.p-&gt;p.p.y,
<a name="l100"></a> tmpo-&gt;c.radius);
<a name="l101"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l102"></a> </span><span class=cF1>case</span><span class=cF0> PTY_LINE:
<a name="l103"></a> </span><span class=cF5>GrLine</span><span class=cF0>(dc,pf-&gt;cx+tmpo-&gt;l.p1-&gt;p.p.x,pf-&gt;cy+tmpo-&gt;l.p1-&gt;p.p.y,
<a name="l104"></a> pf-&gt;cx+tmpo-&gt;l.p2-&gt;p.p.x,pf-&gt;cy+tmpo-&gt;l.p2-&gt;p.p.y);
<a name="l105"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l106"></a> </span><span class=cF1>case</span><span class=cF0> PTY_SPRITE:
<a name="l107"></a> old_r=dc-&gt;r;
<a name="l108"></a> dc-&gt;r=tmpo-&gt;g.r;
<a name="l109"></a> dc-&gt;x=pf-&gt;cx+tmpo-&gt;g.p-&gt;p.p.x;
<a name="l110"></a> dc-&gt;y=pf-&gt;cy+tmpo-&gt;g.p-&gt;p.p.y;
<a name="l111"></a> dc-&gt;z=</span><span class=cF3>GR_Z_ALL</span><span class=cF0>;
<a name="l112"></a> dc-&gt;flags|=</span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
<a name="l113"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc,0,0,0,tmpo-&gt;g.img);
<a name="l114"></a> dc-&gt;flags&amp;=~</span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
<a name="l115"></a> dc-&gt;r=old_r;
<a name="l116"></a>
<a name="l117"></a> </span><span class=cF2>//Updated each refresh, not guarenteed to be uniform.</span><span class=cF0>
<a name="l118"></a> </span><span class=cF2>//Rounding error might corrupt, as well.</span><span class=cF0>
<a name="l119"></a> r=</span><span class=cF5>Mat4x4MulMat4x4New</span><span class=cF0>(tmpo-&gt;g.dr,tmpo-&gt;g.r,task);
<a name="l120"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpo-&gt;g.r);
<a name="l121"></a> tmpo-&gt;g.r=r;
<a name="l122"></a>
<a name="l123"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l124"></a> }
<a name="l125"></a> tmpo=tmpo-&gt;next;
<a name="l126"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l127"></a>}
<a name="l128"></a>
<a name="l129"></a>PObj *PObjNew(PickFrame *pf,</span><span class=cF9>I64</span><span class=cF0> type,</span><span class=cF9>I64</span><span class=cF0> color)
<a name="l130"></a>{
<a name="l131"></a> PObj *tmpo=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>PObj</span><span class=cF7>)</span><span class=cF0>);
<a name="l132"></a> tmpo-&gt;type=type;
<a name="l133"></a> tmpo-&gt;color=color;
<a name="l134"></a> pf-&gt;o_cnts[type]++;
<a name="l135"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpo,pf-&gt;o_head.last);
<a name="l136"></a> </span><span class=cF1>return</span><span class=cF0> tmpo;
<a name="l137"></a>}
<a name="l138"></a>
<a name="l139"></a></span><span class=cF1>U0</span><span class=cF0> PObjDel(PickFrame *pf,PObj *tmpo)
<a name="l140"></a>{
<a name="l141"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmpo);
<a name="l142"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpo-&gt;type) </span><span class=cF7>{</span><span class=cF0>
<a name="l143"></a> </span><span class=cF1>case</span><span class=cF0> PTY_SPRITE:
<a name="l144"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpo-&gt;g.r);
<a name="l145"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpo-&gt;g.dr);
<a name="l146"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l147"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l148"></a> pf-&gt;o_cnts[tmpo-&gt;type]--;
<a name="l149"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpo);
<a name="l150"></a>}
<a name="l151"></a>
<a name="l152"></a>PObj *PPtNew(PickFrame *pf,</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> y)
<a name="l153"></a>{
<a name="l154"></a> PObj *tmpo=PObjNew(pf,PTY_PT,</span><span class=cF3>BLACK</span><span class=cF0>);
<a name="l155"></a> tmpo-&gt;p.p.x=x;
<a name="l156"></a> tmpo-&gt;p.p.y=y;
<a name="l157"></a> </span><span class=cF1>return</span><span class=cF0> tmpo;
<a name="l158"></a>}
<a name="l159"></a>
<a name="l160"></a>PObj *PPtNum(PickFrame *pf,</span><span class=cF9>I64</span><span class=cF0> num)
<a name="l161"></a>{
<a name="l162"></a> PObj *tmpo=pf-&gt;o_head.next;
<a name="l163"></a> </span><span class=cF1>while</span><span class=cF0> (tmpo!=&amp;pf-&gt;o_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l164"></a> </span><span class=cF1>if</span><span class=cF0> (tmpo-&gt;type==PTY_PT &amp;&amp; !num--)
<a name="l165"></a> </span><span class=cF1>return</span><span class=cF0> tmpo;
<a name="l166"></a> tmpo=tmpo-&gt;next;
<a name="l167"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l168"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l169"></a>}
<a name="l170"></a>
<a name="l171"></a>PObj *PPtFind(PickFrame *pf,</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> y)
<a name="l172"></a>{
<a name="l173"></a> </span><span class=cF9>I64</span><span class=cF0> dd,best_dd=</span><span class=cF3>I64_MAX</span><span class=cF0>;
<a name="l174"></a> PObj *tmpo=pf-&gt;o_head.next,*res=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l175"></a> </span><span class=cF1>while</span><span class=cF0> (tmpo!=&amp;pf-&gt;o_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l176"></a> </span><span class=cF1>if</span><span class=cF0> (tmpo-&gt;type==PTY_PT) {
<a name="l177"></a> dd=</span><span class=cF5>SqrI64</span><span class=cF0>(tmpo-&gt;p.p.x-x)+</span><span class=cF5>SqrI64</span><span class=cF0>(tmpo-&gt;p.p.y-y);
<a name="l178"></a> </span><span class=cF1>if</span><span class=cF0> (dd&lt;best_dd) </span><span class=cF7>{</span><span class=cF0>
<a name="l179"></a> best_dd=dd;
<a name="l180"></a> res=tmpo;
<a name="l181"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l182"></a> }
<a name="l183"></a> tmpo=tmpo-&gt;next;
<a name="l184"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l185"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l186"></a>}
<a name="l187"></a>
<a name="l188"></a>PObj *PCircleNew(PickFrame *pf,</span><span class=cF9>I64</span><span class=cF0> p_num,</span><span class=cF9>I64</span><span class=cF0> r)
<a name="l189"></a>{
<a name="l190"></a> PObj *tmpo=PObjNew(pf,PTY_CIRCLE,</span><span class=cF3>RED</span><span class=cF0>);
<a name="l191"></a> tmpo-&gt;c.p=PPtNum(pf,p_num);
<a name="l192"></a> tmpo-&gt;c.radius=r;
<a name="l193"></a> </span><span class=cF1>return</span><span class=cF0> tmpo;
<a name="l194"></a>}
<a name="l195"></a>
<a name="l196"></a>PObj *PLineNew(PickFrame *pf,</span><span class=cF9>I64</span><span class=cF0> p1_num,</span><span class=cF9>I64</span><span class=cF0> p2_num)
<a name="l197"></a>{
<a name="l198"></a> PObj *tmpo=PObjNew(pf,PTY_LINE,</span><span class=cF3>GREEN</span><span class=cF0>);
<a name="l199"></a> tmpo-&gt;l.p1=PPtNum(pf,p1_num);
<a name="l200"></a> tmpo-&gt;l.p2=PPtNum(pf,p2_num);
<a name="l201"></a> </span><span class=cF1>return</span><span class=cF0> tmpo;
<a name="l202"></a>}
<a name="l203"></a>
<a name="l204"></a>PObj *PCSpriteNew(PickFrame *pf,</span><span class=cF1>U8</span><span class=cF0> *img,</span><span class=cF9>I64</span><span class=cF0> p_num,</span><span class=cF9>I64</span><span class=cF0> *r,</span><span class=cF9>I64</span><span class=cF0> *dr)
<a name="l205"></a>{
<a name="l206"></a> PObj *tmpo=PObjNew(pf,PTY_SPRITE,</span><span class=cF3>BLACK</span><span class=cF0>);
<a name="l207"></a> tmpo-&gt;g.p=PPtNum(pf,p_num);
<a name="l208"></a> tmpo-&gt;g.img=img;
<a name="l209"></a> tmpo-&gt;g.r=r;
<a name="l210"></a> tmpo-&gt;g.dr=dr;
<a name="l211"></a> </span><span class=cF1>return</span><span class=cF0> tmpo;
<a name="l212"></a>}
<a name="l213"></a>
<a name="l214"></a>PickFrame *Init()
<a name="l215"></a>{
<a name="l216"></a> PickFrame *pf=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>PickFrame</span><span class=cF7>)</span><span class=cF0>);
<a name="l217"></a> </span><span class=cF9>I64</span><span class=cF0> i,*r,*dr;
<a name="l218"></a>
<a name="l219"></a> pf-&gt;cx=</span><span class=cF5>Fs</span><span class=cF0>-&gt;pix_width&gt;&gt;1;
<a name="l220"></a> pf-&gt;cy=</span><span class=cF5>Fs</span><span class=cF0>-&gt;pix_height&gt;&gt;1;
<a name="l221"></a>
<a name="l222"></a> pf-&gt;o_head.next=pf-&gt;o_head.last=&amp;pf-&gt;o_head;
<a name="l223"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;50;i++)
<a name="l224"></a> PPtNew(pf,</span><span class=cF5>RandI32</span><span class=cF0>%</span><span class=cF7>(</span><span class=cF0>pf-&gt;cx-BORDER</span><span class=cF7>)</span><span class=cF0>,</span><span class=cF5>RandI32</span><span class=cF0>%</span><span class=cF7>(</span><span class=cF0>pf-&gt;cy-BORDER</span><span class=cF7>)</span><span class=cF0>);
<a name="l225"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;20;i++)
<a name="l226"></a> PCircleNew(pf,pf-&gt;o_cnts[PTY_PT]*</span><span class=cF5>RandU16</span><span class=cF0>/</span><span class=cF3>U16_MAX</span><span class=cF0>,6);
<a name="l227"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;20;i++)
<a name="l228"></a> PLineNew(pf,pf-&gt;o_cnts[PTY_PT]*</span><span class=cF5>RandU16</span><span class=cF0>/</span><span class=cF3>U16_MAX</span><span class=cF0>,
<a name="l229"></a> pf-&gt;o_cnts[PTY_PT]*</span><span class=cF5>RandU16</span><span class=cF0>/</span><span class=cF3>U16_MAX</span><span class=cF0>);
<a name="l230"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;10;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l231"></a> r=</span><span class=cF5>Mat4x4IdentNew</span><span class=cF0>;
<a name="l232"></a> dr=</span><span class=cF5>Mat4x4IdentNew</span><span class=cF0>;
<a name="l233"></a> </span><span class=cF5>Mat4x4RotZ</span><span class=cF0>(dr,0.05*2*</span><span class=cF7>(</span><span class=cF5>Rand</span><span class=cF0>-0.5</span><span class=cF7>)</span><span class=cF0>);
<a name="l234"></a> </span><span class=cF5>Mat4x4RotY</span><span class=cF0>(dr,0.05*2*</span><span class=cF7>(</span><span class=cF5>Rand</span><span class=cF0>-0.5</span><span class=cF7>)</span><span class=cF0>);
<a name="l235"></a> </span><span class=cF5>Mat4x4RotX</span><span class=cF0>(dr,0.05*2*</span><span class=cF7>(</span><span class=cF5>Rand</span><span class=cF0>-0.5</span><span class=cF7>)</span><span class=cF0>);
<a name="l236"></a> PCSpriteNew(pf,imgs[IMGS_NUM*</span><span class=cF5>RandU16</span><span class=cF0>/</span><span class=cF3>U16_MAX</span><span class=cF0>],
<a name="l237"></a> pf-&gt;o_cnts[PTY_PT]*</span><span class=cF5>RandU16</span><span class=cF0>/</span><span class=cF3>U16_MAX</span><span class=cF0>,r,dr);
<a name="l238"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l239"></a> </span><span class=cF5>FramePtrSet</span><span class=cF0>(</span><span class=cF6>&quot;PickFrame&quot;</span><span class=cF0>,pf);
<a name="l240"></a> </span><span class=cF1>return</span><span class=cF0> pf;
<a name="l241"></a>}
<a name="l242"></a>
<a name="l243"></a></span><span class=cF1>U0</span><span class=cF0> CleanUp(PickFrame *pf)
<a name="l244"></a>{
<a name="l245"></a> PObj *tmpo=pf-&gt;o_head.next,*tmpo1;
<a name="l246"></a> </span><span class=cF1>while</span><span class=cF0> (tmpo!=&amp;pf-&gt;o_head) </span><span class=cF7>{</span><span class=cF0>
<a name="l247"></a> tmpo1=tmpo-&gt;next;
<a name="l248"></a> PObjDel(pf,tmpo);
<a name="l249"></a> tmpo=tmpo1;
<a name="l250"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l251"></a> </span><span class=cF5>Free</span><span class=cF0>(pf);
<a name="l252"></a>}
<a name="l253"></a>
<a name="l254"></a></span><span class=cF1>U0</span><span class=cF0> Pick3D()
<a name="l255"></a>{
<a name="l256"></a> </span><span class=cF9>I64</span><span class=cF0> msg_code,arg1,arg2;
<a name="l257"></a> PObj *tmpo;
<a name="l258"></a> PickFrame *pf=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l259"></a>
<a name="l260"></a> </span><span class=cF5>FramePtrAdd</span><span class=cF0>(</span><span class=cF6>&quot;PickFrame&quot;</span><span class=cF0>);
<a name="l261"></a>
<a name="l262"></a> </span><span class=cF5>MenuPush</span><span class=cF0>(
<a name="l263"></a> </span><span class=cF6>&quot;File {&quot;</span><span class=cF0>
<a name="l264"></a> </span><span class=cF6>&quot; Abort(,CH_SHIFT_ESC);&quot;</span><span class=cF0>
<a name="l265"></a> </span><span class=cF6>&quot; Exit(,CH_ESC);&quot;</span><span class=cF0>
<a name="l266"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l267"></a> </span><span class=cF6>&quot;Play {&quot;</span><span class=cF0>
<a name="l268"></a> </span><span class=cF6>&quot; Restart(,'\n');&quot;</span><span class=cF0>
<a name="l269"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l270"></a> );
<a name="l271"></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="l272"></a> </span><span class=cF5>AutoComplete</span><span class=cF0>;
<a name="l273"></a> </span><span class=cF5>WinBorder</span><span class=cF0>;
<a name="l274"></a> </span><span class=cF5>WinMax</span><span class=cF0>;
<a name="l275"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
<a name="l276"></a> </span><span class=cF6>&quot;$BK,1$Move things around.$BK,0$\n&quot;</span><span class=cF0>;
<a name="l277"></a> pf=Init;
<a name="l278"></a> tmpo=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l279"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;win_inhibit=</span><span class=cF3>WIG_TASK_DFT</span><span class=cF0>-</span><span class=cF3>WIF_SELF_FOCUS</span><span class=cF0>
<a name="l280"></a> -</span><span class=cF3>WIF_SELF_CTRLS</span><span class=cF0>-</span><span class=cF3>WIF_FOCUS_TASK_MENU</span><span class=cF0>;
<a name="l281"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;draw_it=&amp;</span><span class=cF5>DrawIt</span><span class=cF0>;
<a name="l282"></a> </span><span class=cF1>try</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l283"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) {
<a name="l284"></a> </span><span class=cF1>switch</span><span class=cF0> (msg_code=</span><span class=cF5>GetMsg</span><span class=cF7>(</span><span class=cF0>&amp;arg1,&amp;arg2,
<a name="l285"></a> 1&lt;&lt;</span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_MS_L_DOWN</span><span class=cF0>|1&lt;&lt;</span><span class=cF3>MSG_MS_L_UP</span><span class=cF0>|1&lt;&lt;</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="l286"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>:
<a name="l287"></a> </span><span class=cF1>switch</span><span class=cF0> (arg1) {
<a name="l288"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'\n'</span><span class=cF0>:
<a name="l289"></a> CleanUp(pf);
<a name="l290"></a> pf=Init;
<a name="l291"></a> tmpo=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l292"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l293"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>:
<a name="l294"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_ESC</span><span class=cF0>:
<a name="l295"></a> </span><span class=cF1>goto</span><span class=cF0> pd_done;
<a name="l296"></a> }
<a name="l297"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l298"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_MS_L_DOWN</span><span class=cF0>:
<a name="l299"></a> tmpo=PPtFind(pf,arg1-pf-&gt;cx,arg2-pf-&gt;cy);
<a name="l300"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l301"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_MS_L_UP</span><span class=cF0>:
<a name="l302"></a> </span><span class=cF1>if</span><span class=cF0> (tmpo) {
<a name="l303"></a> tmpo-&gt;p.p.x=arg1-pf-&gt;cx;
<a name="l304"></a> tmpo-&gt;p.p.y=arg2-pf-&gt;cy;
<a name="l305"></a> tmpo=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l306"></a> }
<a name="l307"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l308"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_MS_MOVE</span><span class=cF0>:
<a name="l309"></a> </span><span class=cF1>if</span><span class=cF0> (tmpo) {
<a name="l310"></a> tmpo-&gt;p.p.x=arg1-pf-&gt;cx;
<a name="l311"></a> tmpo-&gt;p.p.y=arg2-pf-&gt;cy;
<a name="l312"></a> }
<a name="l313"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l314"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l315"></a> }
<a name="l316"></a>pd_done:
<a name="l317"></a> </span><span class=cF5>GetMsg</span><span class=cF0>(,,1&lt;&lt;</span><span class=cF3>MSG_KEY_UP</span><span class=cF0>);
<a name="l318"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>catch</span><span class=cF0>
<a name="l319"></a> </span><span class=cF5>PutExcept</span><span class=cF0>;
<a name="l320"></a> </span><span class=cF5>SettingsPop</span><span class=cF0>;
<a name="l321"></a> </span><span class=cF5>MenuPop</span><span class=cF0>;
<a name="l322"></a> CleanUp(pf);
<a name="l323"></a> </span><span class=cF5>FramePtrDel</span><span class=cF0>(</span><span class=cF6>&quot;PickFrame&quot;</span><span class=cF0>);
<a name="l324"></a>}
<a name="l325"></a>
<a name="l326"></a>Pick3D;
</span></pre></body>
</html>