First off, I would like to apologize since I think this has been asked before but I can’t find it. Now, on to my problem :).
I am trying to let the user bind keys to my game, here is the code I use to do that. I have edited it slightly so it’s easier to understand.
My problem is when I try to bind any of the task buttons to anything, they always come up 91. All of the other buttons seem to work fine though.
I am trying to let the user bind keys to my game, here is the code I use to do that. I have edited it slightly so it’s easier to understand.
- Code:
iKeyBind=0;//Value used to determine key to bind
//used to hold the bound key value, they start off
//intially set to the defaults in the keylist structure.
DWORD dwShoot,dwUp,dwDown,dwLeft,dwRight,dwSuperBomb,dwSelect,dwMenu;
//this is where i get really confused.
//the same value dwKey that somehow can equal
//191-194 in the function that checks which
//keypresses are equal somehow always sets the
//value of the bound key DWORD to 91
void BindKeysKeyDown(DWORD &dwKey)
{
switch(iKeyBind)
{
case 0: //NOTHING TO SET
break;
case 1: //UP
dwUp=dwKey;
break;
case 2: //DOWN
dwDown=dwKey;
break;
case 3: //LEFT
dwLeft=dwKey;
break;
case 4: //RIGHT
dwRight=dwKey;
break;
case 5: //KEY A
dwShoot=dwKey;
break;
case 6: //KEY B
dwSelect=dwKey;
break;
case 7: //KEY C
dwSuperBomb=dwKey;
break;
case 8: //KEY D/START
dwMenu=dwKey;
break;
};
iKeyBind=0;
}
My problem is when I try to bind any of the task buttons to anything, they always come up 91. All of the other buttons seem to work fine though.