Jump to content
  • Advertisement
Sign in to follow this  
jakussano

Directx C++ 2d pixel collision

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

Hello! I've started a 2d game engine in c++ using directx 9. (sdk april 2007).For one week i had looked for an example of pixel collision in c++. I found only in c# but i couldn't "translate" it into c++ and directx. I've made the box collision, but this one.. i can't get it. Can anyone write an example of detecting collision between 2 .png images? (i use sprites with textures to render the image on the screen).

Share this post


Link to post
Share on other sites
Advertisement
If you want absolutely pixel perfect collision testing, I wouldn't bother using DirectX at all - just use MMX and test bitmasks with bitwise AND. If each pixel in the source mask is only one bit, you can fit even very large masks in only a few kilobytes (which will cache very nicely), and test 64 pixels per iteration with MMX. You can get extremely fast results on the CPU this way.

Share this post


Link to post
Share on other sites
looks hard... i don't know what is MMX. Can you give me an example in c++? i'm a novice in game programming. I know how to program in c++ , algorithms and so on. But when graphic card(backbuffer.. bitmap..) come's in my way i stuck... I will search now about MMX on google.

Can anyone post a working c++ example?

[Edited by - jakussano on November 2, 2008 1:01:05 PM]

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!