Titre de la fenêtre " Situative Awareness deiner souris bezüglich eines "+\
"Käse-Dreiecks V2.0alpha; LEERTASTE D' NEUES ZUFALLSDREIECK"
' (@) Cheeseware 2013-08 by P. Specht. Jedwede Nutzung sur alleiniges
' Risiko des Anwenders/qui Anwenderin. Allf. Fehlerrückmeldungen erbeten!
Fenêtre Style 1048:font 2:randomize:Fenêtre 0,0-%maxx,%maxy
var xm&=width(%hwnd)\2:var ym&=height(%hwnd)\2
Déclarer x!,y!,xa!,ya!,xb!,yb!,xc!,yc!,ber&
declare donnais!,gbc!,gca!,hab!,hbc!,hca!
declare xabh!,yabh!,xbch!,ybch!,xcah!,ycah!
declare xmxb!,ymyb!,rot&,code$,count&
Nochmal:
cls : line xm&,0 - xm&,2*ym& : line 0,ym& - 2*xm&,ym&
'Dreieck A,B,C
xa!=rnd(width(%hwnd))-xm&: ya!=rnd(height(%hwnd))-ym&
xb!=rnd(width(%hwnd))-xm&: yb!=rnd(height(%hwnd))-ym&
xc!=rnd(width(%hwnd))-xm&: yc!=rnd(height(%hwnd))-ym&
rot&=((yc!-ya!)*(xb!-xa!))>((yb!-ya!)*(xc!-xa!))' Drehsinn à gauche = 1
locate 2,2:imprimer "Drehrichtung: " + si(rot&,"links","rechts")
' Dreieck représenter
usepen 0,2,@rgb(255,0,0)
line xm&+xa!,(ym&-ya!)- xm&+xb!,ym&-yb!
line xm&+xb!,(ym&-yb!)- xm&+xc!,ym&-yc!
line xm&+xc!,(ym&-yc!)- xm&+xa!,ym&-ya!
drawtext xm&+xa!-10,ym&-ya!,"A"
drawtext xm&+xb!+10,ym&-yb!,"B"
drawtext xm&+xc!-10,ym&-yc!,"C"
imprimer "\n\n Votre souris blickt maintenant sur:"
WHILENOT (%Key=32) or (count&>50)'Space-bouton
WaitInput 250
x!=%MouseX-xm&
y!=ym&-%Mousey
inc count&
xabh!=(xa!+xb!)*0.5:yabh!=(ya!+yb!)*0.5
xbch!=(xb!+xc!)*0.5:ybch!=(yb!+yc!)*0.5
xcah!=(xc!+xa!)*0.5:ycah!=(yc!+ya!)*0.5
xmxb!=x!-xb!:ymyb!=y!-yb!
donnais!=(ya!-yb!)*xmxb!-ymyb!*(xa!-xb!)
gbc!=(yc!-yb!)*xmxb!-ymyb!*(xc!-xb!)
gca!=(yc!-ya!)*(x!-xa!)-(y!-ya!)*(xc!-xa!)
hab!=(yabh!-yc!)*(x!-xc!)-(y!-yc!)*(xabh!-xc!)
hbc!=(ybch!-ya!)*(x!-xa!)-(y!-ya!)*(xbch!-xa!)
hca!=(ycah!-yb!)*xmxb!-ymyb!*(xcah!-xb!)
usepen 0,1,si(count& mod 2,@rgb(0,0,255),@rgb(255,255,255))
line xm&+xabh!,(ym&-yabh!)-xm&+xc!,ym&-yc!
line xm&+xbch!,(ym&-ybch!)-xm&+xa!,ym&-ya!
line xm&+xcah!,(ym&-ycah!)-xm&+xb!,ym&-yb!
ber&=64*(rot&>0)+32*(hca!>0)+16*(hbc!>0)+8*(hab!>0)+4*(gca!>0)+2*(gbc!>0)+(donnais!>0)
locate 13,2 :imprimer right$("00000000"+suis$(ber&),7)+" = ";
locate 13,15:imprimer ber&;" "
locate 7,7
code$=»
sélectionner ber&
ifnot rot&
caseof 8 :code$="B,C, "
caseof 9 :code$="B,C,A"
caseof 10:code$="B,C,i"
caseof 18:code$="C,A,i"
caseof 20:code$="C,A,B"
caseof 22:code$="C,A, "
caseof 24:code$="C,B, "
caseof 26:code$="C,B,i"
caseof 28:code$="C,B,A"
caseof 34:code$="A,B,i"
caseof 35:code$="A,B, "
caseof 39:code$="A,B,C"
caseof 41:code$="B,A,C"
caseof 42:code$="B,A,i"
caseof 43:code$="B,A, "
caseof 50:code$="A,C,i"
caseof 54:code$="A,C, "
caseof 55:code$="A,C,B"
d'autre
caseof 72 :code$="A,C,B"
caseof 73 :code$="A,C, "
caseof 77 :code$="A,C,i"
caseof 84 :code$="B,A, "
caseof 85 :code$="B,A,i"
caseof 86 :code$="B,A,C"
caseof 88 :code$="A,B,C"
caseof 92 :code$="A,B, "
caseof 93 :code$="A,B,i"
caseof 99 :code$="C,B,A"
caseof 101:code$="C,B,i"
caseof 103:code$="C,B, "
caseof 105:code$="C,A, "
caseof 107:code$="C,A,B"
caseof 109:code$="C,A,i"
caseof 117:code$="B,C,i"
caseof 118:code$="B,C,A"
caseof 119:code$="B,C, "
endif
otherwise
imprimer "ERROR! ":sound 2000,20
endselect
imprimer code$
ENDWHILE
count&=0
waitinput 2000
goto "Nochmal"