Using the mouse pointer to collide with images...

BlitzMax Forums/BlitzMax Programming/Using the mouse pointer to collide with images...

Is this possible?

I want to show the standard windows mouse pointer in fullscreen mode to collide with the images instead of creating a mouse pointer image, and using that image to test for collisions.

Basically, I want to pick up images and move them with the mouse a place them down on another part of the screen.

Do you mean you want to see if the mouse pointer is on top of an image? If so, you can use the command ImageRectCollide(). It was in B+, and its probably in BMX, but I'm not sure, and it could be another name.

You check a 1x1 rectangle at the coordinates of the mouse pointer and see if they collide. Its something like this:

ImageRectCollide(myimage,imgx,imgy,MouseX(),MouseY(),1,1)


Can't find the imagerectcollide command or anything similar.
Possibly an oversight unless there is another way that I can't see.
Surely, we don't have to draw a dummy 1 pixel image at mousex()/mousey() and use that... do we?
<edit> Obviously you can't use a substitute mouse image or else you'll get collisions with the tail end.

Oh well, it was in B+, and I thought it would have been put into BMX. I guess not. In that case, you could just take the position of the image and find out manually if the mouse is over it. If MouseX()>=x If MouseX()<=x+w etc.

There is a CollideRect() function, but I have no idea how to use it nor whether it's similar to the old ImageRectCollide() function of B+/B3D. Talks about collision layers, which I've not experimented with yet, but might be what you're looking for.

Thanks JazzieB.
There's an example HERE

Thanks! It'll check it out.