AndT
Anmeldungsdatum: 02.04.2007 Beiträge: 481
|
Verfasst am: 14.12.2007, 23:50 Titel: Polygons Zeichnen |
|
|
Code: |
type xycor
x as integer
y as integer
end type
dim as xycor res = (800,600)
dim as xycor p1,p2,p3
sub drawpoly (byval p1 as xycor,byval p2 as xycor, byval p3 as xycor,byval col as integer)
line (p1.x,p1.y)-(p2.x,p2.y),col
line (p2.x,p2.y)-(p3.x,p3.y),col
line (p3.x,p3.y)-(p1.x,p1.y),col
end sub
sub kreuz (byval x as integer ,byval y as integer)
line (x-5,y)-(x+5,y),4
line (x,y-5)-(x,y+5),4
end sub
dim as integer mx,my,mb
dim as integer polygonpos = 1
dim as string key
screen 18
do
getmouse mx,my,,mb
key = inkey
select case key
case "1"
polygonpos = 1
case "2"
polygonpos = 2
case "3"
polygonpos = 3
case "4"
drawpoly(p1,p2,p3,15)
end select
select case polygonpos
case 1
if mb = 1 then p1.x = mx : p1.y = my : kreuz (mx,my)
case 2
if mb = 1 then p2.x = mx : p2.y = my : kreuz (mx,my)
case 3
if mb = 1 then p3.x = mx : p3.y = my : kreuz (mx,my)
case 4
drawpoly (p1,p2,p3,15)
end select
locate 1,1
print "p1=(";p1.x;",";p1.y;")"
print "p2=(";p2.x;",";p2.y;")"
print "p3=(";p3.x;",";p3.y;")"
print "Eckpunkt=";polygonpos
sleep 1
loop |
_________________ Bis irgendwann...  |
|