Pixel Perfect Collision Detection
This code demonstrates Pixel Perfect Collision Detection for DirectDraw7. It uses a function (written by me) so you can easily integrate it into your program! This is much more accurate than rectangular collision because it checks if two pixels actually touch, not the rectangles. There are instructions in the code if you need to know how to use this function.
Note: I am aware that since the background of the pictures are black, and sometimes the transparency doesn't work, the pictures have their black backgrounds and it doesn't work. If this happens to you, you will have to restart your computer to make it work properly.
Original Author: Jason Foral
Inputs
2 DirectDrawSurface7 (DDSurf1, DDSurf2)
2 RECT (RECT1, RECT2)
1 Integer (BlitCOLORKEY)
Assumptions
You must have Dirext7 installed on your computer
Returns
True/False
True if there is Perfect Pixel Collision
False if there isn't
API Declarations
Private Declare Function IntersectRect Lib "user32" (lpDestRect As RECT, lpSrc1Rect As RECT, lpSrc2Rect As RECT) As Long
About this post
Posted: 2002-06-01
By: ArchiveBot
Viewed: 124 times
Categories
Attachments
Pixel_Perf557612172002.zip
Posted: 9/3/2020 3:45:00 PM
Size: 7,921 bytes
Loading Comments ...
Comments
No comments have been added for this post.
You must be logged in to make a comment.