' PROG Draco $INCLUDE "rapidq.inc" $TYPECHECK on '''----Event driven Sub Routines DECLARE SUB Init ' ~~~~~General purpose variables~~~~~~~~~~ DEFSTR n$, i$ ' working string DEFBYTE n?, i? ' working byte 1 00 FF DEFWORD n??,i?? ' working word 2 0000 FFFF DEFINT n&, i& ' working integer 4 -2147483648..2147483647 DEFSNG n, i ' working variable 4 big DEFDBL n#, i# ' working doubleword 8 bigger DEFSNG rad = 3.1415927/180 ' to convert to radians ' ~~~~~House-keeping variables~~~~~~~~~~ DEFSNG Formcol = &HC0C0C0 DEFSNG BUMPcol = &H000000 ' ~~~~~~Draw function parms~~~~~~ DEFSNG x1,y1,x2,y2 ' absissa & ordinate '''~~~~~~~~~~~~~~~~~~~~ Create Objects ~~~~~~~~~~~~~~~~~~~ '''-----main picture bitmap DIM Bump as QBITMAP Bump.width = 800: Bump.height = 600 Bump.fillrect(0,0,800,600,BUMPcol) '''-----Entire form DIM Form as QForm Form.top = 0 : Form.left = 0 Form.width = 800 : Form.height = 600 Form.Color =Formcol: Form.borderstyle=1 '''-----Timer for initalization DIM Irig as QTIMER Irig.interval= 100: Irig.OnTimer= Init '''----- Initalize and Wait for an event Form.showmodal END ''' Sub Routine '''-----Timer driven Initalization Sub ~~~~~~~~~ SUB init Form.Draw (0,0,bump.bmp) ' clear picture Irig.OnTimer= 0 '''-----Draw Module generate fold template ~~~~~~~~~ i$="R" for i= 1 to 13: i$=i$+"R" ''''' For each Order for n= len(i$)-1 to 1 step -1 ''''' For each fold n$= mid$(i$,n,1) if n$="R" then i$=i$+"L" if n$="L" then i$=i$+"R" next n ''''' Next fold next i ''''' Next Order '''-----Draw Module generate each vector ~~~~~~~~~ x1=610: y1=200: x2=610: y2=200: i??=4 for n=0 to len(i$): n$= mid$(i$,n,1) '''' For each vector i??= i?? + (n$="L") - (n$="R") if i??<1 then i??=4 if i??>4 then i??=1 '''-----Draw Module generate draw vector ~~~~~~~~~ if i??= 2 then x2=x1+4 if i??= 3 then y2=y1+4 if i??= 4 then x2=x1-4 if i??= 1 then y2=y1-4 '''-----Draw Module draw on form and into bitmap ~~~~~~~~~ Form.line(x1,y1,x2,y2,&HFFFFFF) Bump.line(x1,y1,x2,y2,&HFFFFFF) x1=x2: y1=y2 next n '''' Next vector '''-----Save bitmap ~~~~~~~~~ Bump.SaveToFile ("Draco.bmp") END SUB '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ KALAS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~