Skip to main content
gamedev.net
🔒 Locked

DirectInput

Started by Plexmark 0 replies 650+ views
Original Post
Plexmark
Plexmark
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]
Plexmark-----------------------------If I can help send me a message: ICQ:15998198
3DXD
3DXD
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.