SetHandle
BlitzMax Forums/BlitzMax Beginners Area/SetHandle
| ||
Not sure if I have misunderstood how it works, but I can't get SetHandle to work. I have two images - a tank body, and a turret. Both images are 60 x 60 with the image handle set to the middle of each image. The turret is drawn over the main tank body. No probs that all works fine. However, when I rotate the turret it is obviously rotating from the centre, so I have tried using SetHandle to offset where it rotates from. No matter what values I use in Sethandle it always rotates from the centre of the image. The folowing code is an extract from my main loop: DrawImage tankImg, x, y If KeyDown(Key_Z) Then rotation# = rotation# - 1 If KeyDown(Key_X) Then rotation# = rotation# + 1 SetHandle 15, 0 '<- no worky SetRotation rotation# DrawImage turretImg, x, y SetRotation 0 The manual does say that SetHandle subtracts BEFORE rotation are done, so why doesn't this work? |
| ||
dont you have to pass an image handle to sethandle? |
| ||
No, you're thinking of SetImageHandle. The way I understand it, SetHandle should affect all drawing operations (except DrawImage). |
| ||
sethande normally works with drawimage. try changing 15 to 500 or something |
| ||
Are you using the demo? The current docs state clearly that SetHandle does not work with Images which have their own handles using the SetImageHandle command. |
| ||
I'm not using the demo, I've got the latest version. I'm not using SetImageHandle, but I was using AutoMidHandle, however removing that doesn't have any effect. BTW what docs have you got? Mine say nothing about it not working with images that have their own handle! I've tried putting in stupid values like 300 and it does not make any difference either. Has anyone else had problems with this function? If I don't sort it I'll post it in the bug forum but I wantt o make sure it's not programmer error first ;-) |