Archived

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

mits

2D array of bitmap colors?

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