View Full Version : how to use mouse and keyboard at the same time for FPS-like movements ?
03-17-2005, 11:59 PM
I'd like to know how to use both mouse and keyboard at the same time to allow a quaque-like moving style ?
For the moment, if I keep the up arrow pressed and I press the left arrow, I stop to go forward and I strafe left...
I'd like to use the mouse for the head direction, up/down to move forward/backward, left/right to strafe left/right.
Have you got code example ?
03-18-2005, 03:11 AM
The best way to do that is setting a bool flag indicating the key was pressed. Then you can press more than one key at a once. When you release it, then you set the bool to false.
Also take a look at the topic "Problem on moving eye coordinate", since I posted interest things there. See ya!
You'd probably need to get into a serious API so you can have a good responce time. SDL and DirectX should be considered in my opinion.
moucard: why directx ? why sdl ?
glut can do that.
Yes, but maybe he'd need more functionality. I don't think glut can keep track of 2 keys pressed simultaneously. It's just for learning OpenGL (ok, and I bit more than that). But when was the last time that you saw a big game (like unreal, neverwinter, especially on linux) use glut?
The user didn't state if this was for a serious full on production or just some learning purposes. That's all. It's just my opinion.
(By the way, I still think glut rocks, but just for learning things or creating a quick prototype)
03-20-2005, 08:38 PM
glut is only for learning. if you make a somewhat big app using glut youll get a bottleneck, there was some info on www.gametutorials.com (http://www.gametutorials.com) on how cto control pressed keys
Like you said glut is for learning, and it seems it's the beginner forum. So maybe it's suffisant for him. Making our own code to manage multiple keys up or down can be best than an API that does it alone for you (and I don't think SDL can do that). I don't know about directx but I think it's not a good idea to merge directx and opengl.
03-21-2005, 03:46 AM
since vince put a post in a linux forum, i assume directX is no option.
for linux i recommend the use of XQueryKeymap, which allows you to get the state of all keys at any time without having to wait for events to be processed.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.