Jump to content
  • Advertisement

Archived

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

Plexmark

DirectInput

This topic is 5224 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 am making my first basic 2d render using directx and have setup a basic keyinput system using the basic functions like acquire keyboard. My question what is the benifit of this over using the main message loop like so:
case WM_KEYDOWN:
    if(wParam == VK_ESCAPE)
	::DestroyWindow(MainWindowHandle);
    if(wParam == VK_SPACE)
        //EXCECUTE CODE

    return 0;
 
this is a very basic question but one I could not find an answer to. Thanks, Plex [edited by - plexmark on June 3, 2004 1:34:32 PM]

Share this post


Link to post
Share on other sites
Advertisement
Well it really depends on what your overall usage of "input" is going to be.

Using directx directinput allows you to sample for input instead of waiting(and having queued messages).

It allows you to collect buffered information so you don''t miss keystrokes

It allows you "transition" of key stroke states(of course the buffer can overflow but... it can take alow to do this unless your machine is very slow and your buffer small and the person is just holding down tons of keys at once).

I find using DirectInput better for me as its easier for me to OOP its development, it seems faster to me, I like have state changes recorded for me etc.

I also can have a seperate thread check the input.

If you have simple needs then the windows message loop can be useful and in some cases, can be used in conjunction with directinput

There is no real "easy" answer to choose, its up to you to figure out what is the optimal way to make my game perform(sampling or waiting) etc.

HOpe that helps some.

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!