case WM_KEYDOWN:
key[wParam] = true;
if(key['W'])
{
gSystem->MoveUp();
}
break;
Keyboard input too slow.
As read above, my keyboard input is slow. Say I press 'W', it will respond to it but it will have about 3 second delay before it responds to me holding it down.
;
I do not understand why it is responding so slowly, anyone have any experience with this? Thanks!
.::WARNING!::. Axesor is a total newb or n00b! Beware his lack ofintellegence of OpenGL. Feel sorry for him and keep him in your thoughts.~Leader of the phsychoward
Windows Messages are usually far too slow and unreliable for a game. Look up DirectInput or other input libraries to rig up something more reliable.
"Honesty, hard work, and determination are the keys to success in life...if you can fake that, you''ve got it made. " -- Groucho Marx
#define KEY_DOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0)if(KEY_DOWN(87){ gSystem->MoveUp();}
Quote: Original post by slowmike#define KEY_DOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0)if(KEY_DOWN(87){ gSystem->MoveUp();}
Generally, using GetAsyncKeyState is frowned on. It's good for debugging and for demos and stuff, but not really that good for games.
Quote: Original post by Videege
Windows Messages are usually far too slow and unreliable for a game. Look up DirectInput or other input libraries to rig up something more reliable.
Quake 3 used Windows messages for mouse and keyboard input, AFAIK. I'd guess that the OP has some problem in his main loop which is preventing Windows messages being processed as quickly as they should be.
My opinion is a recombination and regurgitation of the opinions of those around me. I bring nothing new to the table, and as such, can be safely ignored.[ Useful things - Firefox | GLee | Boost | DevIL ]
The SDL (http://www.libsdl.org/index.php) has an input library as well as a few other useful components: networking, audio, image loading to name a few. It is also easy to use, well documented, cross platform and directly supports OpenGL.
Cheers,
- llvllatrix
Cheers,
- llvllatrix
Nope, still nothing <_<
I just do not get it. Why won't it receive it correctly?
I just do not get it. Why won't it receive it correctly?
.::WARNING!::. Axesor is a total newb or n00b! Beware his lack ofintellegence of OpenGL. Feel sorry for him and keep him in your thoughts.~Leader of the phsychoward
Hmm. It should work the way you've done it. Are you maybe reseting the key array or maybe creating it in the message handle function? Try making it global.
You've probably got something like this:
handleMsg(....)
{
bool key[255];
switch(msg)
{
case WM_KEYDOWN ...
}
}
This will reset the key array each time the function is called. If you make it gobal it will stay true untill you set it to false and that is what you want.
You've probably got something like this:
handleMsg(....)
{
bool key[255];
switch(msg)
{
case WM_KEYDOWN ...
}
}
This will reset the key array each time the function is called. If you make it gobal it will stay true untill you set it to false and that is what you want.
Quote:
Windows Messages are usually far too slow and unreliable for a game. Look up DirectInput or other input libraries to rig up something more reliable.
These days DirectInput is not so greatly supported by Microsoft. On Windows XP and later the WM_INPUT message and the raw input API seems to work just as effectively. I believe Microsoft suggests using it in situations where DirectInput is not specifically required. And the only time that seems to be true anymore is for controller support using force-feedback and older Windows platforms.
Of course I don't mean that to be, "Don't ever use DirectInput", either. That's your decision. I'm just relaying what I've learned. ... and don't take my word for it. I haven't done much research or testing myself ;)
Boo-yeah! I have it working, in the main message loop( if(!done){}) I added the 'if(GetKeyState(KEY) & 0x08)' and it is working like a charm! Thanks for your help though!
.::WARNING!::. Axesor is a total newb or n00b! Beware his lack ofintellegence of OpenGL. Feel sorry for him and keep him in your thoughts.~Leader of the phsychoward
Quote: Original post by iNsAn1tY
Generally, using GetAsyncKeyState is frowned on. It's good for debugging and for demos and stuff, but not really that good for games.
Really? Why is that, may I ask? I would like to know if I should stop using GetAsyncKeyState in favor of something else.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement