Skip to main content
gamedev.net
🔒 Locked

DirectInput question

Started by CProgrammer 1 reply 150+ views
Original Post
CProgrammer
CProgrammer
I made a 2-player game in which one option is to let both players play with the keyboard. But when both press about 2-3 keys at once adding up to 4-6 keys down one key press is not processed. I used immediate and buffered mode. In buffered mode i use the following to get the state data:
int i;
DIDEVICEOBJECTDATA didod[24];
DWORD buffsize = 24;
lpDevice->GetDeviceData(sizeof(DIDEVICEOBJECTDATA), didod, &buffsize, 0);
for(i = 0; i < buffsize; i++)
{
	if(didod.dwData && 0x80)
	{
		keys[didod[i].dwOfs] = TRUE;
	}
	else
	{
		keys[didod[i].dwOfs] = FALSE;
	}
}
 
Then: if(keys[DIK_UP]) { //do stuff } if(keys[DIK_DOWN]) { } and so on... normally its in a class i just did it like this to show I need help desperately. Whwnever player one moves right + up then player 2 cant move right + up! -CProgrammer
Colin Jeanne
Colin Jeanne
This is a problem with the way keyboards are designed. As I understand it, the keys are divided into groups and each group can only send 1 signal at a time. If you press two keys from the same group then only 1 gets processed. See the link below.

Keyboards are evil.



Happiness = ∫ex
Invader''s Realm
CProgrammer
CProgrammer
It seems you are right thanks. There are very specific three keys that when pressed make the third not recognized.

Thanks again CProgrammer

Topic Locked

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

Sign in to reply to this topic.