| |
|
|
|
Description:
IntersectRect determined whether and where itself two Rechtecke overlap.
Deklaration:
DEf @IntersectRect(3) !User32,IntersectRect
Parameter:
1.Parameter: RECT Structure or 16byte large Memory-Variable, The The Eckpunkte the „Überschneidungsrechtecks“ the Rechtecke from Parameter 2 and 3 angibt.=> -byte 0-3 = X-Koordinate the left oberen corner the Rechtecks. -byte 4-7 = Y-Koordinate the left oberen corner the Rechtecks. -byte 8-11 = X-Koordinate the rechten downstairs corner the Rechtecks. -byte 12-15 = Y-Koordinate the rechten downstairs corner the Rechtecks. 2.Parameter: RECT Structure or 16byte large Memory-Variable, The The Eckpunkte the first Rechtecks angibt.=> -byte 0-3 = X-Koordinate the left oberen corner the Rechtecks. -byte 4-7 = Y-Koordinate the left oberen corner the Rechtecks. -byte 8-11 = X-Koordinate the rechten downstairs corner the Rechtecks. -byte 12-15 = Y-Koordinate the rechten downstairs corner the Rechtecks. 3.Parameter: RECT Structure or 16byte large Memory-Variable, The The Eckpunkte the second Rechtecks angibt.=> -byte 0-3 = X-Koordinate the left oberen corner the Rechtecks. -byte 4-7 = Y-Koordinate the left oberen corner the Rechtecks. -byte 8-11 = X-Koordinate the rechten downstairs corner the Rechtecks. -byte 12-15 = Y-Koordinate the rechten downstairs corner the Rechtecks.
Return Value:
If the Rechtecke from Parameter 2 and 3 overlap, becomes 1 zurückgegeben. otherwise becomes 0 zurückgegeben.
Examples:
CompileMarkSeparationDeclare Bild$,Random1%,Random2%,X1&,x2&,Ende%,Rect1#,Crash&,Rect2#,RectInt#
DEf @IntersectRect(3) !"User32","IntersectRect"
CHDIR $WINPATH
Let Bild$=@FindFirst$("*.BMP")
Windowstyle 31
Windowtitle "Kollisionsabfrage"
Window 0,0-640,440
Let x1&=0
Let X2&=600
MCLS 700,500
Randomize
Let Random1%=@RND(15)
Let Random2%=@RND(15)
Whilenot Ende%
Sleep 100
Startpaint -1
CLS
LoadSizedBmp Bild$, x1&,100-30,30;0
LoadSizedBmp Bild$, x2&,100-30,30;0
endpaint
MCopyBmp 0,0-640,480> 0,0;0
LET Crash&=0
Dim Rect1#,16
Dim Rect2#,16
Dim RectInt#,16
Long Rect1#,0=X1&
Long Rect1#,4=100
Long Rect1#,8=X1&+30
Long Rect1#,12=100+30
Long Rect2#,0=X2&
Long Rect2#,4=100
Long Rect2#,8=X2&+30
Long Rect2#,12=100+30
Clear RectInt#
LET Crash&=@IntersectRect(RectInt#,Rect1#,Rect2#)
Locate 0,0
Print @LONG(RectInt#,0)
Print @LONG(RectInt#,4)
Print @LONG(RectInt#,8)
Print @LONG(RectInt#,12)
Dispose Rect1#
Dispose Rect2#
Dispose RectInt#
IF Crash&>0
Let ENDE%=1
@Messagebox("Boing","Bums",64)
endif
LET X1&=X1&+Random1%
LET X2&=X2&-Random2%
/../../references-fonction/XProfan/wend/'>wend
[keywords:9840bb5ea8] Überschneidung Rechtecke overlap reaches tile Overlap überlappen [/keywords:9840bb5ea8] |
|
|
| |
|
|