direct input
When useing the keyboard direct input fills an array of 256 unsigned chars.
I know that the 8th bit of each element is if they key is pressed or not but what is direct input doing with the other 7bits? I looked around but everywhere just uses the last bit and ignors the rest...
It may not be doing anything at all with the other 7 bits. An 8 bit unsigned char is the smallest primitive type you can work with in C or C++, which means for anything more granular you would have to use bitwise operations to extract the characters. Personally I don't think saving the extra 224 bytes would have been worth it.
On a side note, you really don't want to use DirectInput for keyboard input anyway.
On a side note, you really don't want to use DirectInput for keyboard input anyway.
Ok how should I do it?
Also for the mouse ive got this so I can see if a button is currently pressed and if it was pressed/releashed since the last game step (at the end of each step [x][1] and [x][2] are set to false)
But how can I get the current x/y cords.
I searched ont the net but only found stuff for the buttons (above) everything else was with direct input...
Also for the mouse ive got this so I can see if a button is currently pressed and if it was pressed/releashed since the last game step (at the end of each step [x][1] and [x][2] are set to false)
case WM_LBUTTONDOWN: mouse[0][0] = true; mouse[0][1] = true; break;case WM_LBUTTONUP: mouse[0][0] = false; mouse[0][2] = true; break;case WM_MBUTTONDOWN: mouse[1][0] = true; mouse[1][1] = true; break;case WM_MBUTTONUP: mouse[1][0] = false; mouse[1][2] = true; break;case WM_RBUTTONDOWN: mouse[2][0] = true; mouse[2][1] = true; break;case WM_RBUTTONUP: mouse[2][0] = false; mouse[2][2] = true; break;
But how can I get the current x/y cords.
I searched ont the net but only found stuff for the buttons (above) everything else was with direct input...
Quote:Original post by Sync ViewsWM_MOUSEMOVE
Ok how should I do it?
Also for the mouse ive got this so I can see if a button is currently pressed and if it was pressed/releashed since the last game step (at the end of each step [x][1] and [x][2] are set to false)
*** Source Snippet Removed ***
But how can I get the current x/y cords.
I searched ont the net but only found stuff for the buttons (above) everything else was with direct input...
Or GetCursorPos (But then you'll have to use ScreenToClient to convert that into client area coordinates)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement