PDA

View Full Version : Mouse and keyboard problem....



nullspace
12-24-2001, 02:00 PM
Hello, i'm making a fly game, but to retrieve the keys i use "glutKeyboardFunc" and same thing for the mouse.
But those functions have a problem.
For instance, for the mouse, it gives me the window coordinate, so X will stop at 1024 and Y at 768 !!

And for the keyboard, everytime that i have an event in the keyboard function, i go forward (z=z+1 simplified).
The problem is that it isn't cool !

I would like to have a variable which is at 0 when key the key is up and 1 when the key is down in order to modify mi direction everytime i draw.

I can solve that problem using DirectInput but on this case it will only works on windows and i have taken OpenGL for that.

Thanks for help !
(PS : i'm french so...)

rixed
12-26-2001, 05:12 AM
glutKeyboardFunc(&myKeyFunc);
glutKeyboardUpFunc(&myKeyUpFunc);

in myKeyFunc, set the variable for the key to 1
in myKeyUpFunc, set it to zero.

that's it.

nullspace
12-26-2001, 06:58 AM
OK thank you !!