CollideRect and Debug

BlitzMax Forums/BlitzMax Programming/CollideRect and Debug

Suco-X(Posted 2005) [#1]
Hello.
CollideRect doesn´t work with "Debug Build".

See my little sample :

Strict


Graphics 1024,768,32


Local hintergrund_img:TIMage = CreateImage(graphicswidth(),graphicsheight())


For Local i:int = 0 To 100
   SetColor Rand(0,255),rand(0,255),rand(0,255)
   DrawOval Rnd(0,graphicswidth()),rnd(0,graphicsheight()),10+rnd(20,100),10+rnd(20,150)
Next

GrabImage hintergrund_img,0,0


Repeat
Cls



SetColor 255,255,255
DrawImage hintergrund_img,0,0


If ImageRectCollide(mousex(),mousey(),1,1,hintergrund_img,0,0,0)
   DrawText "Collision",10,10
EndIf



Flip
FlushMem()
Until KeyHit(KEY_ESCAPE)


Function ImageRectCollide:int(rx:int,ry:int,rwidth:int,rheight:int,image:TImage,ix:int,iy:int,iframe:int)

   ResetCollisions()
   CollideImage(image,ix,iy,iframe,0,1)
   
   If CollideRect(rx,ry,rwidth,rheight,1,0)
      Return True
   EndIf
   
   Return false
End Function 


Where is the Problem?
Thanks for help
Mfg Suco


Suco-X(Posted 2005) [#2]
Hello.
I have found the Problem in max2d Modul.
In the CreateQuad Function he ask a Null Object.

'Bad
x0=-image.handle_x
y0=-image.handle_y
'

' Better
If image
x0=-image.handle_x
y0=-image.handle_y
EndIf

Mfg Suco