Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - ZnakE

Pages: [1]
1
General / SFML and Raw Mouse
« on: April 10, 2009, 06:15:22 pm »
Hi!
We are currently working on a game where we need several mice inputs, and we have planned to do this via rawmouse.
But we have encountered problems in getting the LPARAM needed for the function add_to_raw_mouse_x_and_y(HANDLE in_device_handle).
Code: [Select]
BOOL add_to_raw_mouse_x_and_y(HANDLE in_device_handle)
{
// When the WM_INPUT message is received, the lparam must be passed to this function to keep a running tally of
//     every mouse moves to maintain accurate results for get_raw_mouse_?_delta().
// This function will take the HANDLE of the device and find the device in the raw_mice arrayand add the
//      x and y mousemove values according to the information stored in the RAWINPUT structure.

LPBYTE lpb;
int dwSize;

if (/* GetRawInputData */(*_GRID)((HRAWINPUT)in_device_handle, RID_INPUT, NULL, &dwSize, sizeof(RAWINPUTHEADER)) == -1) {
fprintf(stderr, "ERROR: Unable to add to get size of raw input header.\n");
return 0;
}

lpb = (LPBYTE)malloc(sizeof(LPBYTE) * dwSize);
if (lpb == NULL) {
fprintf(stderr, "ERROR: Unable to allocate memory for raw input header.\n");
return 0;
}
 
if (/* GetRawInputData */(*_GRID)((HRAWINPUT)in_device_handle, RID_INPUT, lpb, &dwSize, sizeof(RAWINPUTHEADER)) != dwSize ) {
fprintf(stderr, "ERROR: Unable to add to get raw input header.\n");
return 0;
}

read_raw_input((RAWINPUT*)lpb);

free(lpb);

return 1;
}


We think that we need a device handle to pass to the function, we have tried the window handle and the LPARAM from the mouse event.

Does anybody know how to get it to work?

Pages: [1]
anything