`$;]A8dpu}W>SmmmƁD48H$;]A8dpu}W>SmmmƁD48H P2TvͫgE#ͼxV4w pxxpx   pxxpx :3 32   . .       F  KGC@@@@@@@ABCDEFGGHIIJKKLMNOOO  Fbd dgDDDDDDDDDDDDDDDD $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $   30?!.!!!.!."."""""..".""."..""""2#.>."2.3.....>232>2#>3>>33>>>3>>>>>>>>>33343>3333ND3>4DN4C44C>CDNDNNNNDNNDDNNNDNNNDNNNNNNNDENNEDTDNDNDNݙ^UTݙEUUTݝ^Nݝ^ݝ^UUݙ^ݝU^ݙݝݙUUUU^^^UU^^nfUffVn^ffenfnnnnfnffffnnnnnfnnfnfnnfnnngn~~~n~n~nfn~w~~gnwwgn~~n~~~~w~ꪪ~wwww~鞞鞞莎~~w~ξ鉎ww~~μꮮ莇~w~w~~~ꮪꞮ莎xw~~̻ꫪꪮ鞞ww~~~˼뾾ꪮ陞~w~ꮙ舎xx~wξ뻻Ꞟ鞙陉~骙鞞鉉--- title: Doodle App -- author: LucasM -- desc: A doodle app demonstrating mouse handling events -- license: MIT License -- version: 0.1 -- script: lua -------------------------------------------------------- function BOOT() tl=0 -- tl_1=0 col=2 draw_mode=0 x_prev,y_prev=mouse() -- init for prev mouse pos cls(14) end -------------------------------------------------------- function mouseClick() --pulse 'true' for mouse release input mx,my,ml,mm,mr,msx,msy=mouse() if ml_prev==true and ml==false then ml_click=true else ml_click=false end if mr_prev==true and mr==false then mr_click=true else mr_click=false end if mm_prev==true and mm==false then mm_click=true else mm_click=false end ml_prev=ml ; mr_prev=mr ; mm_prev=mm return ml_click, mr_click, mm_click end -------------------------------------------------------- function OVR() -- tool icon toox=4 ; tooy=116 rect(toox+2,tooy+2,11,11,14) spr(270,toox,tooy,0,1,0,0,2,2) spr(258+draw_mode,toox+4,tooy+4,0,1,0,0,1,1) if mx>toox-1 and mxtooy-1 and myswax-1 and mxsway-1 and mybinx-2 and mxbiny-2 and my237 then mx=237 end if my==251 then my=0 end ; if my>133 then my=133 end -- touch/mouse_only controls if (too_ovr and mlc) then draw_mode=draw_mode+1 end -- cycle draw mode if (swa_ovr and mlc) then col=col+1 end -- scroll through colour if (bin_ovr and mlc) then cls(14) end -- clear the board --computer controls if mmc then cls(14) end if msy>0 then col=col+1 end if msy<0 then col=col-1 end if mrc then draw_mode=draw_mode+1 end --cycle draw mode & colour pallete values if draw_mode>5 then draw_mode=0 end if col>13 then col=1 elseif col<1 then col=13 end -- drawing functions if not gui_ovr then -- avoid drawing under icons if ml then tl=tl+1 else tl=0 end -- line brush if tl>1 and draw_mode==0 then line(x_prev,y_prev,mx,my,col) end -- thick line brush if tl>1 and draw_mode==1 then for i=-1,1 do line(x_prev+i,y_prev,mx+i,my,col) line(x_prev,y_prev+i,mx,my+i,col) end end -- xl brush if tl>1 and draw_mode==2 then circ(mx,my,10,col) end -- spray brush if tl>1 and draw_mode==3 then for i=0,2 do x=mx+math.random(-4,4) y=my+math.random(-4,4) pix(x,y,col) end end -- sm eraser if tl>1 and draw_mode==4 then circ(mx,my,3,14) end -- big eraser if tl>1 and draw_mode==5 then circ(mx,my,8,14) end end -- update previous mouse value x_prev=mx y_prev=my end