Ejemplo n.º 1
0
LRESULT CALLBACK
MainWndProc (HWND hwnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
{
        static HWND   hwndButton = 0;

        HDC           hdc;             /* A device context used for drawing */
        PAINTSTRUCT   ps;              /* Also used during window drawing */
        RECT          rc;              /* A rectangle used during drawing */
	    char cBuf[256] = "";
	    int i;

        switch (nMsg)
        {

        case WM_DESTROY:
		  PostQuitMessage (0);
		  return 0;
		  break;

                case WM_PAINT:
		  hdc = BeginPaint(hwnd, &ps);

		  GetClientRect(hwnd, &rc);
		 	
		  for (i = 0; i < raw_mouse_count(); i++) {
		    wsprintf(cBuf, 
			     "Mouse %i X: %ld\nMouse %i Y: %ld\nMouse %i Buttons: %i%i%i\nRelative Mode (lightgun): %i\nVirtual Desktop (Multimonitor): %i", 
			     i, 
			     get_raw_mouse_x_delta(i), 
			     i, 
			     get_raw_mouse_y_delta(i), 
			     i, 
			     is_raw_mouse_button_pressed(i, 0), 
			     is_raw_mouse_button_pressed(i, 1), 
			     is_raw_mouse_button_pressed(i, 2), 
			     is_raw_mouse_absolute(i), 
			     is_raw_mouse_virtual_desktop(i));

		    DrawText(hdc, cBuf, strlen(cBuf), &rc, DT_CENTER);
		    OffsetRect(&rc,0,100); // move the draw position down a bit
		  }
		  EndPaint(hwnd, &ps);
		  return 0;
		  break;

		case WM_INPUT: 
		{
		  add_to_raw_mouse_x_and_y((HRAWINPUT)lParam);
		  
		  InvalidateRect(hwnd,0,TRUE);
		  SendMessage(hwnd,WM_PAINT,0,0);
						
		  return 0;
		} 
        }
        return DefWindowProc (hwnd, nMsg, wParam, lParam);
}
Ejemplo n.º 2
0
LRESULT CALLBACK MainWndProc (HWND hwnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
{
	switch (nMsg)
	{
	case WM_DESTROY:
		PostQuitMessage (0);
		return 0;
		break;
	case WM_INPUT: 
		{
			LastMouseIDEvent = add_to_raw_mouse_x_and_y((HRAWINPUT)lParam);
			return 0;
		} 
	}
	return DefWindowProc (hwnd, nMsg, wParam, lParam);
}
Ejemplo n.º 3
0
// custom HID - dual lightguns
void USBhandleHID( LPARAM in_device_handle )
{
	if( rawinput_active )
		add_to_raw_mouse_x_and_y( (HRAWINPUT) in_device_handle );
}