hschumann2/TempleOS-Source-Code
0847
1 2U0 Main()3{4 I64 x1=0,y1=0,x2=0,y2=0,i=1,c=0;5 I64 vx1=0,vy1=0,vx2=0,vy2=0;6 CDC *dc=DCAlias;7 while (!ScanChar) {8 if (!--i) {9 i=1000;10 dc->color=c++&15;11 }12 GrLine(dc,x1,y1,x2,y2);13 vx1=ClampI64(vx1+SignI64(RandI16),-5,5);14 vy1=ClampI64(vy1+SignI64(RandI16),-5,5);15 vx2=ClampI64(vx2+SignI64(RandI16),-5,5);16 vy2=ClampI64(vy2+SignI64(RandI16),-5,5);17 x1=ClampI64(x1+vx1,0,Fs->pix_width-1);18 y1=ClampI64(y1+vy1,0,Fs->pix_height-1);19 x2=ClampI64(x2+vx2,0,Fs->pix_width-1);20 y2=ClampI64(y2+vy2,0,Fs->pix_height-1);21 Sleep(1); //Replace this with Yield() ort Sleep(0) and see what happens!22 }23 DCFill(dc);24 DCDel(dc);25}26 27Main;28 