| |
|
|
HofK | Update on new Syntax on the 10.04.2016:
Gesten evaluate/ directions discern
// directions for Gesten p=0 // index position Separator in xg, yg tg = -1 // Nr. Teilgeste xg="" yg="" xge=[] yge=[] // part-Geste: Strings, Gestenfelder xp=[0] yp=[0] // positions p Trennz ; in Strings xg, yg ix=0 iy=0 dx=0 dy=0 // Coordinates, differences var rtg =[ // z ["\u21d8" "\u21d7" "\u21d2"] // 0 to right ["\u21d9" "\u21d6" "\u21d0"] // 1 to left ["\u21d3" "\u21d1" "\u2299"] // 2 Mouse and Sprite, stood still ] // Matrix the Richtungssymbole //s 0 1 2 // down high horizontal print "direction of Gesten"
proc event id data global p tg xg xge yg yge xp yp case id==event.touchdown : gekoord data.x data.y // Koord. take in case id==event.touchmove : gekoord data.x data.y // Koord. take in if id==event.touchend tg++ // Nr. the Teilgeste raise xge[tg] = xg // Teilgeste in x Gestenfeld yge[tg] = yg // Teilgeste in y Gestenfeld // Teilgeste evaluate: // regions and rose/bend detect / "contact"spots - teils open kruemmung // ... is yet UNVOLLSTÄNDIG // Abschluss-Teilgeste komplexer Gesten discern - is yet open case tg==7 : tg=0 // 7 Teilgesten // apiece Teilgeste new initialisieren xg="" // x Coordinates-String (; separiert) yg="" // x Coordinates-String (; separiert) p=0 // index position Separator (;) xp=[0] // Datenfeld with positions the Separator in xg yp=[0] // Datenfeld with positions the Separator in xg endif endproc
proc gekoord x y // Geste: x y Coordinates take in global p ix xp iy yp xg yg case y<0 : y=0 // wegen Infoleiste (.y negativ) p++ // index position Separator ; ix = round(x 0 true) + ";" // integer x with Semikolon xp[p]=xp[p-1] + st.len ix // x Trennzeichenposition take off iy = round(y 0 true) + ";" // integer y with Semikolon yp[p]=yp[p-1] + st.len iy // y Trennzeichenposition take off xg=xg+ix // ix on String add yg=yg+iy // iy on String add endproc
proc kruemmung global tg xp yp xg yg dx dy rtg i=0 course = "" case tg==7 : cls print "x " + (st.len(xp)-1) +": " + xg print "y " + (st.len(yp)-1) +": " + yg while i < (len(xp)-2) // long for compare important: different Stellenzahl! x1 = long st.mid xg xp[i]+1 xp[i+1]-xp[i]-1 // Coordinates read x2 = long st.mid xg xp[i+1]+1 xp[i+2]-xp[i+1]-1 y1 = long st.mid yg yp[i]+1 yp[i+1]-yp[i]-1 y2 = long st.mid yg yp[i+1]+1 yp[i+2]-yp[i+1]-1 dx = x2-x1 // for Krümmungsverhalten VORBEREITET dy = y2-y1 z=2 // x1==x2 row rtg Richtungssymbole s=2 // y1==y2 slot rtg Richtungssymbole case x1!=x2 : z = 0+(x1>x2) // Zeilenwahl z case y1!=y2 : s = 0+(y1>y2) // Spaltenwahl s course = course + rtg[z][s] // Richtungssymbol append // print " dx "+ dx + " dy "+ dy + " " + course i++ wend print course endproc
|
|
|
| |
|
|
|
| Have the Topic time on "Ständig" staid, I look forward to it finally with one bisl Time these whole items too self once To try. |
|
|
| |
|
|