aimDirection = atan2(mouseY - vertical centre of box, mouseX - horizontal centre of box) * 180 / pi; // what I'm doing in english
aimDirection = atan2((double)(mouseY - hitBox.y + (hitBox.h / 2)), (double)(mouseX - hitBox.x + (hitBox.w / 2))) * 180 / M_PI; // actual code
I thought you could use atan2 like so to find an angle, maybe I'm wrong.
angle = atan2(y2 - y1, x2 - x1) * 180 / pi.
I don't know how to describe the situation clearly so I made a pretty picture instead.
But the angle is never what I expect (depending on where I move my mouse vs the middle of the box) when I run the program.
(Sorry if I don't reply till tomorrow, it's getting late and I don't want to be drowsy for school )