最近我一直在用 C++ 和 GLUT 编写一个简单的程序,我想用滚轮来增加/减少一些旋转速度。我发现滚轮会产生 3/4 回调(3 向上滚动 4 向下滚动)。我的问题是在 Windows 上我根本没有回调!鼠标左键和中键单击生成 0,1 和 2,但没有滚轮。(我在 Visual Studio 2015 和 Windows 10 上工作)在我的 Ubuntu 系统上,使用相同的库滚轮可以很好地生成回调,但在 Windows 上什么也没有。这是我在 glutMouseFunc() 上使用的代码
void setRotationSpeed(int button, int dir, int x, int y)
{
printf("button is %d\n", button);
if (button == 3)
{
rotationSpeed += 0.1;
}
if (button == 4)
{
if (rotationSpeed > 0.0)
rotationSpeed -= 0.1;
}
}
我没有任何运气搜索过。起初我以为我使用的库可能有问题,但后来我拿了我在 Ubuntu 上使用的库,我遇到了同样的问题,所以如果有人有什么建议我会非常感激!