| |
|
|
|
Description:
PtInRect checks, whether one point within one Rechtecks befindet.
Deklaration:
DEf @PtInRect(3) !User32,PtInRect
Parameter:
1.Parameter: RECT Structure or 16byte large Memory-Variable, The The Eckpunkte the 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. 2.Parameter: X-Koordinate the abzufragenden Punktes. 3.Parameter: Y-Koordinate the abzufragenden Punktes.
Return Value:
0, if the point outside the Rechtecks lying, 1 if the point inside the Rechtecks lying.
Examples:
CompileMarkSeparationDeclare Bild$,Random1%,Random2%,X1&,x2&,Ende%,Rect1#,Crash&,Crash2&
DEf @PtInRect(3) !"User32","PtInRect"
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
LET Crash2&=0
Dim Rect1#,16
Long Rect1#,0=X1&
Long Rect1#,4=100
Long Rect1#,8=X1&+30
Long Rect1#,12=100+30
LET Crash&=@PtInRect(Rect1#,x2&,100)
LET Crash2&=Crash2&+Crash&
LET Crash&=@PtInRect(Rect1#,x2&+30,100)
LET Crash2&=Crash2&+Crash&
LET Crash&=@PtInRect(Rect1#,x2&,100+30)
LET Crash2&=Crash2&+Crash&
LET Crash&=@PtInRect(Rect1#,x2&+30,100+30)
LET Crash2&=Crash2&+Crash&
Dispose Rect1#
IF Crash2&>0
Let ENDE%=1
@Messagebox("Boing","Bums",64)
endif
LET X1&=X1&+Random1%
LET X2&=X2&-Random2%
wend
[keywords:df246b1b80] point rectangle Coordinates within same Kollision bump hedging [/keywords:df246b1b80] |
|
|
| |
|
|