PDA

View Full Version : GLUT: mouse stops when a key is pressed?



Omarius
10-09-2015, 11:53 AM
Hello guys,

I am starting with freeglut and trying to implement a keybordListener.
Everything is fine, I can detect pressed keys and mouse movements.
But unfortunately everytime a key is pressed the mouse cursor stops moving. :(

I like to build a doomlike inputsystem.

Heres my Code.
I hope you guys can help me :D

void init(){
...
glutKeyboardFunc(keyboard);
...
glutMainLoop();
...
}


void keyboard(unsigned char key, int x, int y) {

int i = 0;
switch (key) {
case 'a':
std::cout << "KEY A PRESSED!!" << std::endl;
std::cout << "MOUSE X: " << x << std::endl;
std::cout << "MOUSE Y: " << y << std::endl;
break;
default:
break;
}
}
2146