Jump to content
  • Advertisement
Sign in to follow this  
Toni Petrina

Picking on a world map

This topic is 5114 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have texture which represents my world map (normal texture). I want to know which area cursor is currently over so I've made another texture of same size but using simply two colors : black and white where black is inaccessible area and white accessible area. But I don't know how to use this. I know that I should convert cursor position into map position and check color of pixel and then change cursor. How would you do this.

Share this post


Link to post
Share on other sites
Advertisement
How you convert the cursor's position on the screen into a position on the texture depends on how you are viewing the map. Is it a 3d view, or is it top-down (2d)?

If it's top-down, then it's pretty easy, but you'll have to be more specific if you want an exact answer. If it's 3d then it's more complicated, and involves working out where the cursor is in 3d space and projecting a ray in the view direction.

Share this post


Link to post
Share on other sites
Sorry, I've should explained it more clearly.

I don't know how to load bitmap image (any format) and check for pixel. I know to do it in DX9, but locking texture, khm. no way.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!