我有这段代码应该测试鼠标移动并改变相机,如果它这样做:
POINT myMouse;
GetCursorPos(&myMouse);
float Sensitivity = 10;
if(myMouse.x != middleX || myMouse.y != middleY)
{
float DifferenceX = myMouse.x - middleX;
float DifferenceY = myMouse.y - middleY;
Rotation -> y += DifferenceX/Sensitivity;
Rotation -> x -= DifferenceY/Sensitivity;
if(Rotation -> x > 90) Rotation -> x = 90;
if(Rotation -> x < -90) Rotation -> x = -90;
if(Rotation -> y > 360) Rotation -> y = 0;
SetCursorPos(middleX, middleY);
}
由于某种原因,DifferenceX 实际上是 Y 轴,DifferenceY 实际上是 X 轴。
为什么是这样?