Hex Mouse Position w/o MouseMap
I know that this has been asked a lot of Isometric views, but I was Working on a quick test I needed to select a hex tile based on the mouse position. Has anyone come up with something quick that will turn an x,y pixel location to an x,y hex location?
why the adversity to mouse maps? they are just as effective for hex as they are for iso.
Get off my lawn!
I have to admit I was being lazy.
The application runs windowed so the bitdepth of the files, while initially 24 bit, can be 8 or 16 or 32 bit. I didn''t want to have to do conversion when doing mouse map lookups. I''ve since just loaded the file and not passed it through the bitdepth converter so I can use the lookup always assuming an 8bit file format.
Thanks for the tutorial outlining how the subtractions / additions for the mouse map should be done.
The application runs windowed so the bitdepth of the files, while initially 24 bit, can be 8 or 16 or 32 bit. I didn''t want to have to do conversion when doing mouse map lookups. I''ve since just loaded the file and not passed it through the bitdepth converter so I can use the lookup always assuming an 8bit file format.
Thanks for the tutorial outlining how the subtractions / additions for the mouse map should be done.
Yah, for my hex tile map I had to the same thing, to find which hex the mouse is in, and when i sat down to do it, it only took 15 min to figure out a math formula and another 15 min to code it into the game.
If you still need to see you can icq me.
Possibility
If you still need to see you can icq me.
Possibility
For my axonometric game I use a quick polygon test. I treat the tiles as an 8 sided polygon and test to see if the mouse point is within that polygon.
Of course I only test the tiles which are within one tile radii of the mouse pointer. Anyhow just my idea!
See ya,
Ben
Of course I only test the tiles which are within one tile radii of the mouse pointer. Anyhow just my idea!
See ya,
Ben
__________________________Mencken's Law:"For every human problem, there is a neat, simple solution; and it's always wrong."
"Computers in the future may weigh no more than 1.5 tons."- Popular Mechanics, forecasting the relentless march of science in 1949
"Computers in the future may weigh no more than 1.5 tons."- Popular Mechanics, forecasting the relentless march of science in 1949
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement