View Full Version : keyboard
Sergiu
02-16-2009, 06:31 AM
I want to if a certain combination of keys were pressed(for example, if the UP and RIGHT arrow keys have been pressed).How do
I do that?
ZbuffeR
02-16-2009, 07:27 AM
Use GLFW.
_NK47
02-16-2009, 09:54 AM
or SDL
-Ekh-
02-16-2009, 01:10 PM
or glut :)
Sergiu
02-17-2009, 05:28 AM
Can you really do this with glut?
-Ekh-
02-17-2009, 05:46 AM
void KeyFunc (unsigned char key, int x, int y)
{
switch (key){
case 27:
exit (0);
case 's':
Snapshot();
break;
}
}
...
glutKeyboardFunc (KeyFunc);
Sergiu
02-17-2009, 06:26 AM
I know that, but how do I test if 2(two) keys are pressed in the same time?(ex: UP and RIGHT keys are pressed simultaneously)
ZbuffeR
02-17-2009, 08:17 AM
"HOWTO: Check if a Key is Down" http://www.nullterminator.net/glut.html
But really, for this kind of things, GLFW is really really much easier.
IneQuation.pl
02-17-2009, 03:01 PM
I know that, but how do I test if 2(two) keys are pressed in the same time?(ex: UP and RIGHT keys are pressed simultaneously)
Jesus. Are you serious?
Use some 2 boolean variables and set them when the keys change their state, you can use them as conditions later on...
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.