Archived

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

pointguard1

BUFFERED KEYBOARD INPUT WITH DIRECTINPUT

Recommended Posts

Yes, Direct Input has a method to do this. I don''t have the code in front of me or memorized, but pretty much when you create your keyboard object in DI, you have to set some values so that it can use buffered data. Then in your loop, you create an array of . . . here, let me get the code.

HRESULT hRet;

DIDEVICEOBJECTDATA rgdod[5]; // holds the info
DWORD dwItems = 5; // how many pieces of info you can hold
// get the data
hRet = G.lpDIKeyboard->GetDeviceData(
sizeof(DIDEVICEOBJECTDATA),
rgdod,
&dwItems,
0);

Anyway, after it is called, the dwItems will hold how many DIDEVICEOBJECTDATAs are actually filled. You go through the array with a for loop like for(int i = 0; i < dwItems; i++) and I believe by default, when you read the buffered data, it erases itself. I''m not sure the specifics, so just look up Get DeviceData in the DX helps. They should give you what I left out.
By the way, BE SURE YOU SET YOUR KEYBOARD TO BUFFERED IN SetProperty(). Can''t remember exactly how, but look it up.

--Vic--

Share this post


Link to post
Share on other sites