/* »»»»»»»»» A Quiverful of Arrows »»»»»»»»»»»*/ if ~show('l', "rexxarplib.library") then do check = addlib('rexxsupport.library',0,-30,0) check = addlib('rexxarplib.library',0,-30,0) end /* In an emergency, run the program again, from CLI, with the additional argument C */ arg c if c="C" then do call CloseWindow(HOST2) ; exit end /*»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*/ address AREXX '"call CreateHost(HOST2, PORT2)"' if ~show('Ports','HOST2') then address command 'WaitForPort HOST2' idcmp = 'CLOSEWINDOW+MOUSEBUTTONS+GADGETUP+VANILLAKEY' flags = '' ; call ArpWindow(0,0,640,240) call pin(10,20,"The arrow drawn 4 times by 4 separate function calls.") call Relative(150,70,33,-17,0,-34,0,-21,-87,-21,-87,-13,0,-13,0,0) call Relative(200,100,33,-17,0,-34,0,-21,-87,-21,-87,-13,0,-13,0,0) call Relative(250,130,33,-17,0,-34,0,-21,-87,-21,-87,-13,0,-13,0,0) call Relative(300,160,33,-17,0,-34,0,-21,-87,-21,-87,-13,0,-13,0,0) call Click(0) call pin(10,160,"And a trivial border motif repeated in a loop.") do b = 10 to 570 by 30 call Relative(b,180,16,8,79,0) end call Click(1) call pin(10,20, "Here is the arrow flipped right to left by reversing the") call pin(10,30, "sign of the x coordinates, as described in the article.") call Relative(200,80,-33,-17, 0,-34, 0,-21, 87,-21, 87,-13, 0,-13, 0,0) call Click(0) call pin(10,100, "and a filled in version, just for fun (Flood may not") call pin(10,110,"work well if you have an earlier version of the library).") call Relative(300,160,-33,-17, 0,-34, 0,-21, 87,-21, 87,-13, 0,-13, 0,0) call col(2) ; call Flood(HOST2,1,296,142) ; call col(1) call Click(1) call pin(10,20,"A Moving Experience : The little shape used in the border") call pin(10,30,"can be made to move, not very smoothly, and it isn't really") call pin(10,40,"fair to ask a non-compiled program to do things like this.") do b = 100 to 300 by 12 call col(2) ; call Relative(b,60,16,8,79,0) call col(0) ; call Relative(b,60,16,8,79,0) end call Click(0) call pin(10,80,"And a Growth Point :") do b = 100 to 300 by 10 call col(1) ; call Relative(100,100,b,20,0,40,0) call col(3) ; call Relative(100,100,b,20,0,40,0) end call col(1) ; call Relative(100,100,b,20,0,40,0) call Click(1) call CloseWindow(HOST2) call closeport(PORT2) exit /*»»»»»»»»»»»»»»»»*/ Relative: numargs = arg() ; npairs = numargs%2 Sx = arg(1) ; Sy = arg(2) ; call Move(HOST2,Sx,Sy) do i = 2 to npairs dx = arg(i*2 - 1) ; dy = arg(i*2) call Draw(HOST2,Sx+dx, Sy+dy) end return /*»»»»»»»»»»»»»»»»*/ ArpWindow: parse arg left,top,width,height call OpenWindow(HOST2,left,top,width,height, idcmp, flags) call openport(PORT2) call Col(1) call SetReqColor(HOST2,BOXPEN,2) ; call SetReqColor(HOST2,SHADOWPEN,1) call ActivateWindow(HOST2) return /*»»»»»»»»»»»»»»»»*/ Click: clear = arg(1) call AddGadget(HOST2,200,200,1," Click here ","C") do forever call waitpkt(PORT2) ; p = getpkt(PORT2) if p ~==NULL() then do thisarg = getarg(p) ; t = reply(p, 0) if UPPER(thisarg) = "C" then leave end end call RemoveGadget(HOST2,1) if clear then call ClearScreen() else do call col(0) ; call RectFill(HOST2,198,198,318,210) call col(1) end return /*»»»»»»»»»»»»»»»»*/ pin: call Move(HOST2,arg(1),arg(2)) ; call Text(HOST2,arg(3)) return /*»»»»»»»»»»»»»»»»*/ ClearScreen: call col(0) ; call RectFill(HOST2,4,2,634,230) ; call col(1) return /*»»»»»»»»»»»»»»»»*/ col: call SetAPen(HOST2,arg(1)) return