English
Examples

directions for Gesten

 

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
 
12/30/15  
 



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.
 
12/30/15  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

3.732 Views

Untitledvor 0 min.
Sven Bader08/11/21
Rschnett07/17/17
OliverJung05/19/16
Micha1233404/30/16
More...

Themeninformationen

this Topic has 2 subscriber:

iF (1x)
HofK (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie