Need advice on how to do the "dynamic collision" with GDI.

I know how to detect the collision of 2 known object by giving giving them 2 point(e.g 1 at left top and another one at right bottom corner), and i can always use those point to check whether they re in collision or not. But how do check the collision if i have many many object??

I think it is possible if i can save all the object's corner coordinates and use loop to let them check the collision with other object one by one. It would definitely very slow or use a lot of memory when the object become more and more.

So any idea to achieve this "dynamic collision" with a better way?
How many dimensions are you trying to test against?
2D only currently
This is just math. Follow Lazyfoo's SDL tutorial on collision. Just be sure to make a rectangle structure:

1
2
3
4
struct Rect
{
    int x, y, w, h;
};
Good tutorial site you have over there, thanks!!
No problem. He has multiple others as well as that one.
Topic archived. No new replies allowed.