Original Post
Hey,
I'm using windows raw input in order to handle keyboard and mouse. I heard it's recommend way of getting it... However it happens that sometimes arrow keys aren't recognised successfully, although I suppose I'm reading the keys properly:
Keycode is a virtual code of key and KeyUp is an array where I store if certain key is pushed or released and this is used by me for game needs.
Does anybody see there a problem in my code? I would be grateful for any help. Btw maybe windows raw input isn't that good?
I'm using windows raw input in order to handle keyboard and mouse. I heard it's recommend way of getting it... However it happens that sometimes arrow keys aren't recognised successfully, although I suppose I'm reading the keys properly:
RAWINPUT *raw;
case WM_INPUT:
UINT SizeOfBuffer;
GetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &SizeOfBuffer, sizeof(RAWINPUTHEADER));
BYTE Buffer[41]; //mouse size - 32, keyboard size - 40
GetRawInputData((HRAWINPUT)lParam, RID_INPUT, Buffer, &SizeOfBuffer, sizeof(RAWINPUTHEADER));
raw = (RAWINPUT*)Buffer;
if(raw->header.dwType == RIM_TYPEKEYBOARD) //reading keyboard
{
KeyCode = raw->data.keyboard.VKey;
KeyUp[Input::Obj().KeyCode] = raw->data.keyboard.Flags & RI_KEY_BREAK;
}
if(Input::Obj().raw->header.dwType == RIM_TYPEMOUSE) //reading mouse
{
Input::Obj().MouseKeyDown = Input::Obj().raw->data.mouse.ulButtons & RI_MOUSE_LEFT_BUTTON_DOWN;
}
break;Keycode is a virtual code of key and KeyUp is an array where I store if certain key is pushed or released and this is used by me for game needs.
Does anybody see there a problem in my code? I would be grateful for any help. Btw maybe windows raw input isn't that good?