Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

mits

2D array of bitmap colors?

This topic is 5560 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

In many 2d-collision detection tutorials,it is mentioned a 2d array of bitmap''s pixel colors which we use for collision detection.My question is , if we have the .bmp file, how can we obtain this array? Is the only way to load the array mannually from the file (I have searched Wotsit.org!) or there is an easier way? Thanks

Share this post


Link to post
Share on other sites
Advertisement
When you load in the bitmap (which is essential to using any file at all), you will end up with a pointer to the bitmap data. You can consider this to be an array, and access it using bitmap[(y*map_width)+x] to get entry array[x][y].

Share this post


Link to post
Share on other sites

  • 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!