我的问题是屏幕将不再旋转,而我的鼠标在屏幕上。只有当应用程序不再活动。
如果我把这些曲速指针取出来,它就会重新开始工作。
下面是我的鼠标更新:
mouse.x = x;
mouse.y = y;
if (x > screen.x/2)
{
player.angle -= 0.05f;
player.lx = sin(player.angle);
player.lz = -cos(player.angle);
glutWarpPointer(screen.x/2,screen.y/2);
}
else if (x < screen.x/2)
{
player.angle += 0.05f;
//if (player.vertAngle < 0)
//player.vertAngle = 0;
player.lx = sin(player.angle);
player.lz = -cos(player.angle);
glutWarpPointer(screen.x/2,screen.y/2);
}
if (y < screen.y/2)
{
player.vertAngle += 0.05f;
player.ly = sin(player.vertAngle);
glutWarpPointer(screen.x/2,screen.y/2);
}
else if (y > screen.y/2)
{
player.vertAngle -= 0.05f;
//if (player.vertAngle > 360)
//player.vertAngle = 360;
player.ly = sin(player.vertAngle);
glutWarpPointer(screen.x/2,screen.y/2);
}
1条答案
按热度按时间n3schb8v1#
使用标志忽略
glutWarpPointer()
生成的额外运动事件: