01.02.2014, 14:52
Hier noch ein Beispiel:
*edit screenmode comment
*edit testprog lha added
*edit polygons are actually 4+ corners, Area starts the first one and Areasteps adds 3 or more...
Code:
; AreaDemo 2
;
; tests AreaCommands from RayAreaLib (C) by Frank Brandis
;
;
DEFTYPE.w
; setting up a screen
; Pal, HighRes, Interlace,8 Planes=255+1 Colors
Screen1,0,0,672,512,8,$8004,"this is a test",2,1
;then,open a window
; backdrop,noborder,activate
Window1,0,0,672,512,$1900,"",1,0
*rp=RastPort(1) ;getting RastPort
;initialising AreaLib
If AreaInit(*rp,672,512,500)<>1 Then End ;no succeed ????
; Pattern *rp,$AAAA,$AAAA,$AAAA,$AAAA ;check this out
OutlinePen *rp,1 ;sets the outline pen,(not needed)
Outline *rp,On
While Joyb(0)<>1 ;while left button not hit
Delay_1 ;DOSlib: waiting one frame
x=Rnd(600)+10 ;starting new Polygone with random coords
y=Rnd(536)+10
col.w =Rnd(254)+1 ;colour min. 1,max. 255
Area x,y,col ;starting new polygone
b=Rnd(5)+3 ;minimum of 3 (more) coords,max. 8
For a.b=1 To b
x=Rnd(600)+10 ;random coordinates
y=Rnd(536)+10 ;
AreaStep x,y ;setting next area point
Next
AreaFill ;closing and drawing this polygone
Wend
ok.l=AreaFinit ;try to freeing all memory
CloseWindow1
CloseScreen1
End ;bye bye
*edit testprog lha added
*edit polygons are actually 4+ corners, Area starts the first one and Areasteps adds 3 or more...