我为游戏中的 3D 效果制作了这段代码,这段代码有助于改变位置和放大 + 缩小屏幕!
但是,如果我在 win 7 64 位上运行它,当向前和向后滚动鼠标滚轮时,它只会放大,但在 Windows 7 32 位上运行时它可以正常工作!
我该如何解决它以获得任何胜利?
谢谢你的帮助!!!!
LRESULT CALLBACK MouseProc(int code, WPARAM wParam, LPARAM lParam)
{
MOUSEHOOKSTRUCTEX* mhs = (MOUSEHOOKSTRUCTEX*)lParam;
HWND MuWnd = FindWindow(TEXT("MU"), NULL);
if(UseCamera)
{
if(GetForegroundWindow() == MuWnd)
{
if(InitCamera)
{
Camera.ClipX = *Camera_ClipX;
Camera.ClipY = *Camera_ClipY;
Camera.GlClip = *Camera_GlClip;
Camera.PosZ = *Camera_PosZ;
Camera.RotY = *Camera_RotY;
Camera.RotZ = -45;
Camera.Zoom = *Camera_Zoom;
InitCamera = false;
}
else if(wParam == WM_MBUTTONDOWN)
{
MouseX = mhs->pt.x;
MouseY = mhs->pt.y;
MoveCamera = true;
}
else if(wParam == WM_MBUTTONUP)
{
MoveCamera = false;
}
else if(wParam == WM_MOUSEWHEEL)
{
int direction = mhs->mouseData;
if(direction < 0)
{
if(*Camera_Zoom < 60)
{
*Camera_Zoom += 2;
}
*Camera_ClipX = 1190 + (abs(*Camera_PosZ - 150) * 3) + 4000;
*Camera_ClipY = 2400 + (abs(*Camera_PosZ - 150) * 3) + 4000;
*Camera_GlClip = 2300 + (abs(*Camera_PosZ - 150) * 3) + 4000;
}
else if(direction > 0)
{
if(*Camera_Zoom > 12)
{
*Camera_Zoom -= 2;
}
*Camera_ClipX = 1190 + (abs(*Camera_PosZ - 150) * 3) + 4000;
*Camera_ClipY = 2400 + (abs(*Camera_PosZ - 150) * 3) + 4000;
*Camera_GlClip = 2300 + (abs(*Camera_PosZ - 150) * 3) + 4000;
}
}
else if(wParam == WM_MOUSEMOVE)
{
if(MoveCamera)
{
if(MouseX < mhs->pt.x)
{
*Camera_RotZ += 8;
if (*Camera_RotZ > 315) *Camera_RotZ = -45;
}
else if(MouseX > mhs->pt.x)
{
*Camera_RotZ -= 8;
if (*Camera_RotZ < -405) *Camera_RotZ = -45;
}
if(MouseY < mhs->pt.y)
{
if(*Camera_RotY < -45)
{
*Camera_PosZ -= 44;
*Camera_RotY += (double)2.42;
}
}
else if(MouseY > mhs->pt.y)
{
if(*Camera_RotY > -90)
{
*Camera_PosZ += 44;
*Camera_RotY -= (double)2.42;
}
}
MouseX = mhs->pt.x;
MouseY = mhs->pt.y;
*Camera_ClipX = 1190 + (abs(*Camera_PosZ - 150) * 3) + 4000;
*Camera_ClipY = 2400 + (abs(*Camera_PosZ - 150) * 3) + 4000;
*Camera_GlClip = 2300 + (abs(*Camera_PosZ - 150) * 3) + 4000;
}
}
}
}
return CallNextHookEx(MouseHook, code, wParam, lParam);
}