pbivens67 said:
is this code good enough
No.
You have forgotten about the goal. You want to collide one instance of a brick struct with a second instance of the brick struct.
Like so:
std::vector<Brick> bricks(2);
bricks[0].x = 5; // ... set all values for the first brick
bricks[1].x = 10; // ... set different values for the second
bool isColliding = bricks[0].TestCollision(bricks[1]);
That's what you want.
What you actually have is:
You have x and brick_x member variables, but x s unused and should be removed. (I guess you was thinking x is to be used for another object which you wanted to collide with the brick.)
bool TestCollision(float x, float y) This member function does not take a 2nd brick as parameter, but just a single point.
The member function does not test box vs. box, but answers ‘is the given point inside the box’?
Which is not what you want.
You need to read the whole thread again. It has detailed examples which would work.
Make a class that has just x,y,w,h to define a rectangle, and a member function to test against a second given instance.
Remember: You need to do it in a way so you can handle many bricks, not just a small number with them all hard coded.