Jump to content

  • Log In with Google      Sign In   
  • Create Account


Direct Input


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 DmitryNik   Members   -  Reputation: 199

Like
0Likes
Like

Posted 12 December 2012 - 04:15 AM

Hello.

May it's a very stupid question, but why we should not use Direct Input for fetching keyboard's and mouse signals? The answer: because MS said so is not applicable in current situation. Yeah, good for MS, but they didn't explain why, as far as I know. Here is the link to official msdn tutorial about Direct Input http://msdn.microsoft.com/en-us/library/windows/desktop/ee416842(v=vs.85).aspx

And here is the citation: The use of DirectInput for keyboard and mouse input is not recommended. You should use Windows messages instead.

Thank you for your answers in advance Posted Image

Edited by DmitryNik, 12 December 2012 - 04:16 AM.


Sponsor:

#2 DmitryNik   Members   -  Reputation: 199

Like
0Likes
Like

Posted 12 December 2012 - 04:54 AM

Already found the answer: DirectInput does not recognize keyboard character repeat settings. When using buffered data, DirectInput interprets each press and release as a single event with no repetition. When using immediate data, DirectInput is concerned only with the present physical state of the keys, not with keyboard events as interpreted by Windows.
DirectInput does not perform any character conversion or translation. For example, the SHIFT key is treated like any other key, not as a modifier of another keypress. Keys return the same identifiers regardless of the user's system language settings.
etc.

So, if it's all, why it shouldn't be used, then it's not that bad and Direct Input still could be used, if even somebody think it's a bad idea.

#3 BitMaster   Crossbones+   -  Reputation: 3881

Like
1Likes
Like

Posted 12 December 2012 - 05:09 AM

Those are rather significant disadvantages. As soon as you need to input even a bit of text (and be it only the player's name or naming a save) and might have to deal with non-(keyboard you are used to), it becomes a rather huge problem.

If a practice has several disadvantages AND is discouraged as not recommended by the API designer, then the question you should be asking is "Is there any really compelling reason to still do it?" instead of "Why should that stop me from using it?".

Honestly, I do not see any point of DirectInput for these cases. You need to handle Windows messages anyway, and you even have functions like GetKeyboardState to query the current state.

#4 DmitryNik   Members   -  Reputation: 199

Like
0Likes
Like

Posted 12 December 2012 - 05:30 AM

Honestly, I do not see any point of DirectInput for these cases. You need to handle Windows messages anyway, and you even have functions like GetKeyboardState to query the current state.


Thank you for your answer.
To be honest, I rather will handle windows messages. So for me it's more natural than using Direct Input. I was only curios about talks around Direct Input. Also the windows messaging is already in use during the main window drawing.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS