• Advertisement
Sign in to follow this  

coding in c#

This topic is 4606 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 creating a 3d game in c#. I'm handling user keydown event. In my guide it uses protected override void OnKeyDown(System.Windows.Forms.KeyDown.....) but coding in c++ i use windows message for that... Do I have to use OnKeyFunction or window message to handle fastler that?

Share this post


Link to post
Share on other sites
Advertisement
Using an OnKeyDown even handler is effectively the same as handling the WM_KEYDOWN message. For better performance, you might want to look at using DirectInput.

Share this post


Link to post
Share on other sites
Using OnKeyDown is fine, as is DirectInput. Do note, however, that a lot of people recommend against using WinForms for games (because of the memory overhead associated with calling DoEvents), and instead implementing your own windowing system using raw Win32, in which case you'll have to either handle WM_KEYDOWN or use DirectInput.

Share this post


Link to post
Share on other sites
Quote:
Original post by Holy Fuzz
Using OnKeyDown is fine, as is DirectInput. Do note, however, that a lot of people recommend against using WinForms for games (because of the memory overhead associated with calling DoEvents), and instead implementing your own windowing system using raw Win32, in which case you'll have to either handle WM_KEYDOWN or use DirectInput.


The thinking has changed on DoEvents. The latest recommendation from "the guys who know" is actually back to DoEvents now.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement