SetImageHandle

BlitzMax Forums/BlitzMax Beginners Area/SetImageHandle

Ant(Posted 2006) [#1]
Hi having some problems with SetImageHandle. As I understand the command, you pass an image and then an xoffset and a yoffset to specify where the handle on the image is. So for example if I had a 32x32 image and passed 16 as an xoffset and 16 as a yoffset, the handle will be in the centre of the image (I know there is an AutoMidHandle command doing this, its just for explanation purposes!). Is this correct?
Thanks


tonyg(Posted 2006) [#2]
An image's handle is subtracted from the coordinates of DrawImage before rotation and scale are applied.
So, if you setimagehandle image,16,16 and then drawimage image,100,100 it would really drawimage image 84,84


Ant(Posted 2006) [#3]
Ok I see. I'm a little confused on how to achieve what I'm after then - bascially I want to use the mouse pointer to grab an image and move it by the point on the image the mouse button was clicked on. So for example if the player placed the pointer 8 pixels 'in' and 10 pixels 'down' into the image and then held the left mouse button and moved the mouse, the object would be moved relative to the point that it was clicked on (the handle would be 8 on the x axis and 10 on the y).
It seems quite a simple thing to achieve?


tonyg(Posted 2006) [#4]
Not entirely sure what you want to do.
If the mouse collides with the image and you click can't you set the image x/y coords to mousex(),mousey()?
If that's not what you want to do then then setimagehandle to mousex()-imagex,mousey()-imagey.


Ant(Posted 2006) [#5]
I was using the first method you suggested. The problem was that when I clicked on the image it jumped so the top of the image was at the same y position as the pointer. I've got round if now though.
Thanks for the help!