Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Arnau

Comparison between DirectInput & catching windows messages

This topic is 5301 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m working with managed directx, in c#, and my question is: What is better to use, DirectInput or get the windows messages by overriding the WndProc procedure? If I use the DirectInput, is it necessary to call the Applications.DoEvents? I''ve read in an article that the Applications.DoEvents call allocates each time a lot of memory! Which one do you think is more efficient?? I think that you have to poll every frame the DirectInput API to see if something has changed, is that correct? Using windows messages, that wouldn''t be needed, as I would only receive the messages when a key is pressed or the mouse changes its state. What''s your opinion? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
quote:
What is better to use


simple: whichever suits you best. Our project uses DI for keyboard input, and WndProc for mouse - just proved to work out as easy and more intuitive for the user to let the WndProc do everything based on the Windows settings.

quote:
Applications.DoEvents call allocates each time a lot of memory


Can''t say for sure, but all languages I''ve used that have this sort of feature tend to use it to signal the Virtual Machine indicating it can swap threads/processes. I don''t see why it''d have any need to allocate (noticably) large amounts of memory.

quote:
poll every frame the DirectInput API to see if something has changed, is that correct?


I haven''t used Managed DI since VB6, but you used to be able to set up a standard callback mechanism for event based input. Look up the SDK docs for info.

hth
Jack

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!