如何在不点击鼠标的情况下始终获取鼠标坐标?
void mouseMove(int mx, int my) {
}
int main(int argc, char ** argv){
glutInit( &argc, argv );
glutInitWindowSize( x, y );
glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH );
glutCreateWindow( "Freetype OpenGL" );
glutReshapeFunc( reshape );
glutDisplayFunc( display );
glutKeyboardFunc(keyboard);
glutMotionFunc(mouseMove);
timer();
glutMainLoop( );
return 0;
};
最佳答案
glutMotionFunc()
当鼠标在窗口内移动并按下一个或多个鼠标按钮时调用,并且 glutPassiveMotionFunc()
当鼠标在窗口内移动而没有按下鼠标按钮时调用。
您可能想同时使用它们来涵盖所有情况。
关于c++ - 鼠标移动过多,坐标始终打开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28156807/