#### Archived

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

# DirectInput

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

## 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 on other sites
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.

1. 1
Rutin
49
2. 2
3. 3
4. 4
5. 5

• 10
• 28
• 20
• 9
• 20
• ### Forum Statistics

• Total Topics
633410
• Total Posts
3011723
• ### Who's Online (See full list)

There are no registered users currently online

×